コード例 #1
0
ファイル: LogInView.cs プロジェクト: AdrianZghibarta/find-me
        public LogInView()
        {
            // - The background image

            var backgroundImage = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "blurredBackground.jpg"
                },
                Aspect = Aspect.AspectFill
            };

            this.Children.Add(
                backgroundImage,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );

            // - Manual login controls

            double textEntriesPadding = 40;
            double textEntriesHeight  = 40;

            HeaderView manualLoginHeader = new HeaderView()
            {
                Title         = "Manual Login",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            usernameEntry = new InputView();
            usernameEntry.entry.TextColor            = Color.White;
            usernameEntry.entry.PlaceholderColor     = Color.White;
            usernameEntry.entry.Keyboard             = Keyboard.Email;
            usernameEntry.bottomLine.BackgroundColor = Color.White;
            usernameEntry.image.Source = new FileImageSource()
            {
                File = "user_white.png"
            };
            usernameEntry.entry.Placeholder = "Email";
            usernameEntry.HeightRequest     = textEntriesHeight;

            loginpasswordEntry = new InputView();
            loginpasswordEntry.entry.TextColor            = Color.White;
            loginpasswordEntry.entry.PlaceholderColor     = Color.White;
            loginpasswordEntry.entry.IsPassword           = true;
            loginpasswordEntry.bottomLine.BackgroundColor = Color.White;
            loginpasswordEntry.image.Source = new FileImageSource()
            {
                File = "lock_white.png"
            };
            loginpasswordEntry.entry.Placeholder = "Password";
            loginpasswordEntry.HeightRequest     = textEntriesHeight;

            loginButton = new Button()
            {
                BackgroundColor = ColorMap.BlackTransparentBackground,
                TextColor       = Color.White,
                BorderRadius    = 3,
                BorderColor     = Color.White,
                BorderWidth     = 2,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Bold,
                HeightRequest   = textEntriesHeight,
                Text            = "LOG IN"
            };

            HeaderView socialLoginHeader = new HeaderView()
            {
                Title         = "Social Login",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            facebookLoginButton = new Button()
            {
                BackgroundColor = ColorMap.BlackTransparentBackground,
                TextColor       = Color.White,
                BorderRadius    = 3,
                BorderColor     = Color.White,
                BorderWidth     = 2,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Bold,
                HeightRequest   = textEntriesHeight,
                Text            = "Facebook"
            };

            googleLoginButton = new Button()
            {
                BackgroundColor = ColorMap.BlackTransparentBackground,
                TextColor       = Color.White,
                BorderRadius    = 3,
                BorderColor     = Color.White,
                BorderWidth     = 2,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Bold,
                HeightRequest   = textEntriesHeight,
                Text            = "Google"
            };

            var stackContentView = new StackLayout()
            {
                Padding         = new Thickness(textEntriesPadding, 100, textEntriesPadding, 125),
                Spacing         = 5,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Children        =
                {
                    manualLoginHeader,
                    this.usernameEntry,
                    this.loginpasswordEntry,
                    this.loginButton,
                    socialLoginHeader,
                    this.facebookLoginButton,
                    this.googleLoginButton
                }
            };

            var scrollView = new ScrollView()
            {
                Content = stackContentView,
            };

            this.Children.Add(
                scrollView,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );


            // - The circle bottom view

            var circleView = new RoundedBoxView()
            {
                Color         = ColorMap.OrangeColor,
                OutlineColor  = ColorMap.OrangeColor,
                OutlineWidth  = 1,
                CornerRadius  = 2000,
                WidthRequest  = 100,
                HeightRequest = 100
            };

            double circleDiametre         = 700;
            double visibleCirclePropotion = 0.15;

            this.Children.Add(
                circleView,
                Constraint.RelativeToParent((parent) => {
                return(0 - (circleDiametre - parent.Width) / 2);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height - circleDiametre * visibleCirclePropotion);
            }),
                Constraint.RelativeToParent((parent) => {
                return(circleDiametre);
            }),
                Constraint.RelativeToParent((parent) => {
                return(circleDiametre);
            })
                );

            double showRegistrationButtonWidth  = 250;
            double showRegistrationButtonHeight = 30;

            showRegistrationButton = new Button()
            {
                BackgroundColor = Color.Transparent,
                TextColor       = Color.White,
                BorderRadius    = 0,
                BorderColor     = Color.Transparent,
                BorderWidth     = 0,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Italic,
                Text            = "You don't have an account ?"
            };

            this.Children.Add(
                showRegistrationButton,
                Constraint.RelativeToParent((parent) => {
                return((parent.Width - showRegistrationButtonWidth) / 2);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height - showRegistrationButtonHeight - 20);
            }),
                Constraint.Constant(showRegistrationButtonWidth),
                Constraint.Constant(showRegistrationButtonHeight)
                );
        }
コード例 #2
0
        public RegistrationView()
        {
            var backgroundImage = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "blurredBackground.jpg"
                },
                Aspect = Aspect.AspectFill
            };

            this.Children.Add(
                backgroundImage,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );

            double textEntriesPadding = 40;
            double textEntriesHeight  = 40;

            HeaderView generalInfoHeader = new HeaderView()
            {
                Title         = "General Info",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            emailEntry = new InputView();
            emailEntry.entry.TextColor            = Color.White;
            emailEntry.entry.PlaceholderColor     = Color.White;
            emailEntry.entry.Keyboard             = Keyboard.Email;
            emailEntry.bottomLine.BackgroundColor = Color.White;
            emailEntry.image.Source = new FileImageSource()
            {
                File = "inbox.png"
            };
            emailEntry.entry.Placeholder = "Email";
            emailEntry.HeightRequest     = textEntriesHeight;

            firstNameEntry = new InputView();
            firstNameEntry.entry.TextColor            = Color.White;
            firstNameEntry.entry.PlaceholderColor     = Color.White;
            firstNameEntry.bottomLine.BackgroundColor = Color.White;
            firstNameEntry.image.Source = new FileImageSource()
            {
                File = "user_white.png"
            };
            firstNameEntry.entry.Placeholder = "First Name";
            firstNameEntry.HeightRequest     = textEntriesHeight;

            lastNameEntry = new InputView();
            lastNameEntry.entry.TextColor            = Color.White;
            lastNameEntry.entry.PlaceholderColor     = Color.White;
            lastNameEntry.bottomLine.BackgroundColor = Color.White;
            lastNameEntry.image.Source = new FileImageSource()
            {
                File = "many_user.png"
            };
            lastNameEntry.entry.Placeholder = "Last Name";
            lastNameEntry.HeightRequest     = textEntriesHeight;

            passwordEntry = new InputView();
            passwordEntry.entry.TextColor            = Color.White;
            passwordEntry.entry.PlaceholderColor     = Color.White;
            passwordEntry.entry.IsPassword           = true;
            passwordEntry.bottomLine.BackgroundColor = Color.White;
            passwordEntry.image.Source = new FileImageSource()
            {
                File = "lock_white.png"
            };
            passwordEntry.entry.Placeholder = "Password";
            passwordEntry.HeightRequest     = textEntriesHeight;

            HeaderView addressHeader = new HeaderView()
            {
                Title         = "Address Info",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            countryEntry = new InputView();
            countryEntry.entry.TextColor            = Color.White;
            countryEntry.entry.PlaceholderColor     = Color.White;
            countryEntry.bottomLine.BackgroundColor = Color.White;
            countryEntry.image.Source = new FileImageSource()
            {
                File = "country.png"
            };
            countryEntry.entry.Placeholder = "Country";
            countryEntry.HeightRequest     = textEntriesHeight;


            cityEntry = new InputView();
            cityEntry.entry.TextColor            = Color.White;
            cityEntry.entry.PlaceholderColor     = Color.White;
            cityEntry.bottomLine.BackgroundColor = Color.White;
            cityEntry.image.Source = new FileImageSource()
            {
                File = "city.png"
            };
            cityEntry.entry.Placeholder = "City";
            cityEntry.HeightRequest     = textEntriesHeight;

            addressEntry = new InputView();
            addressEntry.entry.TextColor            = Color.White;
            addressEntry.entry.PlaceholderColor     = Color.White;
            addressEntry.bottomLine.BackgroundColor = Color.White;
            addressEntry.image.Source = new FileImageSource()
            {
                File = "address.png"
            };
            addressEntry.entry.Placeholder = "Address";
            addressEntry.HeightRequest     = textEntriesHeight;

            phoneNumber = new InputView();
            phoneNumber.entry.TextColor            = Color.White;
            phoneNumber.entry.PlaceholderColor     = Color.White;
            phoneNumber.entry.Keyboard             = Keyboard.Telephone;
            phoneNumber.bottomLine.BackgroundColor = Color.White;
            phoneNumber.image.Source = new FileImageSource()
            {
                File = "phone.png"
            };
            phoneNumber.entry.Placeholder = "Phone";
            phoneNumber.HeightRequest     = textEntriesHeight;

            var bottomSeparatorView = new RelativeLayout()
            {
                HeightRequest = 5
            };

            registrationButton = new Button()
            {
                BackgroundColor = ColorMap.BlackTransparentBackground,
                TextColor       = Color.White,
                BorderRadius    = 3,
                BorderColor     = Color.White,
                BorderWidth     = 2,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Bold,
                Text            = "REGISTER",
                HeightRequest   = textEntriesHeight
            };

            var stackContentView = new StackLayout()
            {
                Padding         = new Thickness(textEntriesPadding, 125, textEntriesPadding, 25),
                Spacing         = 5,
                VerticalOptions = LayoutOptions.Start,
                Children        =
                {
                    generalInfoHeader,
                    this.emailEntry,
                    this.firstNameEntry,
                    this.lastNameEntry,
                    this.passwordEntry,
                    addressHeader,
                    this.countryEntry,
                    this.cityEntry,
                    this.addressEntry,
                    this.phoneNumber,
                    bottomSeparatorView,
                    this.registrationButton
                }
            };

            var scrollView = new ScrollView()
            {
                Content = stackContentView,
            };

            this.Children.Add(
                scrollView,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );

            var circleView = new RoundedBoxView()
            {
                Color         = ColorMap.OrangeColor,
                OutlineColor  = ColorMap.OrangeColor,
                OutlineWidth  = 1,
                CornerRadius  = 2000,
                WidthRequest  = 100,
                HeightRequest = 100
            };

            double circleDiametre         = 700;
            double visibleCirclePropotion = 0.15;

            this.Children.Add(
                circleView,
                Constraint.RelativeToParent((parent) => {
                return(-(circleDiametre - parent.Width) / 2);
            }),
                Constraint.Constant(-circleDiametre * (1 - visibleCirclePropotion)),
                Constraint.Constant(circleDiametre),
                Constraint.Constant(circleDiametre)
                );

            showLogInButton = new Button()
            {
                BackgroundColor = Color.Transparent,
                TextColor       = Color.White,
                BorderRadius    = 0,
                BorderColor     = Color.Transparent,
                BorderWidth     = 0,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Italic,
                Text            = "Already have an account ?"
            };

            double showLoginButtonWidth  = 250;
            double showLoginButtonHeight = 30;

            this.Children.Add(
                showLogInButton,
                Constraint.RelativeToParent((parent) => {
                return((parent.Width - showLoginButtonWidth) / 2);
            }),
                Constraint.Constant(20),
                Constraint.Constant(showLoginButtonWidth),
                Constraint.Constant(showLoginButtonHeight)
                );
        }