public override Widget build(BuildContext context) { ThemeData theme = this.widget.theme ?? ThemeData.fallback(); Widget result = new AnimatedTheme( data: theme, isMaterialAppTheme: true, child: new WidgetsApp( key: new GlobalObjectKey <State>(this), navigatorKey: this.widget.navigatorKey, navigatorObservers: this._navigatorObservers, pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => new MaterialPageRoute(settings: settings, builder: builder), home: this.widget.home, routes: this.widget.routes, initialRoute: this.widget.initialRoute, onGenerateRoute: this.widget.onGenerateRoute, onUnknownRoute: this.widget.onUnknownRoute, builder: this.widget.builder, textStyle: AppUtils._errorTextStyle, locale: this.widget.locale, localizationsDelegates: this._localizationsDelegates, localeResolutionCallback: this.widget.localeResolutionCallback, localeListResolutionCallback: this.widget.localeListResolutionCallback, supportedLocales: this.widget.supportedLocales, showPerformanceOverlay: this.widget.showPerformanceOverlay ) ); return(result); }
Color _textColor(ThemeData theme, ListTileTheme tileTheme, Color defaultColor) { if (!this.enabled) { return(theme.disabledColor); } if (this.selected && tileTheme?.selectedColor != null) { return(tileTheme.selectedColor); } if (!this.selected && tileTheme?.textColor != null) { return(tileTheme.textColor); } if (this.selected) { switch (theme.brightness) { case Brightness.light: return(theme.primaryColor); case Brightness.dark: return(theme.accentColor); } } return(defaultColor); }
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, clipBehavior: clipBehavior.Value, 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), focusNode: focusNode, autofocus: autofocus.Value, animationDuration: buttonTheme.getAnimationDuration(this), materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this), child: child )); }
TextStyle _titleTextStyle(ThemeData theme, ListTileTheme tileTheme) { TextStyle style = null; if (tileTheme != null) { switch (tileTheme.style) { case ListTileStyle.drawer: style = theme.textTheme.body2; break; case ListTileStyle.list: style = theme.textTheme.subhead; break; } } else { style = theme.textTheme.subhead; } Color color = this._textColor(theme, tileTheme, style.color); return(this._isDenseLayout(tileTheme) ? style.copyWith(fontSize: 13.0f, color: color) : style.copyWith(color: color)); }
Color _iconColor(ThemeData theme, ListTileTheme tileTheme) { if (!this.enabled) { return(theme.disabledColor); } if (this.selected && tileTheme?.selectedColor != null) { return(tileTheme.selectedColor); } if (!this.selected && tileTheme?.iconColor != null) { return(tileTheme.iconColor); } switch (theme.brightness) { case Brightness.light: return(this.selected ? theme.primaryColor : Colors.black45); case Brightness.dark: return(this.selected ? theme.accentColor : null); } return(null); }
public override Widget build(BuildContext context) { D.assert(material_.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasMediaQuery(context)); ThemeData theme = Theme.of(context); SliderThemeData sliderTheme = SliderTheme.of(context); sliderTheme = sliderTheme.copyWith( trackHeight: sliderTheme.trackHeight ?? _defaultTrackHeight, activeTrackColor: widget.activeColor ?? sliderTheme.activeTrackColor ?? theme.colorScheme.primary, inactiveTrackColor: widget.inactiveColor ?? sliderTheme.inactiveTrackColor ?? theme.colorScheme.primary.withOpacity(0.24f), disabledActiveTrackColor: sliderTheme.disabledActiveTrackColor ?? theme.colorScheme.onSurface.withOpacity(0.32f), disabledInactiveTrackColor: sliderTheme.disabledInactiveTrackColor ?? theme.colorScheme.onSurface.withOpacity(0.12f), activeTickMarkColor: widget.inactiveColor ?? sliderTheme.activeTickMarkColor ?? theme.colorScheme.onPrimary.withOpacity(0.54f), inactiveTickMarkColor: widget.activeColor ?? sliderTheme.inactiveTickMarkColor ?? theme.colorScheme.primary.withOpacity(0.54f), disabledActiveTickMarkColor: sliderTheme.disabledActiveTickMarkColor ?? theme.colorScheme.onPrimary.withOpacity(0.12f), disabledInactiveTickMarkColor: sliderTheme.disabledInactiveTickMarkColor ?? theme.colorScheme.onSurface.withOpacity(0.12f), thumbColor: widget.activeColor ?? sliderTheme.thumbColor ?? theme.colorScheme.primary, overlappingShapeStrokeColor: sliderTheme.overlappingShapeStrokeColor ?? theme.colorScheme.surface, disabledThumbColor: sliderTheme.disabledThumbColor ?? theme.colorScheme.onSurface.withOpacity(0.38f), overlayColor: widget.activeColor?.withOpacity(0.12f) ?? sliderTheme.overlayColor ?? theme.colorScheme.primary.withOpacity(0.12f), valueIndicatorColor: widget.activeColor ?? sliderTheme.valueIndicatorColor ?? theme.colorScheme.primary, rangeTrackShape: sliderTheme.rangeTrackShape ?? _defaultTrackShape, rangeTickMarkShape: sliderTheme.rangeTickMarkShape ?? _defaultTickMarkShape, rangeThumbShape: sliderTheme.rangeThumbShape ?? _defaultThumbShape, overlayShape: sliderTheme.overlayShape ?? _defaultOverlayShape, rangeValueIndicatorShape: sliderTheme.rangeValueIndicatorShape ?? _defaultValueIndicatorShape, showValueIndicator: sliderTheme.showValueIndicator ?? _defaultShowValueIndicator, valueIndicatorTextStyle: sliderTheme.valueIndicatorTextStyle ?? theme.textTheme.bodyText1.copyWith( color: theme.colorScheme.onPrimary ), minThumbSeparation: sliderTheme.minThumbSeparation ?? _defaultMinThumbSeparation, thumbSelector: sliderTheme.thumbSelector ?? _defaultRangeThumbSelector ); return(new _RangeSliderRenderObjectWidget( values: _unlerpRangeValues(widget.values), divisions: widget.divisions, labels: widget.labels, sliderTheme: sliderTheme, textScaleFactor: MediaQuery.of(context).textScaleFactor, onChanged: (widget.onChanged != null) && (widget.max > widget.min) ? _handleChanged : (ValueChanged <RangeValues>)null, onChangeStart: widget.onChangeStart != null ? _handleDragStart : (ValueChanged <RangeValues>)null, onChangeEnd: widget.onChangeEnd != null ? _handleDragEnd : (ValueChanged <RangeValues>)null, state: this )); }
public static Color overlayColor(BuildContext context, float elevation) { ThemeData theme = Theme.of(context); float opacity = (4.5f * Mathf.Log(elevation + 1) + 2) / 100.0f; return(theme.colorScheme.onSurface.withOpacity(opacity)); }
public _RenderSlider( float?value = null, int?divisions = null, string label = null, SliderThemeData sliderTheme = null, ThemeData theme = null, MediaQueryData mediaQueryData = null, RuntimePlatform?platform = null, ValueChanged <float> onChanged = null, ValueChanged <float> onChangeStart = null, ValueChanged <float> onChangeEnd = null, _SliderState state = null ) { D.assert(value != null && value >= 0.0 && value <= 1.0); D.assert(state != null); this.onChangeStart = onChangeStart; this.onChangeEnd = onChangeEnd; this._platform = platform; this._label = label; this._value = value.Value; this._divisions = divisions; this._sliderTheme = sliderTheme; this._theme = theme; this._mediaQueryData = mediaQueryData; this._onChanged = onChanged; this._state = state; this._updateLabelPainter(); GestureArenaTeam team = new GestureArenaTeam(); this._drag = new HorizontalDragGestureRecognizer { team = team, onStart = this._handleDragStart, onUpdate = this._handleDragUpdate, onEnd = this._handleDragEnd, onCancel = this._endInteraction }; this._tap = new TapGestureRecognizer { team = team, onTapDown = this._handleTapDown, onTapUp = this._handleTapUp, onTapCancel = this._endInteraction }; this._overlayAnimation = new CurvedAnimation( parent: this._state.overlayController, curve: Curves.fastOutSlowIn); this._valueIndicatorAnimation = new CurvedAnimation( parent: this._state.valueIndicatorController, curve: Curves.fastOutSlowIn); this._enableAnimation = new CurvedAnimation( parent: this._state.enableController, curve: Curves.easeInOut); }
public override Widget build(BuildContext context) { // D.assert(debugCheckHasMaterialLocalizations(context)); ThemeData theme = Theme.of(context); DialogTheme dialogTheme = DialogTheme.of(context); List <Widget> children = new List <Widget>(); if (this.title != null) { children.Add(new Padding( padding: this.titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, this.content == null ? 20.0f : 0.0f), child: new DefaultTextStyle( style: this.titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.title, child: this.title ) )); } if (this.content != null) { children.Add(new Flexible( child: new Padding( padding: this.contentPadding, child: new DefaultTextStyle( style: this.contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subhead, child: this.content ) ) )); } if (this.actions != null) { children.Add(ButtonTheme.bar( child: new ButtonBar( children: this.actions ) )); } Widget dialogChild = new IntrinsicWidth( child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: children ) ); return(new Dialog( backgroundColor: this.backgroundColor, elevation: this.elevation, shape: this.shape, child: dialogChild )); }
TextStyle _subtitleTextStyle(ThemeData theme, ListTileTheme tileTheme) { TextStyle style = theme.textTheme.body1; Color color = this._textColor(theme, tileTheme, theme.textTheme.caption.color); return(this._isDenseLayout(tileTheme) ? style.copyWith(color: color, fontSize: 12.0f) : style.copyWith(color: color)); }
public override Widget build(BuildContext context) { D.assert(Overlay.of(context, debugRequiredFor: widget) != null); ThemeData theme = Theme.of(context); TooltipThemeData tooltipTheme = TooltipTheme.of(context); TextStyle defaultTextStyle; BoxDecoration defaultDecoration; if (theme.brightness == Brightness.dark) { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.black ); defaultDecoration = new BoxDecoration( color: Colors.white.withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } else { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.white ); defaultDecoration = new BoxDecoration( color: Colors.grey[700].withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } height = widget.height ?? tooltipTheme?.height ?? _defaultTooltipHeight; padding = widget.padding ?? tooltipTheme?.padding ?? _defaultPadding; margin = widget.margin ?? tooltipTheme?.margin ?? _defaultMargin; verticalOffset = widget.verticalOffset ?? tooltipTheme?.verticalOffset ?? _defaultVerticalOffset; preferBelow = widget.preferBelow ?? tooltipTheme?.preferBelow ?? _defaultPreferBelow; excludeFromSemantics = widget.excludeFromSemantics ?? tooltipTheme?.excludeFromSemantics ?? _defaultExcludeFromSemantics; decoration = widget.decoration ?? tooltipTheme?.decoration ?? defaultDecoration; textStyle = widget.textStyle ?? tooltipTheme?.textStyle ?? defaultTextStyle; waitDuration = widget.waitDuration ?? tooltipTheme?.waitDuration ?? _defaultWaitDuration; showDuration = widget.showDuration ?? tooltipTheme?.showDuration ?? _defaultShowDuration; Widget result = new GestureDetector( behavior: HitTestBehavior.opaque, onLongPress: _handleLongPress, child: widget.child ); if (_mouseIsConnected) { result = new MouseRegion( onEnter: (PointerEnterEvent _event) => _showTooltip(), onExit: (PointerExitEvent _event) => _hideTooltip(), child: result ); } return(result); }
Widget _buildVerticalControls() { if (widget.controlsBuilder != null) { return(widget.controlsBuilder( context, onStepContinue: widget.onStepContinue, onStepCancel: widget.onStepCancel )); } Color cancelColor = null; switch (Theme.of(context).brightness) { case Brightness.light: cancelColor = Colors.black54; break; case Brightness.dark: cancelColor = Colors.white70; break; } D.assert(cancelColor != null); ThemeData themeData = Theme.of(context); MaterialLocalizations localizations = MaterialLocalizations.of(context); return(new Container( margin: EdgeInsets.only(top: 16.0f), child: new ConstrainedBox( constraints: BoxConstraints.tightFor(height: 48.0f), child: new Row( children: new List <Widget> { new FlatButton( onPressed: widget.onStepContinue, color: _isDark() ? themeData.backgroundColor : themeData.primaryColor, textColor: Colors.white, textTheme: ButtonTextTheme.normal, child: new Text(localizations.continueButtonLabel) ), new Container( margin: EdgeInsets.only(8.0f), child: new FlatButton( onPressed: widget.onStepCancel, textColor: cancelColor, textTheme: ButtonTextTheme.normal, child: new Text(localizations.cancelButtonLabel) ) ) } ) ) )); }
public override void didChangeDependencies() { base.didChangeDependencies(); ThemeData theme = Theme.of(this.context); this._themeColor = theme.highlightColor.withOpacity(1.0f); this._textDirection = Directionality.of(this.context); this._materialPainter = this._BuildMaterialScrollbarPainter(); }
public _ModalBottomSheetRoute( WidgetBuilder builder = null, ThemeData theme = null, string barrierLabel = null, RouteSettings settings = null ) : base(settings: settings) { this.builder = builder; this.theme = theme; this.barrierLabel = barrierLabel; }
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { base.debugFillProperties(properties); ThemeData defaultTheme = ThemeData.fallback(); SliderThemeData defaultData = fromPrimaryColors( primaryColor: defaultTheme.primaryColor, primaryColorDark: defaultTheme.primaryColorDark, primaryColorLight: defaultTheme.primaryColorLight, valueIndicatorTextStyle: defaultTheme.accentTextTheme.body2 ); properties.add(new DiagnosticsProperty <Color>("activeTrackColor", this.activeTrackColor, defaultValue: defaultData.activeTrackColor)); properties.add(new DiagnosticsProperty <Color>("activeTrackColor", this.activeTrackColor, defaultValue: defaultData.activeTrackColor)); properties.add(new DiagnosticsProperty <Color>("inactiveTrackColor", this.inactiveTrackColor, defaultValue: defaultData.inactiveTrackColor)); properties.add(new DiagnosticsProperty <Color>("disabledActiveTrackColor", this.disabledActiveTrackColor, defaultValue: defaultData.disabledActiveTrackColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("disabledInactiveTrackColor", this.disabledInactiveTrackColor, defaultValue: defaultData.disabledInactiveTrackColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("activeTickMarkColor", this.activeTickMarkColor, defaultValue: defaultData.activeTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("inactiveTickMarkColor", this.inactiveTickMarkColor, defaultValue: defaultData.inactiveTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("disabledActiveTickMarkColor", this.disabledActiveTickMarkColor, defaultValue: defaultData.disabledActiveTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("disabledInactiveTickMarkColor", this.disabledInactiveTickMarkColor, defaultValue: defaultData.disabledInactiveTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("thumbColor", this.thumbColor, defaultValue: defaultData.thumbColor)); properties.add(new DiagnosticsProperty <Color>("disabledThumbColor", this.disabledThumbColor, defaultValue: defaultData.disabledThumbColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("overlayColor", this.overlayColor, defaultValue: defaultData.overlayColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <Color>("valueIndicatorColor", this.valueIndicatorColor, defaultValue: defaultData.valueIndicatorColor)); properties.add(new DiagnosticsProperty <SliderTrackShape>("trackShape", this.trackShape, defaultValue: defaultData.trackShape, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <SliderTickMarkShape>("tickMarkShape", this.tickMarkShape, defaultValue: defaultData.tickMarkShape, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <SliderComponentShape>("thumbShape", this.thumbShape, defaultValue: defaultData.thumbShape, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <SliderComponentShape>("overlayShape", this.overlayShape, defaultValue: defaultData.overlayShape, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty <SliderComponentShape>("valueIndicatorShape", this.valueIndicatorShape, defaultValue: defaultData.valueIndicatorShape, level: DiagnosticLevel.debug)); properties.add(new EnumProperty <ShowValueIndicator>("showValueIndicator", this.showValueIndicator, defaultValue: defaultData.showValueIndicator)); properties.add(new DiagnosticsProperty <TextStyle>("valueIndicatorTextStyle", this.valueIndicatorTextStyle, defaultValue: defaultData.valueIndicatorTextStyle)); }
public static ChipThemeData fromDefaults( Brightness?brightness = null, Color primaryColor = null, Color secondaryColor = null, TextStyle labelStyle = null ) { D.assert(primaryColor != null || brightness != null, "One of primaryColor or brightness must be specified"); D.assert(primaryColor == null || brightness == null, "Only one of primaryColor or brightness may be specified"); D.assert(secondaryColor != null); D.assert(labelStyle != null); if (primaryColor != null) { brightness = ThemeData.estimateBrightnessForColor(primaryColor); } const int backgroundAlpha = 0x1f; // 12% const int deleteIconAlpha = 0xde; // 87% const int disabledAlpha = 0x0c; // 38% * 12% = 5% const int selectAlpha = 0x3d; // 12% + 12% = 24% const int textLabelAlpha = 0xde; // 87% ShapeBorder shape = new StadiumBorder(); EdgeInsets labelPadding = EdgeInsets.symmetric(horizontal: 8.0f); EdgeInsets padding = EdgeInsets.all(4.0f); primaryColor = primaryColor ?? (brightness == Brightness.light ? Colors.black : Colors.white); Color backgroundColor = primaryColor.withAlpha(backgroundAlpha); Color deleteIconColor = primaryColor.withAlpha(deleteIconAlpha); Color disabledColor = primaryColor.withAlpha(disabledAlpha); Color selectedColor = primaryColor.withAlpha(selectAlpha); Color secondarySelectedColor = secondaryColor.withAlpha(selectAlpha); TextStyle secondaryLabelStyle = labelStyle.copyWith( color: secondaryColor.withAlpha(textLabelAlpha) ); labelStyle = labelStyle.copyWith(color: primaryColor.withAlpha(textLabelAlpha)); return(new ChipThemeData( backgroundColor: backgroundColor, deleteIconColor: deleteIconColor, disabledColor: disabledColor, selectedColor: selectedColor, secondarySelectedColor: secondarySelectedColor, labelPadding: labelPadding, padding: padding, shape: shape, labelStyle: labelStyle, secondaryLabelStyle: secondaryLabelStyle, brightness: brightness )); }
public override void didChangeDependencies() { ThemeData theme = Theme.of(this.context); this._borderColorTween.end = theme.dividerColor; this._headerColorTween.begin = theme.textTheme.subhead.color; this._headerColorTween.end = theme.accentColor; this._iconColorTween.begin = theme.unselectedWidgetColor; this._iconColorTween.end = theme.accentColor; this._backgroundColorTween.end = this.widget.backgroundColor; base.didChangeDependencies(); }
public bool Equals(ThemeData other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.brightness == this.brightness && other.primaryColor == this.primaryColor && other.primaryColorBrightness == this.primaryColorBrightness && other.primaryColorLight == this.primaryColorLight && other.primaryColorDark == this.primaryColorDark && other.accentColor == this.accentColor && other.accentColorBrightness == this.accentColorBrightness && other.canvasColor == this.canvasColor && other.scaffoldBackgroundColor == this.scaffoldBackgroundColor && other.bottomAppBarColor == this.bottomAppBarColor && other.cardColor == this.cardColor && other.dividerColor == this.dividerColor && other.highlightColor == this.highlightColor && other.splashColor == this.splashColor && other.splashFactory == this.splashFactory && other.selectedRowColor == this.selectedRowColor && other.unselectedWidgetColor == this.unselectedWidgetColor && other.disabledColor == this.disabledColor && other.buttonTheme == this.buttonTheme && other.buttonColor == this.buttonColor && other.secondaryHeaderColor == this.secondaryHeaderColor && other.textSelectionColor == this.textSelectionColor && other.cursorColor == this.cursorColor && other.textSelectionHandleColor == this.textSelectionHandleColor && other.backgroundColor == this.backgroundColor && other.dialogBackgroundColor == this.dialogBackgroundColor && other.indicatorColor == this.indicatorColor && other.hintColor == this.hintColor && other.errorColor == this.errorColor && other.textTheme == this.textTheme && other.primaryTextTheme == this.primaryTextTheme && other.accentTextTheme == this.accentTextTheme && other.toggleableActiveColor == this.toggleableActiveColor && other.iconTheme == this.iconTheme && other.primaryIconTheme == this.primaryIconTheme && other.accentIconTheme == this.accentIconTheme && other.materialTapTargetSize == this.materialTapTargetSize && other.pageTransitionsTheme == this.pageTransitionsTheme && other.colorScheme == this.colorScheme && other.typography == this.typography); }
Size getSwitchSize(ThemeData theme) { switch (this.widget.materialTapTargetSize ?? theme.materialTapTargetSize) { case MaterialTapTargetSize.padded: return(new Size(Switch._kSwitchWidth, Switch._kSwitchHeight)); case MaterialTapTargetSize.shrinkWrap: return(new Size(Switch._kSwitchWidth, Switch._kSwitchHeightCollapsed)); } D.assert(false); return(null); }
public static Color applyOverlay(BuildContext context, Color color, float elevation) { ThemeData theme = Theme.of(context); if (elevation > 0.0f && theme.applyElevationOverlayColor && color == theme.colorScheme.surface) { return(Color.alphaBlend(overlayColor(context, elevation), color)); } return(color); }
public virtual ThemeData appBarTheme(BuildContext context) { D.assert(context != null); ThemeData theme = Theme.of(context); D.assert(theme != null); return(theme.copyWith( primaryColor: Colors.white, primaryIconTheme: theme.primaryIconTheme.copyWith(color: Colors.grey), primaryColorBrightness: Brightness.light, primaryTextTheme: theme.textTheme )); }
public Theme( Key key = null, ThemeData data = null, bool isMaterialAppTheme = false, Widget child = null ) : base(key: key) { D.assert(child != null); D.assert(data != null); this.data = data; this.isMaterialAppTheme = isMaterialAppTheme; this.child = child; }
Color _circleColor(int index) { ThemeData themeData = Theme.of(context); if (_isDark()) { return(widget.steps[index].isActive ? themeData.primaryColor : Colors.black38); } else { return(widget.steps[index].isActive ? themeData.accentColor : themeData.backgroundColor); } }
public override Widget build(BuildContext context) { D.assert(material_.debugCheckHasMaterial(context)); ThemeData themeData = Theme.of(context); Size size; switch (widget.materialTapTargetSize ?? themeData.materialTapTargetSize) { case MaterialTapTargetSize.padded: size = new Size(2 * material_.kRadialReactionRadius + 8.0f, 2 * material_.kRadialReactionRadius + 8.0f); break; case MaterialTapTargetSize.shrinkWrap: size = new Size(2 * material_.kRadialReactionRadius, 2 * material_.kRadialReactionRadius); break; default: throw new Exception("Unknown target size: " + widget.materialTapTargetSize); } size += (widget.visualDensity ?? themeData.visualDensity).baseSizeAdjustment; BoxConstraints additionalConstraints = BoxConstraints.tight(size); return(new FocusableActionDetector( actions: _actionMap, focusNode: widget.focusNode, autofocus: widget.autofocus, enabled: enabled, onShowFocusHighlight: _handleFocusHighlightChanged, onShowHoverHighlight: _handleHoverChanged, child: new Builder( builder: (BuildContext _context) => { return new _CheckboxRenderObjectWidget( value: widget.value, tristate: widget.tristate, activeColor: widget.activeColor ?? themeData.toggleableActiveColor, checkColor: widget.checkColor ?? new Color(0xFFFFFFFF), inactiveColor: enabled ? themeData.unselectedWidgetColor : themeData.disabledColor, focusColor: widget.focusColor ?? themeData.focusColor, hoverColor: widget.hoverColor ?? themeData.hoverColor, onChanged: widget.onChanged, additionalConstraints: additionalConstraints, vsync: this, hasFocus: _focused, hovering: _hovering ); } ) )); }
public override Widget build(BuildContext context) { Widget result = new WidgetsApp( key: new GlobalObjectKey <State>(this), navigatorKey: this.widget.navigatorKey, navigatorObservers: this._navigatorObservers, pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => new MaterialPageRoute(settings: settings, builder: builder), home: this.widget.home, routes: this.widget.routes, initialRoute: this.widget.initialRoute, onGenerateRoute: this.widget.onGenerateRoute, onUnknownRoute: this.widget.onUnknownRoute, builder: (BuildContext _context, Widget child) => { ThemeData theme; Brightness platformBrightness = MediaQuery.platformBrightnessOf(_context); if (platformBrightness == Brightness.dark && this.widget.darkTheme != null) { theme = this.widget.darkTheme; } else if (this.widget.theme != null) { theme = this.widget.theme; } else { theme = ThemeData.fallback(); } return(new AnimatedTheme( data: theme, isMaterialAppTheme: true, child: this.widget.builder != null ? new Builder( builder: (__context) => { return this.widget.builder(__context, child); } ) : child )); }, textStyle: AppUtils._errorTextStyle, locale: this.widget.locale, localizationsDelegates: this._localizationsDelegates, localeResolutionCallback: this.widget.localeResolutionCallback, localeListResolutionCallback: this.widget.localeListResolutionCallback, supportedLocales: this.widget.supportedLocales, showPerformanceOverlay: this.widget.showPerformanceOverlay ); return(result); }
public override void didChangeDependencies() { ThemeData theme = Theme.of(context); _valueColor = _positionController.drive( new ColorTween( begin: (widget.color ?? theme.accentColor).withOpacity(0.0f), end: (widget.color ?? theme.accentColor).withOpacity(1.0f) ).chain(new CurveTween( curve: new Interval(0.0f, 1.0f / RefreshIndicatorUtils._kDragSizeFactorLimit) )) ); base.didChangeDependencies(); }
public override Widget build(BuildContext context) { D.assert(MaterialDebug.debugCheckHasMaterial(context)); ThemeData theme = Theme.of(context); return(new IconButton( padding: this.widget.padding, color: theme.brightness == Brightness.dark ? Colors.white54 : Colors.black54, onPressed: this.widget.onPressed == null ? (VoidCallback)null : this._handlePressed, icon: new RotationTransition( turns: this._iconTurns, child: new Icon(Icons.expand_more)) )); }
public _PopupMenuRoute( RelativeRect position = null, List <PopupMenuEntry <T> > items = null, object initialValue = null, float elevation = 8.0f, ThemeData theme = null ) { this.position = position; this.items = items; this.initialValue = initialValue; this.elevation = elevation; this.theme = theme; }
public AnimatedTheme( Key key = null, ThemeData data = null, bool isMaterialAppTheme = false, Curve curve = null, TimeSpan?duration = null, Widget child = null ) : base(key: key, curve: curve ?? Curves.linear, duration: duration ?? ThemeUtils.kThemeAnimationDuration) { D.assert(child != null); D.assert(data != null); this.data = data; this.isMaterialAppTheme = isMaterialAppTheme; this.child = child; }
BorderSide _getTrailingBorderSide( int index, ThemeData theme, ToggleButtonsThemeData toggleButtonsTheme ) { if (!renderBorder) { return(BorderSide.none); } if (index != children.Count - 1) { return(null); } float resultingBorderWidth = borderWidth ?? toggleButtonsTheme.borderWidth ?? _defaultBorderWidth; if (onPressed != null && (isSelected[index])) { return(new BorderSide( color: selectedBorderColor ?? toggleButtonsTheme.selectedBorderColor ?? theme.colorScheme.onSurface.withOpacity(0.12f), width: resultingBorderWidth )); } else if (onPressed != null && !isSelected[index]) { return(new BorderSide( color: borderColor ?? toggleButtonsTheme.borderColor ?? theme.colorScheme.onSurface.withOpacity(0.12f), width: resultingBorderWidth )); } else { return(new BorderSide( color: disabledBorderColor ?? toggleButtonsTheme.disabledBorderColor ?? theme.colorScheme.onSurface.withOpacity(0.12f), width: resultingBorderWidth )); } }