public MaterialDesignPage()
        {
            this.Title = "Material Design";

            fab = new CoreFloatingActionButton()
            {
                Size         = FABControlSize.Normal,
                ColorNormal  = Color.FromHex("#DF8049"),
                ColorPressed = Color.FromHex("#DF8049").MultiplyAlpha(0.4),
                ImageName    = "plus.png"
            };

            fab.SetBinding(CoreFloatingActionButton.CommandProperty, "FABClicked");
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(0.95f, 0.95f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));


            var fteUserName = new CoreFloatingTextEntry()
            {
                Placeholder = "User Name",
                ErrorText   = "Required Field",
                ErrorColor  = Color.Red,
                Validator   = CoreFloatingTextEntry.RequiredValidator
            };

            var ftePassword = new CoreFloatingTextEntry()
            {
                Placeholder = "Password",
                IsPassword  = true,
                ErrorText   = "Required Field",
                ErrorColor  = Color.Red,
                Validator   = CoreFloatingTextEntry.RequiredValidator
            };


            Content = new StackContainer(true)
            {
                Padding  = new Thickness(20, 30, 20, 20),
                Spacing  = CoreSettings.On <double>(40, 5, 5),
                Children = { fteUserName, ftePassword }
            };

            AbsoluteLayer.Children.Add(fab);
        }
예제 #2
0
        public static Span SpanStyle(this Span span, float fontSize, Color textColor, bool isBold = false, bool isItalic = false)
        {
            var androidSize = fontSize - 2;

            span.FontSize = CoreSettings.On <float>(fontSize, androidSize);

            if (isBold)
            {
                span.FontAttributes = FontAttributes.Bold;
            }

            if (isItalic)
            {
                span.FontAttributes = FontAttributes.Italic;
            }

            span.TextColor = textColor;

            return(span);
        }
        public CardViewPage()
        {
            this.Title = "Card View";
            var lst = new CoreListView()
            {
                RowHeight           = (int)(CoreSettings.ScreenSize.Height * 0.4) + CoreSettings.On <int>(35, 45),
                ItemTemplate        = new DataTemplate(typeof(CardViewCell)),
                SeparatorVisibility = SeparatorVisibility.None,
                SeparatorColor      = Color.Transparent
            };

            lst.SetBinding(CoreListView.ItemsSourceProperty, "CardCollection");
            lst.Effects.Add(new HideListSeparatorEffect());


            Content = new StackLayout()
            {
                Padding  = 10,
                Children = { lst }
            };
        }
        public CardViewCell()
        {
            var baseHeight   = (int)(CoreSettings.ScreenSize.Height * 0.4);
            var footerHeight = CoreSettings.On <int>(20, 30);
            var lblMaring    = CoreSettings.On <int>(5, 10);

            this.Height = baseHeight + footerHeight + 10;

            var img = new CachedImage()
            {
                HeightRequest    = baseHeight - footerHeight,
                Aspect           = Aspect.AspectFill,
                DownsampleHeight = baseHeight - footerHeight,
            };

            img.SetBinding(CachedImage.SourceProperty, "ImageUrl");

            var lbl = new Label()
            {
                TextColor             = Color.Black,
                HorizontalOptions     = LayoutOptions.StartAndExpand,
                VerticalTextAlignment = TextAlignment.Center,
                Margin = new Thickness(lblMaring, lblMaring, 0, 0),
            };

            lbl.SetBinding(Label.TextProperty, "Title");


            var lblStars = new Label()
            {
                Margin                = new Thickness(0, lblMaring, lblMaring, 0),
                TextColor             = Color.Red,
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalOptions     = LayoutOptions.End,
            };

            lblStars.SetBinding(Label.FontFamilyProperty, "FontFamily");
            lblStars.SetBinding(Label.TextProperty, "CountText");

            var panel = new StackLayout()
            {
                HeightRequest   = footerHeight,
                BackgroundColor = Color.FromHex("#f6f6f6"),
                Orientation     = StackOrientation.Horizontal,
                Children        = { lbl, lblStars }
            };

            var cv = new CoreCardView()
            {
                Margin          = 5,
                HeightRequest   = baseHeight + footerHeight,
                CornerRadius    = 5,
                BackgroundColor = Color.FromHex("#f6f6f6"),
                Content         = new StackLayout()
                {
                    Children =
                    {
                        img, panel
                    }
                }
            };

            View = new StackLayout()
            {
                Children = { cv }
            };
        }