public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); TextStyle style = theme.textTheme.subhead; if (!this.widget.enabled) { style = style.copyWith(color: theme.disabledColor); } Widget item = new AnimatedDefaultTextStyle( style: style, duration: Constants.kThemeChangeDuration, child: new Baseline( baseline: this.widget.height - PopupMenuUtils._kBaselineOffsetFromBottom, baselineType: style.textBaseline, child: this.buildChild() ) ); if (!this.widget.enabled) { bool isDark = theme.brightness == Brightness.dark; item = IconTheme.merge( data: new IconThemeData(opacity: isDark ? 0.5f : 0.38f), child: item ); } return(new InkWell( onTap: this.widget.enabled ? this.handleTap : (GestureTapCallback)null, child: new Container( height: this.widget.height, padding: EdgeInsets.symmetric(horizontal: PopupMenuUtils._kMenuHorizontalPadding), child: item ) )); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context); TextStyle style = widget.textStyle ?? popupMenuTheme.textStyle ?? theme.textTheme.subtitle1; if (!widget.enabled) { style = style.copyWith(color: theme.disabledColor); } Widget item = new AnimatedDefaultTextStyle( style: style, duration: material_.kThemeChangeDuration, child: new Container( alignment: AlignmentDirectional.centerStart, constraints: new BoxConstraints(minHeight: widget.height), padding: EdgeInsets.symmetric(horizontal: material_._kMenuHorizontalPadding), child: buildChild() ) ); if (!widget.enabled) { bool isDark = theme.brightness == Brightness.dark; item = IconTheme.merge( data: new IconThemeData(opacity: isDark ? 0.5f : 0.38f), child: item ); } return(new InkWell( onTap: widget.enabled?handleTap: (GestureTapCallback)null, canRequestFocus: widget.enabled, child: item )); }
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 ) ) )); }
public override Widget build(BuildContext context) { Color backgroundColor = this._getBackgroundColor(context); D.assert(backgroundColor != null || this.widget.type == MaterialType.transparency, () => "If Material type is not MaterialType.transparency, a color must" + "either be passed in through the 'color' property, or be defined " + "in the theme (ex. canvasColor != null if type is set to " + "MaterialType.canvas"); Widget contents = this.widget.child; if (contents != null) { contents = new AnimatedDefaultTextStyle( style: this.widget.textStyle ?? Theme.of(context).textTheme.body1, duration: this.widget.animationDuration, child: contents ); } contents = new NotificationListener <LayoutChangedNotification>( onNotification: (LayoutChangedNotification notification) => { _RenderInkFeatures renderer = (_RenderInkFeatures)this._inkFeatureRenderer.currentContext.findRenderObject(); renderer._didChangeLayout(); return(true); }, child: new _InkFeatures( key: this._inkFeatureRenderer, color: backgroundColor, child: contents, vsync: this ) ); if (this.widget.type == MaterialType.canvas && this.widget.shape == null && this.widget.borderRadius == null) { return(new AnimatedPhysicalModel( curve: Curves.fastOutSlowIn, duration: this.widget.animationDuration, shape: BoxShape.rectangle, clipBehavior: this.widget.clipBehavior, borderRadius: BorderRadius.zero, elevation: this.widget.elevation, color: backgroundColor, shadowColor: this.widget.shadowColor, animateColor: false, child: contents )); } ShapeBorder shape = this._getShape(); if (this.widget.type == MaterialType.transparency) { return(_transparentInterior( context: context, shape: shape, clipBehavior: this.widget.clipBehavior, contents: contents)); } return(new _MaterialInterior( curve: Curves.fastOutSlowIn, duration: this.widget.animationDuration, shape: shape, borderOnForeground: this.widget.borderOnForeground, clipBehavior: this.widget.clipBehavior, elevation: this.widget.elevation, color: backgroundColor, shadowColor: this.widget.shadowColor, child: contents )); }