public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); Color foregroundColor = this.foregroundColor ?? theme.accentIconTheme.color; Widget result = null; if (this.child != null) { result = IconTheme.merge( data: new IconThemeData( color: foregroundColor), child: this.child ); } result = new RawMaterialButton( onPressed: this.onPressed, elevation: this.elevation, highlightElevation: this.highlightElevation, disabledElevation: this.disabledElevation ?? this.elevation, constraints: this._sizeConstraints, materialTapTargetSize: this.materialTapTargetSize ?? theme.materialTapTargetSize, fillColor: this.backgroundColor ?? theme.accentColor, textStyle: theme.accentTextTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2f), shape: this.shape, clipBehavior: this.clipBehavior, child: result); if (this.tooltip != null) { result = new Tooltip( message: this.tooltip, child: result); } if (this.heroTag != null) { result = new Hero( tag: this.heroTag, child: result); } return(result); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); Color foregroundColor = this.widget.foregroundColor ?? theme.accentIconTheme.color; Widget result = null; if (this.widget.child != null) { result = IconTheme.merge( data: new IconThemeData( color: foregroundColor), child: this.widget.child ); } result = new RawMaterialButton( onPressed: this.widget.onPressed, onHighlightChanged: this._handleHighlightChanged, elevation: this._highlight ? this.widget.highlightElevation : this.widget.elevation, constraints: this.widget._sizeConstraints, materialTapTargetSize: this.widget.materialTapTargetSize ?? theme.materialTapTargetSize, fillColor: this.widget.backgroundColor ?? theme.accentColor, textStyle: theme.accentTextTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2f), shape: this.widget.shape, clipBehavior: this.widget.clipBehavior, child: result); if (this.widget.tooltip != null) { result = new Tooltip( message: this.widget.tooltip, child: result); } //todo: xingwei.zhu: Hero widget // if (this.widget.heroTag != null) { // result = new Hero( // tag: this.widget.heroTag, // child: result); // } return(result); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); FloatingActionButtonThemeData floatingActionButtonTheme = theme.floatingActionButtonTheme; if (this.foregroundColor == null && floatingActionButtonTheme.foregroundColor == null) { bool accentIsDark = theme.accentColorBrightness == Brightness.dark; Color defaultAccentIconThemeColor = accentIsDark ? Colors.white : Colors.black; if (theme.accentIconTheme.color != defaultAccentIconThemeColor) { Debug.Log( "Warning: " + "The support for configuring the foreground color of " + "FloatingActionButtons using ThemeData.accentIconTheme " + "has been deprecated. Please use ThemeData.floatingActionButtonTheme " + "instead. " ); } } Color foregroundColor = this.foregroundColor ?? floatingActionButtonTheme.foregroundColor ?? theme.colorScheme.onSecondary; Color backgroundColor = this.backgroundColor ?? floatingActionButtonTheme.backgroundColor ?? theme.colorScheme.secondary; float elevation = this.elevation ?? floatingActionButtonTheme.elevation ?? _defaultElevation; Color focusColor = this.focusColor ?? floatingActionButtonTheme.focusColor ?? theme.focusColor; Color hoverColor = this.hoverColor ?? floatingActionButtonTheme.hoverColor ?? theme.hoverColor; Color splashColor = this.splashColor ?? floatingActionButtonTheme.splashColor ?? theme.splashColor; float disabledElevation = this.disabledElevation ?? floatingActionButtonTheme.disabledElevation ?? elevation; float focusElevation = this.focusElevation ?? floatingActionButtonTheme.focusElevation ?? _defaultFocusElevation; float hoverElevation = this.hoverElevation ?? floatingActionButtonTheme.hoverElevation ?? _defaultHoverElevation; float highlightElevation = this.highlightElevation ?? floatingActionButtonTheme.highlightElevation ?? _defaultHighlightElevation; MaterialTapTargetSize materialTapTargetSize = this.materialTapTargetSize ?? theme.materialTapTargetSize; TextStyle textStyle = theme.textTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2f ); ShapeBorder shape = this.shape ?? floatingActionButtonTheme.shape ?? (isExtended ? _defaultExtendedShape : _defaultShape); Widget result = new RawMaterialButton( onPressed: onPressed, elevation: elevation, focusElevation: focusElevation, hoverElevation: hoverElevation, highlightElevation: highlightElevation, disabledElevation: disabledElevation, constraints: _sizeConstraints, materialTapTargetSize: materialTapTargetSize, fillColor: backgroundColor, focusColor: focusColor, hoverColor: hoverColor, splashColor: splashColor, textStyle: textStyle, shape: shape, clipBehavior: clipBehavior, focusNode: focusNode, autofocus: autofocus, child: child ); if (tooltip != null) { result = new Tooltip( message: tooltip, child: result ); } if (heroTag != null) { result = new Hero( tag: heroTag, child: result ); } return(result); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); FloatingActionButtonThemeData floatingActionButtonTheme = theme.floatingActionButtonTheme; Color backgroundColor = this.backgroundColor ?? floatingActionButtonTheme.backgroundColor ?? theme.colorScheme.secondary; Color foregroundColor = this.foregroundColor ?? floatingActionButtonTheme.foregroundColor ?? theme.accentIconTheme.color ?? theme.colorScheme.onSecondary; float elevation = this.elevation ?? floatingActionButtonTheme.elevation ?? _defaultElevation; float disabledElevation = this.disabledElevation ?? floatingActionButtonTheme.disabledElevation ?? elevation; float highlightElevation = this.highlightElevation ?? floatingActionButtonTheme.highlightElevation ?? _defaultHighlightElevation; MaterialTapTargetSize materialTapTargetSize = this.materialTapTargetSize ?? theme.materialTapTargetSize; TextStyle textStyle = theme.accentTextTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2f ); ShapeBorder shape = this.shape ?? floatingActionButtonTheme.shape ?? (this.isExtended ? this._defaultExtendedShape : this._defaultShape); Widget result = null; if (this.child != null) { result = IconTheme.merge( data: new IconThemeData( color: foregroundColor), child: this.child ); } result = new RawMaterialButton( onPressed: this.onPressed, elevation: elevation, highlightElevation: highlightElevation, disabledElevation: disabledElevation, constraints: this._sizeConstraints, materialTapTargetSize: materialTapTargetSize, fillColor: backgroundColor, textStyle: textStyle, shape: shape, clipBehavior: this.clipBehavior, child: result); if (this.tooltip != null) { result = new Tooltip( message: this.tooltip, child: result); } if (this.heroTag != null) { result = new Hero( tag: this.heroTag, child: result); } return(result); }