using System; using System.Collections.Generic; using Unity.UIWidgets.foundation; using Unity.UIWidgets.painting; using Unity.UIWidgets.rendering; using Unity.UIWidgets.service; using Unity.UIWidgets.ui; using Unity.UIWidgets.widgets; namespace Unity.UIWidgets.material { public class RaisedButton : MaterialButton { public RaisedButton( Key key = null, VoidCallback onPressed = null, ValueChanged onHighlightChanged = null, ButtonTextTheme? textTheme = null, Color textColor = null, Color disabledTextColor = null, Color color = null, Color disabledColor = null, Color highlightColor = null, Color splashColor = null, Brightness? colorBrightness = null, double? elevation = null, double? highlightElevation = null, double? disabledElevation = null, EdgeInsets padding = null, ShapeBorder shape = null, Clip? clipBehavior = Clip.none, MaterialTapTargetSize? materialTapTargetSize = null, TimeSpan? animationDuration = null, Widget child = null ) : base( key: key, onPressed: onPressed, onHighlightChanged: onHighlightChanged, textTheme: textTheme, textColor: textColor, disabledTextColor: disabledTextColor, color: color, disabledColor: disabledColor, highlightColor: highlightColor, splashColor: splashColor, colorBrightness: colorBrightness, elevation: elevation, highlightElevation: highlightElevation, disabledElevation: disabledElevation, padding: padding, shape: shape, clipBehavior: clipBehavior, materialTapTargetSize: materialTapTargetSize, animationDuration: animationDuration, child: child) { D.assert(elevation == null || elevation >= 0.0); D.assert(highlightElevation == null || highlightElevation >= 0.0); D.assert(disabledElevation == null || disabledElevation >= 0.0); } public static RaisedButton icon( Key key = null, VoidCallback onPressed = null, ValueChanged onHighlightChanged = null, ButtonTextTheme? textTheme = null, Color textColor = null, Color disabledTextColor = null, Color color = null, Color disabledColor = null, Color highlightColor = null, Color splashColor = null, Brightness? colorBrightness = null, double? elevation = null, double? highlightElevation = null, double? disabledElevation = null, EdgeInsets padding = null, ShapeBorder shape = null, Clip? clipBehavior = null, MaterialTapTargetSize? materialTapTargetSize = null, TimeSpan? animationDuration = null, Widget icon = null, Widget label = null) { D.assert(icon != null); D.assert(label != null); return new _RaisedButtonWithIcon( key: key, onPressed: onPressed, onHighlightChanged: onHighlightChanged, textTheme: textTheme, textColor: textColor, disabledTextColor: disabledTextColor, color: color, disabledColor: disabledColor, highlightColor: highlightColor, splashColor: splashColor, colorBrightness: colorBrightness, elevation: elevation, highlightElevation: highlightElevation, disabledElevation: disabledElevation, padding: padding, shape: shape, clipBehavior: clipBehavior, materialTapTargetSize: materialTapTargetSize, animationDuration: animationDuration, icon: icon, label: label); } 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 ); } public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { base.debugFillProperties(properties); properties.add(new ObjectFlagProperty("onPressed", this.onPressed, ifNull: "disabled")); properties.add(new DiagnosticsProperty("textTheme", this.textTheme, defaultValue: null)); properties.add(new DiagnosticsProperty("textColor", this.textColor, defaultValue: null)); properties.add(new DiagnosticsProperty("disabledTextColor", this.disabledTextColor, defaultValue: null)); properties.add(new DiagnosticsProperty("color", this.color, defaultValue: null)); properties.add(new DiagnosticsProperty("disabledColor", this.disabledColor, defaultValue: null)); properties.add(new DiagnosticsProperty("highlightColor", this.highlightColor, defaultValue: null)); properties.add(new DiagnosticsProperty("splashColor", this.splashColor, defaultValue: null)); properties.add(new DiagnosticsProperty("colorBrightness", this.colorBrightness, defaultValue: null)); properties.add(new DiagnosticsProperty("elevation", this.elevation, defaultValue: null)); properties.add(new DiagnosticsProperty("highlightElevation", this.highlightElevation, defaultValue: null)); properties.add(new DiagnosticsProperty("disabledElevation", this.disabledElevation, defaultValue: null)); properties.add(new DiagnosticsProperty("padding", this.padding, defaultValue: null)); properties.add(new DiagnosticsProperty("shape", this.shape, defaultValue: null)); properties.add(new DiagnosticsProperty("materialTapTargetSize", this.materialTapTargetSize, defaultValue: null)); } } class _RaisedButtonWithIcon : RaisedButton, MaterialButtonWithIconMixin { public _RaisedButtonWithIcon( Key key = null, VoidCallback onPressed = null, ValueChanged onHighlightChanged = null, ButtonTextTheme? textTheme = null, Color textColor = null, Color disabledTextColor = null, Color color = null, Color disabledColor = null, Color highlightColor = null, Color splashColor = null, Brightness? colorBrightness = null, double? elevation = null, double? highlightElevation = null, double? disabledElevation = null, EdgeInsets padding = null, ShapeBorder shape = null, Clip? clipBehavior = Clip.none, MaterialTapTargetSize? materialTapTargetSize = null, TimeSpan? animationDuration = null, Widget icon = null, Widget label = null ) : base( key: key, onPressed: onPressed, onHighlightChanged: onHighlightChanged, textTheme: textTheme, textColor: textColor, disabledTextColor: disabledTextColor, color: color, disabledColor: disabledColor, highlightColor: highlightColor, splashColor: splashColor, colorBrightness: colorBrightness, elevation: elevation, highlightElevation: highlightElevation, disabledElevation: disabledElevation, padding: padding, shape: shape, clipBehavior: clipBehavior, materialTapTargetSize: materialTapTargetSize, animationDuration: animationDuration, child: new Row( mainAxisSize: MainAxisSize.min, children: new List { icon, new SizedBox(width: 8.0), label } )) { D.assert(elevation == null || elevation >= 0.0); D.assert(highlightElevation == null || highlightElevation >= 0.0); D.assert(disabledElevation == null || disabledElevation >= 0.0); D.assert(icon != null); D.assert(label != null); } } }