Ejemplo n.º 1
0
        internal _RailDestination(
            float?minWidth         = null,
            float?minExtendedWidth = null,
            Widget icon            = null,
            Widget label           = null,
            Animation <float> destinationAnimation        = null,
            Animation <float> extendedTransitionAnimation = null,
            NavigationRailLabelType?labelType             = null,
            bool?selected            = null,
            IconThemeData iconTheme  = null,
            TextStyle labelTextStyle = null,
            VoidCallback onTap       = null,
            string indexLabel        = null
            )
        {
            D.assert(minWidth != null);
            D.assert(minExtendedWidth != null);
            D.assert(icon != null);
            D.assert(label != null);
            D.assert(destinationAnimation != null);
            D.assert(extendedTransitionAnimation != null);
            D.assert(labelType != null);
            D.assert(selected != null);
            D.assert(iconTheme != null);
            D.assert(labelTextStyle != null);
            D.assert(onTap != null);
            D.assert(indexLabel != null);
            this.minWidth = minWidth;

            this.minExtendedWidth = minExtendedWidth;

            this.icon = icon;

            this.label = label;

            this.destinationAnimation = destinationAnimation;

            this.extendedTransitionAnimation = extendedTransitionAnimation;

            this.labelType = labelType;

            this.selected = selected;

            this.iconTheme = iconTheme;

            this.labelTextStyle = labelTextStyle;

            this.onTap = onTap;

            this.indexLabel = indexLabel;

            _positionAnimation = new CurvedAnimation(
                parent: new ReverseAnimation(destinationAnimation),
                curve: Curves.easeInOut,
                reverseCurve: Curves.easeInOut.flipped
                );
        }
Ejemplo n.º 2
0
        public SliverAppBar(
            Key key        = null,
            Widget leading = null,
            bool automaticallyImplyLeading = true,
            Widget title                   = null,
            List <Widget> actions          = null,
            Widget flexibleSpace           = null,
            PreferredSizeWidget bottom     = null,
            float?elevation                = null,
            bool forceElevated             = false,
            Color backgroundColor          = null,
            Brightness?brightness          = null,
            IconThemeData iconTheme        = null,
            IconThemeData actionsIconTheme = null,
            TextTheme textTheme            = null,
            bool primary                   = true,
            bool?centerTitle               = null,
            float titleSpacing             = NavigationToolbar.kMiddleSpacing,
            float?expandedHeight           = null,
            bool floating                  = false,
            bool pinned  = false,
            bool snap    = false,
            bool stretch = false,
            float stretchTriggerOffset     = 100.0f,
            AsyncCallback onStretchTrigger = null,
            ShapeBorder shape = null
            ) : base(key: key)
        {
            D.assert(floating || !snap, () => "The 'snap' argument only makes sense for floating app bars.");
            D.assert(stretchTriggerOffset > 0.0);

            this.leading = leading;
            this.automaticallyImplyLeading = true;
            this.title                = title;
            this.actions              = actions;
            this.flexibleSpace        = flexibleSpace;
            this.bottom               = bottom;
            this.elevation            = elevation;
            this.forceElevated        = forceElevated;
            this.backgroundColor      = backgroundColor;
            this.brightness           = brightness;
            this.iconTheme            = iconTheme;
            this.actionsIconTheme     = actionsIconTheme;
            this.textTheme            = textTheme;
            this.primary              = primary;
            this.centerTitle          = centerTitle;
            this.titleSpacing         = NavigationToolbar.kMiddleSpacing;
            this.expandedHeight       = expandedHeight;
            this.floating             = floating;
            this.pinned               = pinned;
            this.snap                 = snap;
            this.stretch              = stretch;
            this.stretchTriggerOffset = stretchTriggerOffset;
            this.onStretchTrigger     = onStretchTrigger;
            this.shape                = shape;
        }
Ejemplo n.º 3
0
 public static AppBarTheme lerp(AppBarTheme a, AppBarTheme b, float t)
 {
     return(new AppBarTheme(
                brightness: t < 0.5f ? a?.brightness : b?.brightness,
                color: Color.lerp(a?.color, b?.color, t),
                elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
                iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t),
                textTheme: TextTheme.lerp(a?.textTheme, b?.textTheme, t)
                ));
 }
        public override Widget build(BuildContext context)
        {
            IconThemeData iconTheme = IconTheme.of(context);

            return(new Container(
                       margin: EdgeInsets.all(4.0f),
                       width: iconTheme.size - 8.0f,
                       height: iconTheme.size - 8.0f,
                       color: iconTheme.color
                       ));
        }
Ejemplo n.º 5
0
 public _SliverAppBarDelegate(
     Widget leading,
     bool automaticallyImplyLeading,
     Widget title,
     List <Widget> actions,
     Widget flexibleSpace,
     PreferredSizeWidget bottom,
     float?elevation,
     bool forceElevated,
     Color backgroundColor,
     Brightness?brightness,
     IconThemeData iconTheme,
     IconThemeData actionsIconTheme,
     TextTheme textTheme,
     bool primary,
     bool?centerTitle,
     float titleSpacing,
     float?expandedHeight,
     float?collapsedHeight,
     float?topPadding,
     bool floating,
     bool pinned,
     FloatingHeaderSnapConfiguration snapConfiguration,
     OverScrollHeaderStretchConfiguration stretchConfiguration,
     ShapeBorder shape
     )
 {
     D.assert(primary || topPadding == 0.0);
     this.leading = leading;
     this.automaticallyImplyLeading = automaticallyImplyLeading;
     this.title                = title;
     this.actions              = actions;
     this.flexibleSpace        = flexibleSpace;
     this.bottom               = bottom;
     this.elevation            = elevation;
     this.forceElevated        = forceElevated;
     this.backgroundColor      = backgroundColor;
     this.brightness           = brightness;
     this.iconTheme            = iconTheme;
     this.actionsIconTheme     = actionsIconTheme;
     this.textTheme            = textTheme;
     this.primary              = primary;
     this.centerTitle          = centerTitle;
     this.titleSpacing         = titleSpacing;
     this.expandedHeight       = expandedHeight;
     this.collapsedHeight      = collapsedHeight;
     this.topPadding           = topPadding;
     this.floating             = floating;
     this.pinned               = pinned;
     this.snapConfiguration    = snapConfiguration;
     _bottomHeight             = bottom?.preferredSize?.height ?? 0.0f;
     this.snapConfiguration    = snapConfiguration;
     this.stretchConfiguration = stretchConfiguration;
 }
Ejemplo n.º 6
0
 public BottomNavigationBar(
     Key key = null,
     List <BottomNavigationBarItem> items = null,
     ValueChanged <int> onTap             = null,
     int currentIndex             = 0,
     float elevation              = 8.0f,
     BottomNavigationBarType?type = null,
     Color fixedColor             = null,
     Color backgroundColor        = null,
     float iconSize                    = 24.0f,
     Color selectedItemColor           = null,
     Color unselectedItemColor         = null,
     IconThemeData selectedIconTheme   = null,
     IconThemeData unselectedIconTheme = null,
     float selectedFontSize            = 14.0f,
     float unselectedFontSize          = 12.0f,
     TextStyle selectedLabelStyle      = null,
     TextStyle unselectedLabelStyle    = null,
     bool showSelectedLabels           = true,
     bool?showUnselectedLabels         = null
     ) : base(key: key)
 {
     D.assert(items != null);
     D.assert(items.Count >= 2);
     D.assert(items.All((BottomNavigationBarItem item) => item.title != null) == true,
              () => "Every item must have a non-null title"
              );
     D.assert(0 <= currentIndex && currentIndex < items.Count);
     D.assert(elevation >= 0.0f);
     D.assert(iconSize >= 0.0f);
     D.assert(selectedItemColor == null || fixedColor == null,
              () => "Either selectedItemColor or fixedColor can be specified, but not both!");
     D.assert(selectedFontSize >= 0.0f);
     D.assert(unselectedFontSize >= 0.0f);
     type                      = _type(type, items);
     this.items                = items;
     this.onTap                = onTap;
     this.currentIndex         = currentIndex;
     this.elevation            = elevation;
     this.type                 = type ?? (items.Count <= 3 ? BottomNavigationBarType.fix : BottomNavigationBarType.shifting);
     this.backgroundColor      = backgroundColor;
     this.iconSize             = iconSize;
     this.selectedItemColor    = selectedItemColor ?? fixedColor;
     this.unselectedItemColor  = unselectedItemColor;
     this.selectedIconTheme    = selectedIconTheme;
     this.unselectedIconTheme  = unselectedIconTheme;
     this.selectedFontSize     = selectedFontSize;
     this.unselectedFontSize   = unselectedFontSize;
     this.showSelectedLabels   = showSelectedLabels;
     this.selectedLabelStyle   = selectedLabelStyle;
     this.unselectedLabelStyle = unselectedLabelStyle;
     this.showUnselectedLabels = showUnselectedLabels ?? _defaultShowUnselected(_type(type, items));
 }
        public override Widget build(BuildContext context)
        {
            IconThemeData iconTheme = IconTheme.of(context);

            return(new Container(
                       margin: EdgeInsets.all(4.0f),
                       width: iconTheme.size - 8.0f,
                       height: iconTheme.size - 8.0f,
                       decoration: new BoxDecoration(
                           border: Border.all(color: iconTheme.color, width: 2.0f)
                           )
                       ));
        }
Ejemplo n.º 8
0
 public AppBarTheme(
     Brightness?brightness   = null,
     Color color             = null,
     float?elevation         = null,
     IconThemeData iconTheme = null,
     TextTheme textTheme     = null
     )
 {
     this.brightness = brightness;
     this.color      = color;
     this.elevation  = elevation;
     this.iconTheme  = iconTheme;
     this.textTheme  = textTheme;
 }
Ejemplo n.º 9
0
 AppBarTheme copyWith(
     Brightness?brightness   = null,
     Color color             = null,
     float?elevation         = null,
     IconThemeData iconTheme = null,
     TextTheme textTheme     = null
     )
 {
     return(new AppBarTheme(
                brightness: brightness ?? this.brightness,
                color: color ?? this.color,
                elevation: elevation ?? this.elevation,
                iconTheme: iconTheme ?? this.iconTheme,
                textTheme: textTheme ?? this.textTheme
                ));
 }
Ejemplo n.º 10
0
 public static ThemeData lerp(ThemeData a, ThemeData b, float t)
 {
     D.assert(a != null);
     D.assert(b != null);
     return(raw(
                brightness: t < 0.5 ? a.brightness : b.brightness,
                primaryColor: Color.lerp(a.primaryColor, b.primaryColor, t),
                primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
                primaryColorLight: Color.lerp(a.primaryColorLight, b.primaryColorLight, t),
                primaryColorDark: Color.lerp(a.primaryColorDark, b.primaryColorDark, t),
                canvasColor: Color.lerp(a.canvasColor, b.canvasColor, t),
                accentColor: Color.lerp(a.accentColor, b.accentColor, t),
                accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
                scaffoldBackgroundColor: Color.lerp(a.scaffoldBackgroundColor, b.scaffoldBackgroundColor, t),
                bottomAppBarColor: Color.lerp(a.bottomAppBarColor, b.bottomAppBarColor, t),
                cardColor: Color.lerp(a.cardColor, b.cardColor, t),
                dividerColor: Color.lerp(a.dividerColor, b.dividerColor, t),
                highlightColor: Color.lerp(a.highlightColor, b.highlightColor, t),
                splashColor: Color.lerp(a.splashColor, b.splashColor, t),
                splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
                selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t),
                unselectedWidgetColor: Color.lerp(a.unselectedWidgetColor, b.unselectedWidgetColor, t),
                disabledColor: Color.lerp(a.disabledColor, b.disabledColor, t),
                buttonTheme: t < 0.5 ? a.buttonTheme : b.buttonTheme,
                buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t),
                secondaryHeaderColor: Color.lerp(a.secondaryHeaderColor, b.secondaryHeaderColor, t),
                textSelectionColor: Color.lerp(a.textSelectionColor, b.textSelectionColor, t),
                cursorColor: Color.lerp(a.cursorColor, b.cursorColor, t),
                textSelectionHandleColor: Color.lerp(a.textSelectionHandleColor, b.textSelectionHandleColor, t),
                backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
                dialogBackgroundColor: Color.lerp(a.dialogBackgroundColor, b.dialogBackgroundColor, t),
                indicatorColor: Color.lerp(a.indicatorColor, b.indicatorColor, t),
                hintColor: Color.lerp(a.hintColor, b.hintColor, t),
                errorColor: Color.lerp(a.errorColor, b.errorColor, t),
                toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
                textTheme: TextTheme.lerp(a.textTheme, b.textTheme, t),
                primaryTextTheme: TextTheme.lerp(a.primaryTextTheme, b.primaryTextTheme, t),
                accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t),
                iconTheme: IconThemeData.lerp(a.iconTheme, b.iconTheme, t),
                primaryIconTheme: IconThemeData.lerp(a.primaryIconTheme, b.primaryIconTheme, t),
                accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
                materialTapTargetSize: t < 0.5 ? a.materialTapTargetSize : b.materialTapTargetSize,
                pageTransitionsTheme: t < 0.5 ? a.pageTransitionsTheme : b.pageTransitionsTheme,
                colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t),
                typography: Typography.lerp(a.typography, b.typography, t)
                ));
 }
Ejemplo n.º 11
0
 public static NavigationRailThemeData lerp(NavigationRailThemeData a, NavigationRailThemeData b, float t)
 {
     if (a == null && b == null)
     {
         return(null);
     }
     return(new NavigationRailThemeData(
                backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
                elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
                unselectedLabelTextStyle: TextStyle.lerp(a?.unselectedLabelTextStyle, b?.unselectedLabelTextStyle, t),
                selectedLabelTextStyle: TextStyle.lerp(a?.selectedLabelTextStyle, b?.selectedLabelTextStyle, t),
                unselectedIconTheme: IconThemeData.lerp(a?.unselectedIconTheme, b?.unselectedIconTheme, t),
                selectedIconTheme: IconThemeData.lerp(a?.selectedIconTheme, b?.selectedIconTheme, t),
                groupAlignment: MathUtils.lerpNullableFloat(a?.groupAlignment, b?.groupAlignment, t),
                labelType: t < 0.5 ? a?.labelType : b?.labelType
                ));
 }
Ejemplo n.º 12
0
 public NavigationRail(
     Color backgroundColor = null,
     bool?extended         = null,
     Widget leading        = null,
     Widget trailing       = null,
     List <NavigationRailDestination> destinations = null,
     int?selectedIndex = null,
     ValueChanged <int> onDestinationSelected = null,
     float?elevation      = null,
     float?groupAlignment = null,
     NavigationRailLabelType?labelType  = null,
     TextStyle unselectedLabelTextStyle = null,
     TextStyle selectedLabelTextStyle   = null,
     IconThemeData unselectedIconTheme  = null,
     IconThemeData selectedIconTheme    = null,
     float?minWidth         = null,
     float?minExtendedWidth = null
     )
 {
     D.assert(destinations != null && destinations.Count >= 2);
     D.assert(selectedIndex != null);
     D.assert(0 <= selectedIndex && selectedIndex < destinations.Count);
     D.assert(elevation == null || elevation > 0);
     D.assert(minWidth == null || minWidth > 0);
     D.assert(minExtendedWidth == null || minExtendedWidth > 0);
     D.assert((minWidth == null || minExtendedWidth == null) || minExtendedWidth >= minWidth);
     D.assert(extended != null);
     D.assert(!extended.Value || (labelType == null || labelType == NavigationRailLabelType.none));
     this.backgroundColor          = backgroundColor;
     this.extended                 = extended;
     this.leading                  = leading;
     this.trailing                 = trailing;
     this.destinations             = destinations;
     this.selectedIndex            = selectedIndex;
     this.onDestinationSelected    = onDestinationSelected;
     this.elevation                = elevation;
     this.groupAlignment           = groupAlignment;
     this.labelType                = labelType;
     this.unselectedLabelTextStyle = unselectedLabelTextStyle;
     this.selectedLabelTextStyle   = selectedLabelTextStyle;
     this.unselectedIconTheme      = unselectedIconTheme;
     this.selectedIconTheme        = selectedIconTheme;
     this.minWidth                 = minWidth;
     this.minExtendedWidth         = minExtendedWidth;
 }
Ejemplo n.º 13
0
 public AppBar(
     Key key        = null,
     Widget leading = null,
     bool automaticallyImplyLeading = true,
     Widget title                   = null,
     List <Widget> actions          = null,
     Widget flexibleSpace           = null,
     PreferredSizeWidget bottom     = null,
     float?elevation                = null,
     ShapeBorder shape              = null,
     Color backgroundColor          = null,
     Brightness?brightness          = null,
     IconThemeData iconTheme        = null,
     IconThemeData actionsIconTheme = null,
     TextTheme textTheme            = null,
     bool primary                   = true,
     bool?centerTitle               = null,
     float titleSpacing             = NavigationToolbar.kMiddleSpacing,
     float toolbarOpacity           = 1.0f,
     float bottomOpacity            = 1.0f
     ) : base(key: key)
 {
     D.assert(elevation == null || elevation >= 0.0);
     this.leading = leading;
     this.automaticallyImplyLeading = automaticallyImplyLeading;
     this.title            = title;
     this.actions          = actions;
     this.flexibleSpace    = flexibleSpace;
     this.bottom           = bottom;
     this.elevation        = elevation;
     this.shape            = shape;
     this.backgroundColor  = backgroundColor;
     this.brightness       = brightness;
     this.iconTheme        = iconTheme;
     this.actionsIconTheme = actionsIconTheme;
     this.textTheme        = textTheme;
     this.primary          = primary;
     this.centerTitle      = centerTitle;
     this.titleSpacing     = titleSpacing;
     this.toolbarOpacity   = toolbarOpacity;
     this.bottomOpacity    = bottomOpacity;
     preferredSize         = Size.fromHeight(material_.kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0f));
 }
Ejemplo n.º 14
0
 public NavigationRailThemeData(
     Color backgroundColor = null,
     float?elevation       = null,
     TextStyle unselectedLabelTextStyle = null,
     TextStyle selectedLabelTextStyle   = null,
     IconThemeData unselectedIconTheme  = null,
     IconThemeData selectedIconTheme    = null,
     float?groupAlignment = null,
     NavigationRailLabelType?labelType = null
     )
 {
     this.backgroundColor          = backgroundColor;
     this.elevation                = elevation;
     this.unselectedLabelTextStyle = unselectedLabelTextStyle;
     this.selectedLabelTextStyle   = selectedLabelTextStyle;
     this.unselectedIconTheme      = unselectedIconTheme;
     this.selectedIconTheme        = selectedIconTheme;
     this.groupAlignment           = groupAlignment;
     this.labelType                = labelType;
 }
Ejemplo n.º 15
0
 public _TileIcon(
     Key key = null,
     ColorTween colorTween       = null,
     Animation <float> animation = null,
     float?iconSize = null,
     bool?selected  = null,
     BottomNavigationBarItem item      = null,
     IconThemeData selectedIconTheme   = null,
     IconThemeData unselectedIconTheme = null
     ) : base(key: key)
 {
     D.assert(selected != null);
     D.assert(item != null);
     this.colorTween          = colorTween;
     this.animation           = animation;
     this.iconSize            = iconSize;
     this.selected            = selected;
     this.item                = item;
     this.selectedIconTheme   = selectedIconTheme;
     this.unselectedIconTheme = unselectedIconTheme;
 }
Ejemplo n.º 16
0
        public _BottomNavigationTile(
            BottomNavigationBarType?type,
            BottomNavigationBarItem item,
            Animation <float> animation,
            float?iconSize                    = null,
            VoidCallback onTap                = null,
            ColorTween colorTween             = null,
            float?flex                        = null,
            bool selected                     = false,
            IconThemeData selectedIconTheme   = null,
            IconThemeData unselectedIconTheme = null,
            TextStyle selectedLabelStyle      = null,
            TextStyle unselectedLabelStyle    = null,
            bool?showSelectedLabels           = null,
            bool?showUnselectedLabels         = null,
            string indexLabel                 = null
            )
        {
            D.assert(type != null);
            D.assert(item != null);
            D.assert(animation != null);
            D.assert(selectedLabelStyle != null);
            D.assert(unselectedLabelStyle != null);

            this.type                 = type;
            this.item                 = item;
            this.animation            = animation;
            this.iconSize             = iconSize;
            this.onTap                = onTap;
            this.colorTween           = colorTween;
            this.flex                 = flex;
            this.selected             = selected;
            this.selectedLabelStyle   = selectedLabelStyle;
            this.unselectedLabelStyle = unselectedLabelStyle;
            this.selectedIconTheme    = selectedIconTheme;
            this.unselectedIconTheme  = unselectedIconTheme;
            this.showSelectedLabels   = showSelectedLabels ?? false;
            this.showUnselectedLabels = showUnselectedLabels ?? false;
            this.indexLabel           = indexLabel;
        }
Ejemplo n.º 17
0
 NavigationRailThemeData copyWith(
     Color backgroundColor,
     float?elevation,
     TextStyle unselectedLabelTextStyle,
     TextStyle selectedLabelTextStyle,
     IconThemeData unselectedIconTheme,
     IconThemeData selectedIconTheme,
     float?groupAlignment,
     NavigationRailLabelType?labelType
     )
 {
     return(new NavigationRailThemeData(
                backgroundColor: backgroundColor ?? this.backgroundColor,
                elevation: elevation ?? this.elevation,
                unselectedLabelTextStyle: unselectedLabelTextStyle ?? this.unselectedLabelTextStyle,
                selectedLabelTextStyle: selectedLabelTextStyle ?? this.selectedLabelTextStyle,
                unselectedIconTheme: unselectedIconTheme ?? this.unselectedIconTheme,
                selectedIconTheme: selectedIconTheme ?? this.selectedIconTheme,
                groupAlignment: groupAlignment ?? this.groupAlignment,
                labelType: labelType ?? this.labelType
                ));
 }
Ejemplo n.º 18
0
        public override Widget build(BuildContext context)
        {
            Color         iconColor        = colorTween.evaluate(animation);
            IconThemeData defaultIconTheme = new IconThemeData(
                color: iconColor,
                size: iconSize
                );
            IconThemeData iconThemeData = IconThemeData.lerp(
                defaultIconTheme.merge(unselectedIconTheme),
                defaultIconTheme.merge(selectedIconTheme),
                animation.value
                );

            return(new Align(
                       alignment: Alignment.topCenter,
                       heightFactor: 1.0f,
                       child: new Container(
                           child: new IconTheme(
                               data: iconThemeData,
                               child: selected == true ? item.activeIcon : item.icon
                               )
                           )
                       ));
        }
Ejemplo n.º 19
0
        public override Widget build(BuildContext context)
        {
            _AnimatedIconData iconData    = (_AnimatedIconData)icon;
            IconThemeData     iconTheme   = IconTheme.of(context);
            float             iconSize    = size ?? iconTheme.size ?? 0.0f;
            float?            iconOpacity = iconTheme.opacity;
            Color             iconColor   = color ?? iconTheme.color;

            if (iconOpacity != 1.0f)
            {
                iconColor = iconColor.withOpacity(iconColor.opacity * (iconOpacity ?? 1.0f));
            }

            return(new CustomPaint(
                       size: new Size(iconSize, iconSize),
                       painter: new _AnimatedIconPainter(
                           paths: iconData.paths,
                           progress: progress,
                           color: iconColor,
                           scale: iconSize / iconData.size.width,
                           uiPathFactory: _pathFactory
                           )
                       ));
        }
Ejemplo n.º 20
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterial(context));
            ThemeData     theme     = Theme.of(context);
            ListTileTheme tileTheme = ListTileTheme.of(context);

            IconThemeData iconThemeData = null;

            if (this.leading != null || this.trailing != null)
            {
                iconThemeData = new IconThemeData(color: this._iconColor(theme, tileTheme));
            }

            Widget leadingIcon = null;

            if (this.leading != null)
            {
                leadingIcon = IconTheme.merge(
                    data: iconThemeData,
                    child: this.leading);
            }

            TextStyle titleStyle = this._titleTextStyle(theme, tileTheme);
            Widget    titleText  = new AnimatedDefaultTextStyle(
                style: titleStyle,
                duration: Constants.kThemeChangeDuration,
                child: this.title ?? new SizedBox()
                );

            Widget    subtitleText  = null;
            TextStyle subtitleStyle = null;

            if (this.subtitle != null)
            {
                subtitleStyle = this._subtitleTextStyle(theme, tileTheme);
                subtitleText  = new AnimatedDefaultTextStyle(
                    style: subtitleStyle,
                    duration: Constants.kThemeChangeDuration,
                    child: this.subtitle);
            }

            Widget trailingIcon = null;

            if (this.trailing != null)
            {
                trailingIcon = IconTheme.merge(
                    data: iconThemeData,
                    child: this.trailing);
            }

            EdgeInsets _defaultContentPadding = EdgeInsets.symmetric(horizontal: 16.0f);
            EdgeInsets resolvedContentPadding =
                this.contentPadding ?? tileTheme?.contentPadding ?? _defaultContentPadding;

            return(new InkWell(
                       onTap: this.enabled ? this.onTap : null,
                       onLongPress: this.enabled ? this.onLongPress : null,
                       child: new SafeArea(
                           top: false,
                           bottom: false,
                           mininum: resolvedContentPadding,
                           child: new _ListTile(
                               leading: leadingIcon,
                               title: titleText,
                               subtitle: subtitleText,
                               trailing: trailingIcon,
                               isDense: this._isDenseLayout(tileTheme),
                               isThreeLine: this.isThreeLine,
                               titleBaselineType: titleStyle.textBaseline,
                               subtitleBaselineType: subtitleStyle?.textBaseline
                               )
                           )
                       ));
        }
Ejemplo n.º 21
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));
            ThemeData     themeData   = Theme.of(context);
            ScaffoldState scaffold    = Scaffold.of(context, nullOk: true);
            ModalRoute    parentRoute = ModalRoute.of(context);

            bool hasDrawer      = scaffold?.hasDrawer ?? false;
            bool hasEndDrawer   = scaffold?.hasEndDrawer ?? false;
            bool canPop         = parentRoute?.canPop ?? false;
            bool useCloseButton = parentRoute is PageRoute && ((PageRoute)parentRoute).fullscreenDialog;

            IconThemeData appBarIconTheme = this.widget.iconTheme ?? themeData.primaryIconTheme;
            TextStyle     centerStyle     = this.widget.textTheme?.title ?? themeData.primaryTextTheme.title;
            TextStyle     sideStyle       = this.widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1;

            if (this.widget.toolbarOpacity != 1.0f)
            {
                float opacity =
                    new Interval(0.25f, 1.0f, curve: Curves.fastOutSlowIn).transform(this.widget.toolbarOpacity);
                if (centerStyle?.color != null)
                {
                    centerStyle = centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity));
                }

                if (sideStyle?.color != null)
                {
                    sideStyle = sideStyle.copyWith(color: sideStyle.color.withOpacity(opacity));
                }

                appBarIconTheme = appBarIconTheme.copyWith(
                    opacity: opacity * (appBarIconTheme.opacity ?? 1.0f)
                    );
            }

            Widget leading = this.widget.leading;

            if (leading == null && this.widget.automaticallyImplyLeading)
            {
                if (hasDrawer)
                {
                    leading = new IconButton(
                        icon: new Icon(Icons.menu),
                        onPressed: this._handleDrawerButton,
                        tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip);
                }
                else
                {
                    if (canPop)
                    {
                        leading = useCloseButton ? (Widget) new CloseButton() : new BackButton();
                    }
                }
            }

            if (leading != null)
            {
                leading = new ConstrainedBox(
                    constraints: BoxConstraints.tightFor(width: AppBarUtils._kLeadingWidth),
                    child: leading);
            }

            Widget title = this.widget.title;

            if (title != null)
            {
                title = new DefaultTextStyle(
                    style: centerStyle,
                    softWrap: false,
                    overflow: TextOverflow.ellipsis,
                    child: title);
            }

            Widget actions = null;

            if (this.widget.actions != null && this.widget.actions.isNotEmpty())
            {
                actions = new Row(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: this.widget.actions);
            }
            else if (hasEndDrawer)
            {
                actions = new IconButton(
                    icon: new Icon(Icons.menu),
                    onPressed: this._handleDrawerButtonEnd,
                    tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip);
            }

            Widget toolbar = new NavigationToolbar(
                leading: leading,
                middle: title,
                trailing: actions,
                centerMiddle: this.widget._getEffectiveCenterTitle(themeData).Value,
                middleSpacing: this.widget.titleSpacing);

            Widget appBar = new ClipRect(
                child: new CustomSingleChildLayout(
                    layoutDelegate: new _ToolbarContainerLayout(),
                    child: IconTheme.merge(
                        data: appBarIconTheme,
                        child: new DefaultTextStyle(
                            style: sideStyle,
                            child: toolbar)
                        )
                    )
                );

            if (this.widget.bottom != null)
            {
                appBar = new Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: new List <Widget> {
                    new Flexible(
                        child: new ConstrainedBox(
                            constraints: new BoxConstraints(maxHeight: Constants.kToolbarHeight),
                            child: appBar
                            )
                        ),
                    this.widget.bottomOpacity == 1.0f
                            ? (Widget)this.widget.bottom
                            : new Opacity(
                        opacity: new Interval(0.25f, 1.0f, curve: Curves.fastOutSlowIn).transform(this.widget
                                                                                                  .bottomOpacity),
                        child: this.widget.bottom
                        )
                }
                    );
            }

            if (this.widget.primary)
            {
                appBar = new SafeArea(
                    top: true,
                    child: appBar);
            }

            appBar = new Align(
                alignment: Alignment.topCenter,
                child: appBar);

            if (this.widget.flexibleSpace != null)
            {
                appBar = new Stack(
                    fit: StackFit.passthrough,
                    children: new List <Widget> {
                    this.widget.flexibleSpace,
                    appBar
                }
                    );
            }

            Brightness           brightness   = this.widget.brightness ?? themeData.primaryColorBrightness;
            SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark
                ? SystemUiOverlayStyle.light
                : SystemUiOverlayStyle.dark;

            return(new AnnotatedRegion <SystemUiOverlayStyle>(
                       value: overlayStyle,
                       child: new Material(
                           color: this.widget.backgroundColor ?? themeData.primaryColor,
                           elevation: this.widget.elevation,
                           child: appBar
                           )));
        }
Ejemplo n.º 22
0
 static IconThemeData _customIconTheme(IconThemeData original)
 {
     return(original.copyWith(color: shrineColorsUtils.kShrineBrown900));
 }
Ejemplo n.º 23
0
        public override Widget build(BuildContext context)
        {
            List <Widget> _gestureChildren  = new List <Widget>();
            List <Color>  _backgroundColors = new List <Color>();
            int           index             = 0;
            int           selectedIndex     = 0;
            int           pressedIndex      = 0;

            foreach (T currentKey in widget.children.Keys)
            {
                selectedIndex = (widget.groupValue.Equals(currentKey)) ? index : selectedIndex;
                pressedIndex  = (_pressedKey.Equals(currentKey)) ? index : pressedIndex;
                TextStyle textStyle = DefaultTextStyle.of(context).style.copyWith(
                    color: getTextColor(index, currentKey)
                    );
                IconThemeData iconTheme = new IconThemeData(
                    color: getTextColor(index, currentKey)
                    );

                Widget child = new Center(
                    child: widget.children[currentKey]
                    );

                child = new GestureDetector(
                    onTapDown: (TapDownDetails _event) => {
                    _onTapDown(currentKey);
                },
                    onTapCancel: _onTapCancel,
                    onTap: () => {
                    _onTap(currentKey);
                },
                    child: new IconTheme(
                        data: iconTheme,
                        child: new DefaultTextStyle(
                            style: textStyle,
                            child: child
                            )
                        )
                    );

                _backgroundColors.Add(getBackgroundColor(index, currentKey));
                _gestureChildren.Add(child);
                index += 1;
            }

            Widget box = new _SegmentedControlRenderWidget <T>(
                children: _gestureChildren,
                selectedIndex: selectedIndex,
                pressedIndex: pressedIndex,
                backgroundColors: _backgroundColors,
                borderColor: _borderColor
                );

            return(new Padding(
                       padding: widget.padding ?? CupertinoSegmentedControlsUtils._kHorizontalItemPadding,
                       child: new UnconstrainedBox(
                           constrainedAxis: Axis.horizontal,
                           child: box
                           )
                       ));
        }
Ejemplo n.º 24
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme = Theme.of(context);
            NavigationRailThemeData navigationRailTheme = NavigationRailTheme.of(context);
            MaterialLocalizations   localizations       = MaterialLocalizations.of(context);

            Color backgroundColor =
                widget.backgroundColor ?? navigationRailTheme.backgroundColor ?? theme.colorScheme.surface;
            float         elevation                  = widget.elevation ?? navigationRailTheme.elevation ?? 0;
            float         minWidth                   = widget.minWidth ?? material_._minRailWidth;
            float         minExtendedWidth           = widget.minExtendedWidth ?? material_._minExtendedRailWidth;
            Color         baseSelectedColor          = theme.colorScheme.primary;
            Color         baseColor                  = theme.colorScheme.onSurface.withOpacity(0.64f);
            IconThemeData defaultUnselectedIconTheme =
                widget.unselectedIconTheme ?? navigationRailTheme.unselectedIconTheme;
            IconThemeData unselectedIconTheme = new IconThemeData(
                size: defaultUnselectedIconTheme?.size ?? 24.0f,
                color: defaultUnselectedIconTheme?.color ?? theme.colorScheme.onSurface,
                opacity: defaultUnselectedIconTheme?.opacity ?? 1.0f
                );
            IconThemeData defaultSelectedIconTheme = widget.selectedIconTheme ?? navigationRailTheme.selectedIconTheme;
            IconThemeData selectedIconTheme        = new IconThemeData(
                size: defaultSelectedIconTheme?.size ?? 24.0f,
                color: defaultSelectedIconTheme?.color ?? theme.colorScheme.primary,
                opacity: defaultSelectedIconTheme?.opacity ?? 0.64f
                );
            TextStyle unselectedLabelTextStyle = theme.textTheme.bodyText1.copyWith(color: baseColor)
                                                 .merge(widget.unselectedLabelTextStyle ?? navigationRailTheme.unselectedLabelTextStyle);
            TextStyle selectedLabelTextStyle = theme.textTheme.bodyText1.copyWith(color: baseSelectedColor)
                                               .merge(widget.selectedLabelTextStyle ?? navigationRailTheme.selectedLabelTextStyle);
            float groupAlignment = widget.groupAlignment ?? navigationRailTheme.groupAlignment ?? -1.0f;
            NavigationRailLabelType labelType =
                widget.labelType ?? navigationRailTheme.labelType ?? NavigationRailLabelType.none;

            var materialChildren = new List <Widget>();

            materialChildren.Add(material_._verticalSpacer);

            if (widget.leading != null)
            {
                materialChildren.AddRange(new List <Widget>()
                {
                    new ConstrainedBox(
                        constraints: new BoxConstraints(
                            minWidth: MathUtils.lerpNullableFloat(minWidth, minExtendedWidth, _extendedAnimation.value)
                            ),
                        child: widget.leading
                        ),
                    material_._verticalSpacer,
                });
            }

            var alignChildren = new List <Widget>();

            for (int i = 0; i < widget.destinations.Count; i += 1)
            {
                alignChildren.Add(new _RailDestination(
                                      minWidth: minWidth,
                                      minExtendedWidth: minExtendedWidth,
                                      extendedTransitionAnimation: _extendedAnimation,
                                      selected: widget.selectedIndex == i,
                                      icon: widget.selectedIndex == i ? widget.destinations[i].selectedIcon : widget.destinations[i].icon,
                                      label: widget.destinations[i].label,
                                      destinationAnimation: _destinationAnimations[i],
                                      labelType: labelType,
                                      iconTheme: widget.selectedIndex == i ? selectedIconTheme : unselectedIconTheme,
                                      labelTextStyle: widget.selectedIndex == i ? selectedLabelTextStyle : unselectedLabelTextStyle,
                                      onTap: () => { widget.onDestinationSelected(i); },
                                      indexLabel: localizations.tabLabel(
                                          tabIndex: i + 1,
                                          tabCount: widget.destinations.Count
                                          )
                                      ));
            }

            if (widget.trailing != null)
            {
                alignChildren.Add(new ConstrainedBox(
                                      constraints: new BoxConstraints(
                                          minWidth: MathUtils.lerpNullableFloat(minWidth, minExtendedWidth, _extendedAnimation.value)
                                          ),
                                      child: widget.trailing
                                      ));
            }

            materialChildren.Add(new Expanded(
                                     child: new Align(
                                         alignment: new Alignment(0, groupAlignment),
                                         child: new Column(
                                             mainAxisSize: MainAxisSize.min,
                                             children: alignChildren
                                             )
                                         )
                                     ));

            return(new _ExtendedNavigationRailAnimation(
                       animation: _extendedAnimation,
                       child: new Material(
                           elevation: elevation,
                           color: backgroundColor,
                           child: new Column(
                               children: materialChildren
                               )
                           )
                       ));
        }
Ejemplo n.º 25
0
 public ThemeData copyWith(
     Brightness?brightness,
     Color primaryColor,
     Brightness?primaryColorBrightness,
     Color primaryColorLight,
     Color primaryColorDark,
     Color accentColor,
     Brightness?accentColorBrightness,
     Color canvasColor,
     Color scaffoldBackgroundColor,
     Color bottomAppBarColor,
     Color cardColor,
     Color dividerColor,
     Color highlightColor,
     Color splashColor,
     InteractiveInkFeatureFactory splashFactory,
     Color selectedRowColor,
     Color unselectedWidgetColor,
     Color disabledColor,
     ButtonThemeData buttonTheme,
     Color buttonColor,
     Color secondaryHeaderColor,
     Color textSelectionColor,
     Color cursorColor,
     Color textSelectionHandleColor,
     Color backgroundColor,
     Color dialogBackgroundColor,
     Color indicatorColor,
     Color hintColor,
     Color errorColor,
     Color toggleableActiveColor,
     TextTheme textTheme,
     TextTheme primaryTextTheme,
     TextTheme accentTextTheme,
     IconThemeData iconTheme,
     IconThemeData primaryIconTheme,
     IconThemeData accentIconTheme,
     MaterialTapTargetSize?materialTapTargetSize,
     PageTransitionsTheme pageTransitionsTheme,
     ColorScheme colorScheme,
     Typography typography
     )
 {
     return(raw(
                brightness: brightness ?? this.brightness,
                primaryColor: primaryColor ?? this.primaryColor,
                primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
                primaryColorLight: primaryColorLight ?? this.primaryColorLight,
                primaryColorDark: primaryColorDark ?? this.primaryColorDark,
                accentColor: accentColor ?? this.accentColor,
                accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness,
                canvasColor: canvasColor ?? this.canvasColor,
                scaffoldBackgroundColor: scaffoldBackgroundColor ?? this.scaffoldBackgroundColor,
                bottomAppBarColor: bottomAppBarColor ?? this.bottomAppBarColor,
                cardColor: cardColor ?? this.cardColor,
                dividerColor: dividerColor ?? this.dividerColor,
                highlightColor: highlightColor ?? this.highlightColor,
                splashColor: splashColor ?? this.splashColor,
                splashFactory: splashFactory ?? this.splashFactory,
                selectedRowColor: selectedRowColor ?? this.selectedRowColor,
                unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
                disabledColor: disabledColor ?? this.disabledColor,
                buttonTheme: buttonTheme ?? this.buttonTheme,
                buttonColor: buttonColor ?? this.buttonColor,
                secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
                textSelectionColor: textSelectionColor ?? this.textSelectionColor,
                cursorColor: cursorColor ?? this.cursorColor,
                textSelectionHandleColor: textSelectionHandleColor ?? this.textSelectionHandleColor,
                backgroundColor: backgroundColor ?? this.backgroundColor,
                dialogBackgroundColor: dialogBackgroundColor ?? this.dialogBackgroundColor,
                indicatorColor: indicatorColor ?? this.indicatorColor,
                hintColor: hintColor ?? this.hintColor,
                errorColor: errorColor ?? this.errorColor,
                toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
                textTheme: textTheme ?? this.textTheme,
                primaryTextTheme: primaryTextTheme ?? this.primaryTextTheme,
                accentTextTheme: accentTextTheme ?? this.accentTextTheme,
                iconTheme: iconTheme ?? this.iconTheme,
                primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
                accentIconTheme: accentIconTheme ?? this.accentIconTheme,
                materialTapTargetSize: materialTapTargetSize ?? this.materialTapTargetSize,
                pageTransitionsTheme: pageTransitionsTheme ?? this.pageTransitionsTheme,
                colorScheme: colorScheme ?? this.colorScheme,
                typography: typography ?? this.typography
                ));
 }
Ejemplo n.º 26
0
        public static ThemeData raw(
            Brightness?brightness,
            Color primaryColor,
            Brightness?primaryColorBrightness,
            Color primaryColorLight,
            Color primaryColorDark,
            Color canvasColor,
            Color accentColor,
            Brightness?accentColorBrightness,
            Color scaffoldBackgroundColor,
            Color bottomAppBarColor,
            Color cardColor,
            Color dividerColor,
            Color highlightColor,
            Color splashColor,
            InteractiveInkFeatureFactory splashFactory,
            Color selectedRowColor,
            Color unselectedWidgetColor,
            Color disabledColor,
            ButtonThemeData buttonTheme,
            Color buttonColor,
            Color secondaryHeaderColor,
            Color textSelectionColor,
            Color cursorColor,
            Color textSelectionHandleColor,
            Color backgroundColor,
            Color dialogBackgroundColor,
            Color indicatorColor,
            Color hintColor,
            Color errorColor,
            Color toggleableActiveColor,
            TextTheme textTheme,
            TextTheme primaryTextTheme,
            TextTheme accentTextTheme,
            IconThemeData iconTheme,
            IconThemeData primaryIconTheme,
            IconThemeData accentIconTheme,
            MaterialTapTargetSize?materialTapTargetSize,
            PageTransitionsTheme pageTransitionsTheme,
            ColorScheme colorScheme,
            Typography typography
            )
        {
            D.assert(brightness != null);
            D.assert(primaryColor != null);
            D.assert(primaryColorBrightness != null);
            D.assert(primaryColorLight != null);
            D.assert(primaryColorDark != null);
            D.assert(accentColor != null);
            D.assert(accentColorBrightness != null);
            D.assert(canvasColor != null);
            D.assert(scaffoldBackgroundColor != null);
            D.assert(bottomAppBarColor != null);
            D.assert(cardColor != null);
            D.assert(dividerColor != null);
            D.assert(highlightColor != null);
            D.assert(splashColor != null);
            D.assert(splashFactory != null);
            D.assert(selectedRowColor != null);
            D.assert(unselectedWidgetColor != null);
            D.assert(disabledColor != null);
            D.assert(toggleableActiveColor != null);
            D.assert(buttonTheme != null);
            D.assert(secondaryHeaderColor != null);
            D.assert(textSelectionColor != null);
            D.assert(cursorColor != null);
            D.assert(textSelectionHandleColor != null);
            D.assert(backgroundColor != null);
            D.assert(dialogBackgroundColor != null);
            D.assert(indicatorColor != null);
            D.assert(hintColor != null);
            D.assert(errorColor != null);
            D.assert(textTheme != null);
            D.assert(primaryTextTheme != null);
            D.assert(accentTextTheme != null);
            D.assert(iconTheme != null);
            D.assert(primaryIconTheme != null);
            D.assert(accentIconTheme != null);
            D.assert(materialTapTargetSize != null);
            D.assert(pageTransitionsTheme != null);
            D.assert(colorScheme != null);
            D.assert(typography != null);

            D.assert(buttonColor != null);

            return(new ThemeData(
                       brightness: brightness,
                       primaryColor: primaryColor,
                       primaryColorBrightness: primaryColorBrightness,
                       primaryColorLight: primaryColorLight,
                       primaryColorDark: primaryColorDark,
                       accentColor: accentColor,
                       accentColorBrightness: accentColorBrightness,
                       canvasColor: canvasColor,
                       scaffoldBackgroundColor: scaffoldBackgroundColor,
                       bottomAppBarColor: bottomAppBarColor,
                       cardColor: cardColor,
                       dividerColor: dividerColor,
                       highlightColor: highlightColor,
                       splashColor: splashColor,
                       splashFactory: splashFactory,
                       selectedRowColor: selectedRowColor,
                       unselectedWidgetColor: unselectedWidgetColor,
                       disabledColor: disabledColor,
                       buttonTheme: buttonTheme,
                       buttonColor: buttonColor,
                       toggleableActiveColor: toggleableActiveColor,
                       secondaryHeaderColor: secondaryHeaderColor,
                       textSelectionColor: textSelectionColor,
                       cursorColor: cursorColor,
                       textSelectionHandleColor: textSelectionHandleColor,
                       backgroundColor: backgroundColor,
                       dialogBackgroundColor: dialogBackgroundColor,
                       indicatorColor: indicatorColor,
                       hintColor: hintColor,
                       errorColor: errorColor,
                       textTheme: textTheme,
                       primaryTextTheme: primaryTextTheme,
                       accentTextTheme: accentTextTheme,
                       iconTheme: iconTheme,
                       primaryIconTheme: primaryIconTheme,
                       accentIconTheme: accentIconTheme,
                       materialTapTargetSize: materialTapTargetSize,
                       pageTransitionsTheme: pageTransitionsTheme,
                       colorScheme: colorScheme,
                       typography: typography));
        }
Ejemplo n.º 27
0
        public ThemeData(
            Brightness?brightness             = null,
            MaterialColor primarySwatch       = null,
            Color primaryColor                = null,
            Brightness?primaryColorBrightness = null,
            Color primaryColorLight           = null,
            Color primaryColorDark            = null,
            Color accentColor = null,
            Brightness?accentColorBrightness = null,
            Color canvasColor             = null,
            Color scaffoldBackgroundColor = null,
            Color bottomAppBarColor       = null,
            Color cardColor      = null,
            Color dividerColor   = null,
            Color highlightColor = null,
            Color splashColor    = null,
            InteractiveInkFeatureFactory splashFactory = null,
            Color selectedRowColor         = null,
            Color unselectedWidgetColor    = null,
            Color disabledColor            = null,
            Color buttonColor              = null,
            ButtonThemeData buttonTheme    = null,
            Color secondaryHeaderColor     = null,
            Color textSelectionColor       = null,
            Color cursorColor              = null,
            Color textSelectionHandleColor = null,
            Color backgroundColor          = null,
            Color dialogBackgroundColor    = null,
            Color indicatorColor           = null,
            Color hintColor                = null,
            Color errorColor               = null,
            Color toggleableActiveColor    = null,
            string fontFamily              = null,
            TextTheme textTheme            = null,
            TextTheme primaryTextTheme     = null,
            TextTheme accentTextTheme      = null,
            IconThemeData iconTheme        = null,
            IconThemeData primaryIconTheme = null,
            IconThemeData accentIconTheme  = null,
            MaterialTapTargetSize?materialTapTargetSize = null,
            PageTransitionsTheme pageTransitionsTheme   = null,
            ColorScheme colorScheme = null,
            Typography typography   = null
            )
        {
            brightness = brightness ?? Brightness.light;
            bool isDark = brightness == Brightness.dark;

            primarySwatch          = primarySwatch ?? Colors.blue;
            primaryColor           = primaryColor ?? (isDark ? Colors.grey[900] : primarySwatch);
            primaryColorBrightness = primaryColorBrightness ?? estimateBrightnessForColor(primaryColor);
            primaryColorLight      = primaryColorLight ?? (isDark ? Colors.grey[500] : primarySwatch[100]);
            primaryColorDark       = primaryColorDark ?? (isDark ? Colors.black : primarySwatch[700]);
            bool primaryIsDark = primaryColorBrightness == Brightness.dark;

            toggleableActiveColor = toggleableActiveColor ??
                                    (isDark ? Colors.tealAccent[200] : (accentColor ?? primarySwatch[600]));

            accentColor           = accentColor ?? (isDark ? Colors.tealAccent[200] : primarySwatch[500]);
            accentColorBrightness = accentColorBrightness ?? estimateBrightnessForColor(accentColor);
            bool accentIsDark = accentColorBrightness == Brightness.dark;

            canvasColor             = canvasColor ?? (isDark ? Colors.grey[850] : Colors.grey[50]);
            scaffoldBackgroundColor = scaffoldBackgroundColor ?? canvasColor;
            bottomAppBarColor       = bottomAppBarColor ?? (isDark ? Colors.grey[800] : Colors.white);
            cardColor    = cardColor ?? (isDark ? Colors.grey[800] : Colors.white);
            dividerColor = dividerColor ?? (isDark ? new Color(0x1FFFFFFF) : new Color(0x1F000000));

            colorScheme = colorScheme ?? ColorScheme.fromSwatch(
                primarySwatch: primarySwatch,
                primaryColorDark: primaryColorDark,
                accentColor: accentColor,
                cardColor: cardColor,
                backgroundColor: backgroundColor,
                errorColor: errorColor,
                brightness: brightness);

            splashFactory            = splashFactory ?? InkSplash.splashFactory;
            selectedRowColor         = selectedRowColor ?? Colors.grey[100];
            unselectedWidgetColor    = unselectedWidgetColor ?? (isDark ? Colors.white70 : Colors.black54);
            secondaryHeaderColor     = secondaryHeaderColor ?? (isDark ? Colors.grey[700] : primarySwatch[50]);
            textSelectionColor       = textSelectionColor ?? (isDark ? accentColor : primarySwatch[200]);
            cursorColor              = cursorColor ?? Color.fromRGBO(66, 133, 244, 1.0f);
            textSelectionHandleColor =
                textSelectionHandleColor ?? (isDark ? Colors.tealAccent[400] : primarySwatch[300]);

            backgroundColor       = backgroundColor ?? (isDark ? Colors.grey[700] : primarySwatch[200]);
            dialogBackgroundColor = dialogBackgroundColor ?? (isDark ? Colors.grey[800] : Colors.white);
            indicatorColor        = indicatorColor ?? (accentColor == primaryColor ? Colors.white : accentColor);
            hintColor             = hintColor ?? (isDark ? new Color(0x80FFFFFF) : new Color(0x8A000000));
            errorColor            = errorColor ?? Colors.red[700];

            pageTransitionsTheme = pageTransitionsTheme ?? new PageTransitionsTheme();
            primaryIconTheme     = primaryIconTheme ??
                                   (primaryIsDark
                                   ? new IconThemeData(color: Colors.white)
                                   : new IconThemeData(color: Colors.black));
            accentIconTheme = accentIconTheme ??
                              (accentIsDark
                                  ? new IconThemeData(color: Colors.white)
                                  : new IconThemeData(color: Colors.black));
            iconTheme = iconTheme ??
                        (isDark ? new IconThemeData(color: Colors.white) : new IconThemeData(color: Colors.black87));

            typography = typography ?? new Typography();
            TextTheme defaultTextTheme = isDark ? typography.white : typography.black;

            textTheme = defaultTextTheme.merge(textTheme);
            TextTheme defaultPrimaryTextTheme = primaryIsDark ? typography.white : typography.black;

            primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme);
            TextTheme defaultAccentTextTheme = accentIsDark ? typography.white : typography.black;

            accentTextTheme       = defaultAccentTextTheme.merge(accentTextTheme);
            materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;
            if (fontFamily != null)
            {
                textTheme        = textTheme.apply(fontFamily: fontFamily);
                primaryTextTheme = primaryTextTheme.apply(fontFamily: fontFamily);
                accentTextTheme  = accentTextTheme.apply(fontFamily: fontFamily);
            }

            buttonColor = buttonColor ?? (isDark ? primarySwatch[600] : Colors.grey[300]);
            buttonTheme = buttonTheme ?? new ButtonThemeData(
                colorScheme: colorScheme,
                buttonColor: buttonColor,
                disabledColor: disabledColor,
                highlightColor: highlightColor,
                splashColor: splashColor,
                materialTapTargetSize: materialTapTargetSize);
            disabledColor  = disabledColor ?? (isDark ? Colors.white30 : Colors.black38);
            highlightColor = highlightColor ??
                             (isDark
                                 ? ThemeDataUtils._kDarkThemeHighlightColor
                                 : ThemeDataUtils._kLightThemeHighlightColor);
            splashColor = splashColor ??
                          (isDark
                              ? ThemeDataUtils._kDarkThemeSplashColor
                              : ThemeDataUtils._kLightThemeSplashColor);

            D.assert(brightness != null);
            D.assert(primaryColor != null);
            D.assert(primaryColorBrightness != null);
            D.assert(primaryColorLight != null);
            D.assert(primaryColorDark != null);
            D.assert(accentColor != null);
            D.assert(accentColorBrightness != null);
            D.assert(canvasColor != null);
            D.assert(scaffoldBackgroundColor != null);
            D.assert(bottomAppBarColor != null);
            D.assert(cardColor != null);
            D.assert(dividerColor != null);
            D.assert(highlightColor != null);
            D.assert(splashColor != null);
            D.assert(splashFactory != null);
            D.assert(selectedRowColor != null);
            D.assert(unselectedWidgetColor != null);
            D.assert(disabledColor != null);
            D.assert(toggleableActiveColor != null);
            D.assert(buttonTheme != null);
            D.assert(secondaryHeaderColor != null);
            D.assert(textSelectionColor != null);
            D.assert(cursorColor != null);
            D.assert(textSelectionHandleColor != null);
            D.assert(backgroundColor != null);
            D.assert(dialogBackgroundColor != null);
            D.assert(indicatorColor != null);
            D.assert(hintColor != null);
            D.assert(errorColor != null);
            D.assert(textTheme != null);
            D.assert(primaryTextTheme != null);
            D.assert(accentTextTheme != null);
            D.assert(iconTheme != null);
            D.assert(primaryIconTheme != null);
            D.assert(accentIconTheme != null);
            D.assert(materialTapTargetSize != null);
            D.assert(pageTransitionsTheme != null);
            D.assert(colorScheme != null);
            D.assert(typography != null);

            D.assert(buttonColor != null);

            this.brightness              = brightness ?? Brightness.light;
            this.primaryColor            = primaryColor;
            this.primaryColorBrightness  = primaryColorBrightness ?? Brightness.light;
            this.primaryColorLight       = primaryColorLight;
            this.primaryColorDark        = primaryColorDark;
            this.canvasColor             = canvasColor;
            this.accentColor             = accentColor;
            this.accentColorBrightness   = accentColorBrightness ?? Brightness.light;
            this.scaffoldBackgroundColor = scaffoldBackgroundColor;
            this.bottomAppBarColor       = bottomAppBarColor;
            this.cardColor                = cardColor;
            this.dividerColor             = dividerColor;
            this.highlightColor           = highlightColor;
            this.splashColor              = splashColor;
            this.splashFactory            = splashFactory;
            this.selectedRowColor         = selectedRowColor;
            this.unselectedWidgetColor    = unselectedWidgetColor;
            this.disabledColor            = disabledColor;
            this.buttonTheme              = buttonTheme;
            this.buttonColor              = buttonColor;
            this.secondaryHeaderColor     = secondaryHeaderColor;
            this.textSelectionColor       = textSelectionColor;
            this.cursorColor              = cursorColor;
            this.textSelectionHandleColor = textSelectionHandleColor;
            this.backgroundColor          = backgroundColor;
            this.dialogBackgroundColor    = dialogBackgroundColor;
            this.indicatorColor           = indicatorColor;
            this.hintColor                = hintColor;
            this.errorColor               = errorColor;
            this.toggleableActiveColor    = toggleableActiveColor;
            this.textTheme                = textTheme;
            this.primaryTextTheme         = primaryTextTheme;
            this.accentTextTheme          = accentTextTheme;
            this.iconTheme                = iconTheme;
            this.primaryIconTheme         = primaryIconTheme;
            this.accentIconTheme          = accentIconTheme;
            this.materialTapTargetSize    = materialTapTargetSize ?? MaterialTapTargetSize.padded;
            this.pageTransitionsTheme     = pageTransitionsTheme;
            this.colorScheme              = colorScheme;
            this.typography               = typography;
        }