Example #1
0
        public BiasIcon()
        {
            this.BiasBoxView = new BoxView
            {
                Color         = Color.FromHex("#C471ED"),
                WidthRequest  = 75,
                HeightRequest = 75,
            };

            this.BiasBoxViewLabel = new PartemLabelBold
            {
                Text = "C",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                TextColor         = Color.White
            };

            Children.Add(this.BiasBoxView, 0, 0);
            Children.Add(this.BiasBoxViewLabel, 0, 0);
        }
Example #2
0
        public ResultFrame()
        {
            this.Visual  = VisualMarker.Material;
            Margin       = new Thickness(20, 25, 20, 10);
            CornerRadius = 20;

            this.TitleLabel = new PartemLabelBold
            {
                Text          = "Here's what we found:",
                LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap
            };

            this.BiasIcon = new BiasIcon();

            this.BiasLabel = new PartemLabelBold
            {
                Text            = "Center",
                VerticalOptions = LayoutOptions.Center,
                FontSize        = 35
            };

            this.ArticleFrame = new ArticleFrame();

            this.BiasStatementLabel = new PartemLabelLight
            {
                Text          = "Using the power of AI, we determined that this article contains little to no bias.",
                LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap,
                Margin        = new Thickness(0, 0, 0, 15)
            };

            this.GraphLabel = new PartemLabelLight
            {
                Text          = "Here’s how confident we are on each bias side:",
                LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap
            };

            this.Graph = new ConfidenceGraph();

            this.ShareButton = new SfButton
            {
                Text               = "Share",
                FontFamily         = Device.RuntimePlatform == Device.iOS ? "Nexa-Bold" : null,
                FontSize           = 20,
                TextColor          = Color.White,
                CornerRadius       = 20,
                HeightRequest      = 50,
                BackgroundGradient = new SfLinearGradientBrush
                {
                    GradientStops =
                    {
                        new SfGradientStop {
                            Color = Color.FromHex("#2980B9"), Offset = 0
                        },
                        new SfGradientStop {
                            Color = Color.FromHex("#6DD5FA"), Offset = 0.5
                        },
                        new SfGradientStop {
                            Color = Color.FromHex("#DDF4FC"), Offset = 1
                        }
                    }
                },
                HasShadow = true,
            };

            this.Content = new StackLayout
            {
                Children =
                {
                    this.TitleLabel,
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            this.BiasIcon,
                            this.BiasLabel
                        }
                    },
                    this.ArticleFrame,
                    this.BiasStatementLabel,
                    this.GraphLabel,
                    this.Graph,
                    this.ShareButton
                }
            };
            this.BindingContextChanged += ResultFrame_BindingContextChanged;
        }
Example #3
0
        public ArticleFrame()
        {
            this.Visual        = VisualMarker.Material;
            this.HeightRequest = 60;
            this.CornerRadius  = 20;

            this.HeadlineLabel = new PartemLabelBold
            {
                Text          = "The quick brown fox jumped over the lazy dog.",
                FontSize      = 15,
                LineBreakMode = LineBreakMode.TailTruncation,
                MaxLines      = 2
            };
            this.HeadlineLabel.SetBinding(Label.TextProperty, new Binding("Headline"));

            this.SourceLabel = new PartemLabelLight
            {
                Text     = "Roblox.com",
                FontSize = 13
            };
            this.SourceLabel.SetBinding(Label.TextProperty, new Binding("Source"));

            this.ArticleImage = new CachedImage
            {
                Source               = ImageSource.FromResource("Error.png"),
                HeightRequest        = 35,
                WidthRequest         = 35,
                Aspect               = Aspect.AspectFill,
                ErrorPlaceholder     = ImageSource.FromResource("Error.png"),
                CacheDuration        = TimeSpan.FromDays(1),
                DownsampleToViewSize = true,
                RetryCount           = 0,
                RetryDelay           = 250,
            };
            //this.ArticleImage.SetBinding(CachedImage.SourceProperty, new Binding("ArticleImage"));

            this.Content = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(0.7, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.3, GridUnitType.Star)
                    }
                },
                Children =
                {
                    {
                        new StackLayout
                        {
                            Children =
                            {
                                this.HeadlineLabel,
                                this.SourceLabel
                            }
                        },
                        0, 0
                    },
                    {
                        this.ArticleImage,
                        1, 0
                    }
                },
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
        }