Beispiel #1
0
        public override Widget build(BuildContext context)
        {
            TextTheme textTheme = Theme.of(context).textTheme;
            TextStyle whiteTextStyle = textTheme.body1.copyWith(color: Colors.white);
            TextStyle blackTextStyle = textTheme.body1.copyWith(color: Colors.black);
            List<Widget> colorItems = primaryKeys.Select<int, Widget>((int index) => {
                return new DefaultTextStyle(
                    style: index > this.colors.threshold ? whiteTextStyle : blackTextStyle,
                    child: new ColorItem(index: index, color: this.colors.primary[index])
                );
            }).ToList();

            if (this.colors.accent != null) {
                colorItems.AddRange(accentKeys.Select<int, Widget>((int index) => {
                    return new DefaultTextStyle(
                        style: index > this.colors.threshold ? whiteTextStyle : blackTextStyle,
                        child: new ColorItem(index: index, color: this.colors.accent[index], prefix: "A")
                    );
                }).ToList());
            }

            return new ListView(
                itemExtent: ColorDemoConstants.kColorItemHeight,
                children: colorItems
            );
        }
Beispiel #2
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme     = Theme.of(context);
            TextTheme textTheme = theme.textTheme;

            return(new Row(
                       children: new List <Widget> {
                new Expanded(
                    flex: 2,
                    child: new Container(
                        margin: EdgeInsets.only(left: 24.0f),
                        child: new FittedBox(
                            fit: BoxFit.scaleDown,
                            alignment: Alignment.centerLeft,
                            child: new Text(
                                name,
                                style: textTheme.bodyText2.copyWith(fontSize: 15.0f)
                                )
                            )
                        )
                    ),
                new Expanded(
                    flex: 3,
                    child: new Container(
                        margin: EdgeInsets.only(left: 24.0f),
                        child: _crossFade(
                            new Text(value, style: textTheme.caption.copyWith(fontSize: 15.0f)),
                            new Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0f)),
                            showHint
                            )
                        )
                    )
            }
                       ));
        }
Beispiel #3
0
        public override Widget build(BuildContext context)
        {
            TextTheme     textTheme  = Theme.of(context).textTheme;
            List <Widget> styleItems = new List <Widget> {
                new TextStyleItem(name: "Display 3", style: textTheme.display3, text: "Regular 56sp"),
                new TextStyleItem(name: "Display 2", style: textTheme.display2, text: "Regular 45sp"),
                new TextStyleItem(name: "Display 1", style: textTheme.display1, text: "Regular 34sp"),
                new TextStyleItem(name: "Headline", style: textTheme.headline, text: "Regular 24sp"),
                new TextStyleItem(name: "Title", style: textTheme.title, text: "Medium 20sp"),
                new TextStyleItem(name: "Subheading", style: textTheme.subhead, text: "Regular 16sp"),
                new TextStyleItem(name: "Body 2", style: textTheme.body2, text: "Medium 14sp"),
                new TextStyleItem(name: "Body 1", style: textTheme.body1, text: "Regular 14sp"),
                new TextStyleItem(name: "Caption", style: textTheme.caption, text: "Regular 12sp"),
                new TextStyleItem(name: "Button", style: textTheme.button, text: "MEDIUM (ALL CAPS) 14sp")
            };

            if (MediaQuery.of(context).size.width > 500.0f)
            {
                styleItems.Insert(0, new TextStyleItem(
                                      name: "Display 4",
                                      style: textTheme.display4,
                                      text: "Light 112sp"
                                      ));
            }

            return(new Scaffold(
                       appBar: new AppBar(title: new Text("Typography")),
                       body: new SafeArea(
                           top: false,
                           bottom: false,
                           child: new ListView(children: styleItems)
                           )
                       ));
        }
Beispiel #4
0
 static TextTheme _buildTextTheme(TextTheme baseTheme)
 {
     return(baseTheme.copyWith(
                title: baseTheme.title.copyWith(
                    fontFamily: "GoogleSans"
                    )
                ));
 }
Beispiel #5
0
        private static TextTheme _buildTextTheme(TextTheme baseTheme)
        {
            if (_defaultGalleryFontFamily != "")
            {
                return(baseTheme.copyWith(
                           headline6: baseTheme.headline6.copyWith(
                               fontFamily: _defaultGalleryFontFamily
                               )
                           ));
            }

            return(baseTheme);
        }
Beispiel #6
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme     = Theme.of(context);
            TextTheme textTheme = theme.textTheme;

            return(new Column(
                       children: new List <Widget> {
                new Container(
                    margin: EdgeInsets.only(
                        left: 24.0f,
                        right: 24.0f,
                        bottom: 24.0f
                        ) - margin,
                    child: new Center(
                        child: new DefaultTextStyle(
                            style: textTheme.caption.copyWith(fontSize: 15.0f),
                            child: child
                            )
                        )
                    ),
                new  Divider(height: 1.0f),
                new Container(
                    padding: EdgeInsets.symmetric(vertical: 16.0f),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8.0f),
                        child: new FlatButton(
                            onPressed: onCancel,
                            child: new  Text("CANCEL", style: new TextStyle(
                                                 color: Colors.black54,
                                                 fontSize: 15.0f,
                                                 fontWeight: FontWeight.w500
                                                 ))
                            )
                        ),
                    new Container(
                        margin: EdgeInsets.only(right: 8.0f),
                        child: new FlatButton(
                            onPressed: onSave,
                            textTheme: ButtonTextTheme.accent,
                            child: new  Text("SAVE")
                            )
                        )
                }
                        )
                    )
            }
                       ));
        }
Beispiel #7
0
 static TextTheme _buildShrineTextTheme(TextTheme _base)
 {
     return(_base.copyWith(
                headline5: _base.headline5.copyWith(fontWeight: FontWeight.w500),
                headline6: _base.headline6.copyWith(fontSize: 18.0f),
                caption: _base.caption.copyWith(fontWeight: FontWeight.w400, fontSize: 14.0f),
                bodyText1: _base.bodyText1.copyWith(fontWeight: FontWeight.w500, fontSize: 16.0f),
                button: _base.button.copyWith(fontWeight: FontWeight.w500, fontSize: 14.0f)
                ).apply(
                fontFamily: "Raleway",
                displayColor: shrineColorsUtils.kShrineBrown900,
                bodyColor: shrineColorsUtils.kShrineBrown900
                ));
 }
Beispiel #8
0
        List <Widget> _createTiles()
        {
            MaterialLocalizations localizations = MaterialLocalizations.of(this.context);

            D.assert(localizations != null);
            List <Widget> children = new List <Widget> {
            };

            switch (this.widget.type)
            {
            case BottomNavigationBarType.fix:
                ThemeData themeData = Theme.of(this.context);
                TextTheme textTheme = themeData.textTheme;
                Color     themeColor;
                switch (themeData.brightness)
                {
                case Brightness.light:
                    themeColor = themeData.primaryColor;
                    break;

                case Brightness.dark:
                    themeColor = themeData.accentColor;
                    break;

                default:
                    throw new Exception("Unknown brightness: " + themeData.brightness);
                }

                ColorTween colorTween = new ColorTween(
                    begin: textTheme.caption.color,
                    end: this.widget.fixedColor ?? themeColor
                    );
                for (int i = 0; i < this.widget.items.Count; i += 1)
                {
                    int index = i;
                    children.Add(
                        new _CustomBottomNavigationTile(this.widget.type, this.widget.items[i], this._animations[i],
                                                        this.widget.iconSize,
                                                        onTap: () =>
                    {
                        if (this.widget.onTap != null)
                        {
                            this.widget.onTap(index);
                        }
                    },
                                                        colorTween: colorTween,
                                                        selected: i == this.widget.currentIndex,
                                                        indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
                                                        )
                        );
                }

                break;

            case BottomNavigationBarType.shifting:
                for (int i = 0; i < this.widget.items.Count; i += 1)
                {
                    int index = i;
                    children.Add(
                        new _CustomBottomNavigationTile(this.widget.type, this.widget.items[i], this._animations[i],
                                                        this.widget.iconSize,
                                                        onTap: () =>
                    {
                        if (this.widget.onTap != null)
                        {
                            this.widget.onTap(index);
                        }
                    },
                                                        flex:
                                                        this._evaluateFlex(this._animations[i]),
                                                        selected: i == this.widget.currentIndex,
                                                        indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
                                                        )
                        );
                }

                break;
            }

            return(children);
        }