Ejemplo n.º 1
0
        public override Widget build(BuildContext context)
        {
            ThemeData       theme       = Theme.of(context);
            ButtonThemeData buttonTheme = ButtonTheme.of(context);

            return(new RawMaterialButton(
                       onPressed: onPressed,
                       onLongPress: () => onLongPress?.Invoke(),
                       onHighlightChanged: onHighlightChanged,
                       fillColor: buttonTheme.getFillColor(this),
                       textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
                       focusColor: buttonTheme.getFocusColor(this),
                       hoverColor: buttonTheme.getHoverColor(this),
                       highlightColor: buttonTheme.getHighlightColor(this),
                       splashColor: buttonTheme.getSplashColor(this),
                       elevation: buttonTheme.getElevation(this),
                       focusElevation: buttonTheme.getFocusElevation(this),
                       hoverElevation: buttonTheme.getHoverElevation(this),
                       highlightElevation: buttonTheme.getHighlightElevation(this),
                       disabledElevation: buttonTheme.getDisabledElevation(this),
                       padding: buttonTheme.getPadding(this),
                       visualDensity: visualDensity ?? theme.visualDensity,
                       constraints: buttonTheme.getConstraints(this),
                       shape: buttonTheme.getShape(this),
                       clipBehavior: clipBehavior ?? Clip.none,
                       focusNode: focusNode,
                       autofocus: autofocus ?? false,
                       materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
                       animationDuration: buttonTheme.getAnimationDuration(this),
                       child: child
                       ));
        }
Ejemplo n.º 2
0
 public static ButtonTheme fromButtonThemeData(
     Key key = null,
     ButtonThemeData data = null,
     Widget child         = null)
 {
     return(new ButtonTheme(key, data, child));
 }
Ejemplo n.º 3
0
        public override Widget build(BuildContext context)
        {
            ButtonThemeData buttonTheme = ButtonTheme.of(context);

            return(new _OutlineButton(
                       onPressed: onPressed,
                       onLongPress: onLongPress,
                       brightness: buttonTheme.getBrightness(this),
                       textTheme: textTheme,
                       textColor: buttonTheme.getTextColor(this),
                       disabledTextColor: buttonTheme.getDisabledTextColor(this),
                       color: color,
                       focusColor: buttonTheme.getFocusColor(this),
                       hoverColor: buttonTheme.getHoverColor(this),
                       highlightColor: buttonTheme.getHighlightColor(this),
                       splashColor: buttonTheme.getSplashColor(this),
                       highlightElevation: buttonTheme.getHighlightElevation(this),
                       borderSide: borderSide,
                       disabledBorderColor: disabledBorderColor,
                       highlightedBorderColor: highlightedBorderColor ?? buttonTheme.colorScheme.primary,
                       padding: buttonTheme.getPadding(this),
                       visualDensity: visualDensity,
                       shape: buttonTheme.getShape(this),
                       clipBehavior: clipBehavior,
                       focusNode: focusNode,
                       child: child
                       ));
        }
Ejemplo n.º 4
0
        public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
        {
            base.debugFillProperties(properties);
            ButtonThemeData defaultTheme = new ButtonThemeData();

            properties.add(new EnumProperty <ButtonTextTheme>("textTheme", this.textTheme,
                                                              defaultValue: defaultTheme.textTheme));
            properties.add(new DoubleProperty("minWidth", this.minWidth, defaultValue: defaultTheme.minWidth));
            properties.add(new DoubleProperty("height", this.height, defaultValue: defaultTheme.height));
            properties.add(new DiagnosticsProperty <EdgeInsets>("padding", this.padding,
                                                                defaultValue: defaultTheme.padding));
            properties.add(new DiagnosticsProperty <ShapeBorder>("shape", this.shape, defaultValue: defaultTheme.shape));
            properties.add(new FlagProperty("alignedDropdown",
                                            value: this.alignedDropdown,
                                            defaultValue: defaultTheme.alignedDropdown,
                                            ifTrue: "dropdown width matches button"
                                            ));
            properties.add(new DiagnosticsProperty <Color>("buttonColor", this._buttonColor, defaultValue: null));
            properties.add(new DiagnosticsProperty <Color>("disabledColor", this._disabledColor, defaultValue: null));
            properties.add(new DiagnosticsProperty <Color>("highlightColor", this._highlightColor, defaultValue: null));
            properties.add(new DiagnosticsProperty <Color>("splashColor", this._splashColor, defaultValue: null));
            properties.add(new DiagnosticsProperty <ColorScheme>("colorScheme", this.colorScheme,
                                                                 defaultValue: defaultTheme.colorScheme));
            properties.add(new DiagnosticsProperty <MaterialTapTargetSize?>("materialTapTargetSize",
                                                                            this._materialTapTargetSize, defaultValue: null));
        }
Ejemplo n.º 5
0
        public bool Equals(ButtonThemeData other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(this.textTheme == other.textTheme &&
                   this.minWidth == other.minWidth &&
                   this.height == other.height &&
                   this.padding == other.padding &&
                   this.shape == other.shape &&
                   this.alignedDropdown == other.alignedDropdown &&
                   this._buttonColor == other._buttonColor &&
                   this._disabledColor == other._disabledColor &&
                   this._highlightColor == other._highlightColor &&
                   this._splashColor == other._splashColor &&
                   this.colorScheme == other.colorScheme &&
                   this._materialTapTargetSize == other._materialTapTargetSize);
        }
Ejemplo n.º 6
0
 public ButtonTheme(
     Key key = null,
     ButtonThemeData data = null,
     Widget child         = null) : base(key: key, child: child)
 {
     D.assert(data != null);
     this.data = data;
 }
Ejemplo n.º 7
0
        public override Widget build(BuildContext context)
        {
            ButtonThemeData    parentButtonTheme = ButtonTheme.of(context);
            ButtonBarThemeData barTheme          = ButtonBarTheme.of(context);

            ButtonThemeData buttonTheme = parentButtonTheme.copyWith(
                textTheme: buttonTextTheme ?? barTheme?.buttonTextTheme ?? ButtonTextTheme.primary,
                minWidth: buttonMinWidth ?? barTheme?.buttonMinWidth ?? 64.0f,
                height: buttonHeight ?? barTheme?.buttonHeight ?? 36.0f,
                padding: buttonPadding ?? barTheme?.buttonPadding ?? EdgeInsets.symmetric(horizontal: 8.0f),
                alignedDropdown: buttonAlignedDropdown ?? barTheme?.buttonAlignedDropdown ?? false,
                layoutBehavior: layoutBehavior ?? barTheme?.layoutBehavior ?? ButtonBarLayoutBehavior.padded
                );

            float  paddingUnit = buttonTheme.padding.horizontal / 4.0f;
            Widget child       = ButtonTheme.fromButtonThemeData(
                data: buttonTheme,
                child: new _ButtonBarRow(
                    mainAxisAlignment: alignment ?? barTheme?.alignment ?? MainAxisAlignment.end,
                    mainAxisSize: mainAxisSize ?? barTheme?.mainAxisSize ?? MainAxisSize.max,
                    overflowDirection: overflowDirection ?? barTheme?.overflowDirection ?? VerticalDirection.down,
                    children: LinqUtils <Widget> .SelectList(children, ((Widget childWidget) => {
                return((Widget) new Padding(
                           padding: EdgeInsets.symmetric(horizontal: paddingUnit),
                           child: childWidget
                           ));
            })),
                    overflowButtonSpacing: overflowButtonSpacing
                    )
                );

            switch (buttonTheme.layoutBehavior)
            {
            case ButtonBarLayoutBehavior.padded:
                return(new Padding(
                           padding: EdgeInsets.symmetric(
                               vertical: 2.0f * paddingUnit,
                               horizontal: paddingUnit
                               ),
                           child: child
                           ));

            case ButtonBarLayoutBehavior.constrained:
                return(new Container(
                           padding: EdgeInsets.symmetric(horizontal: paddingUnit),
                           constraints: new BoxConstraints(minHeight: 52.0f),
                           alignment: Alignment.center,
                           child: child
                           ));
            }

            D.assert(false);
            return(null);
        }
Ejemplo n.º 8
0
        public override Widget build(BuildContext context)
        {
            ButtonThemeData buttonTheme = ButtonTheme.of(context);
            double          paddingUnit = buttonTheme.padding.horizontal / 4.0;
            List <Widget>   _children   = new List <Widget>();

            foreach (Widget _child in this.children)
            {
                _children.Add(
                    new Padding(
                        padding: EdgeInsets.symmetric(horizontal: paddingUnit),
                        child: _child
                        )
                    );
            }

            Widget child = new Row(
                mainAxisAlignment: this.alignment,
                mainAxisSize: this.mainAxisSize,
                children: _children
                );

            switch (buttonTheme.layoutBehavior)
            {
            case ButtonBarLayoutBehavior.padded:
                return(new Padding(
                           padding: EdgeInsets.symmetric(
                               vertical: 2.0 * paddingUnit,
                               horizontal: paddingUnit
                               ),
                           child: child
                           ));

            case ButtonBarLayoutBehavior.constrained:
                return(new Container(
                           padding: EdgeInsets.symmetric(horizontal: paddingUnit),
                           constraints: new BoxConstraints(minHeight: 52.0),
                           alignment: Alignment.center,
                           child: child
                           ));
            }

            D.assert(false);
            return(null);
        }
Ejemplo n.º 9
0
        public static ButtonThemeData of(BuildContext context)
        {
            ButtonTheme     inheritedButtonTheme = (ButtonTheme)context.dependOnInheritedWidgetOfExactType <ButtonTheme>();
            ButtonThemeData buttonTheme          = inheritedButtonTheme?.data;

            if (buttonTheme?.colorScheme == null)
            {
                ThemeData theme = Theme.of(context);
                buttonTheme = buttonTheme ?? theme.buttonTheme;
                if (buttonTheme.colorScheme == null)
                {
                    buttonTheme = buttonTheme.copyWith(
                        colorScheme: theme.buttonTheme.colorScheme ?? theme.colorScheme);
                    D.assert(buttonTheme.colorScheme != null);
                }
            }

            return(buttonTheme);
        }
Ejemplo n.º 10
0
 public ButtonTheme(
     Key key = null,
     ButtonTextTheme textTheme = ButtonTextTheme.normal,
     ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded,
     float minWidth             = 88.0f,
     float height               = 36.0f,
     EdgeInsetsGeometry padding = null,
     ShapeBorder shape          = null,
     bool alignedDropdown       = false,
     Color buttonColor          = null,
     Color disabledColor        = null,
     Color focusColor           = null,
     Color hoverColor           = null,
     Color highlightColor       = null,
     Color splashColor          = null,
     ColorScheme colorScheme    = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     Widget child = null) : base(key: key, child: child)
 {
     D.assert(minWidth >= 0.0);
     D.assert(height >= 0.0);
     data = new ButtonThemeData(
         textTheme: textTheme,
         minWidth: minWidth,
         height: height,
         padding: padding,
         shape: shape,
         alignedDropdown: alignedDropdown,
         layoutBehavior: layoutBehavior,
         buttonColor: buttonColor,
         disabledColor: disabledColor,
         focusColor: focusColor,
         hoverColor: hoverColor,
         highlightColor: highlightColor,
         splashColor: splashColor,
         colorScheme: colorScheme,
         materialTapTargetSize: materialTapTargetSize);
 }
Ejemplo n.º 11
0
        public override Widget build(BuildContext context)
        {
            ButtonThemeData buttonTheme = ButtonTheme.of(context);

            return(new _OutlineButton(
                       onPressed: this.onPressed,
                       brightness: buttonTheme.getBrightness(this),
                       textTheme: this.textTheme,
                       textColor: buttonTheme.getTextColor(this),
                       disabledTextColor: buttonTheme.getDisabledTextColor(this),
                       color: this.color,
                       highlightColor: buttonTheme.getHighlightColor(this),
                       splashColor: buttonTheme.getSplashColor(this),
                       highlightElevation: buttonTheme.getHighlightElevation(this),
                       borderSide: this.borderSide,
                       disabledBorderColor: this.disabledBorderColor,
                       highlightedBorderColor: this.highlightedBorderColor ?? buttonTheme.colorScheme.primary,
                       padding: buttonTheme.getPadding(this),
                       shape: buttonTheme.getShape(this),
                       clipBehavior: this.clipBehavior,
                       child: this.child
                       ));
        }
Ejemplo n.º 12
0
        public override Widget build(BuildContext context)
        {
            ThemeData       theme       = Theme.of(context);
            ButtonThemeData buttonTheme = ButtonTheme.of(context);

            return(new RawMaterialButton(
                       onPressed: this.onPressed,
                       fillColor: this.color,
                       textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
                       highlightColor: this.highlightColor ?? theme.highlightColor,
                       splashColor: this.splashColor ?? theme.splashColor,
                       elevation: buttonTheme.getElevation(this),
                       highlightElevation: buttonTheme.getHighlightElevation(this),
                       padding: buttonTheme.getPadding(this),
                       constraints: buttonTheme.getConstraints(this).copyWith(
                           minWidth: this.minWidth,
                           minHeight: this.height),
                       shape: buttonTheme.shape,
                       clipBehavior: this.clipBehavior ?? Clip.none,
                       animationDuration: buttonTheme.getAnimationDuration(this),
                       child: this.child,
                       materialTapTargetSize: this.materialTapTargetSize ?? theme.materialTapTargetSize));
        }
Ejemplo n.º 13
0
        public override Widget build(BuildContext context)
        {
            ThemeData       theme       = Theme.of(context);
            ButtonThemeData buttonTheme = ButtonTheme.of(context);

            return(new RawMaterialButton(
                       onPressed: this.onPressed,
                       onHighlightChanged: this.onHighlightChanged,
                       clipBehavior: this.clipBehavior ?? Clip.none,
                       fillColor: buttonTheme.getFillColor(this),
                       textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
                       highlightColor: buttonTheme.getHighlightColor(this),
                       splashColor: buttonTheme.getSplashColor(this),
                       elevation: buttonTheme.getElevation(this),
                       highlightElevation: buttonTheme.getHighlightElevation(this),
                       disabledElevation: buttonTheme.getDisabledElevation(this),
                       padding: buttonTheme.getPadding(this),
                       constraints: buttonTheme.getConstraints(this),
                       shape: buttonTheme.getShape(this),
                       animationDuration: buttonTheme.getAnimationDuration(this),
                       materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
                       child: this.child
                       ));
        }
Ejemplo n.º 14
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.º 15
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.º 16
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;
        }