public override void didChangeDependencies() { base.didChangeDependencies(); D.assert(MaterialD.debugCheckHasMaterial(this.context)); this._updateTabController(); this._initIndicatorPainter(); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); D.assert(() => { if (context.ancestorWidgetOfExactType(typeof(Stepper)) != null) { throw new UIWidgetsError( "Steppers must not be nested. The material specification advises that one should avoid embedding steppers within steppers. " ); } return(true); }); switch (this.widget.type) { case StepperType.vertical: return(this._buildVertical()); case StepperType.horizontal: return(this._buildHorizontal()); } return(null); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); ThemeData theme = Theme.of(context); float statusBarHeight = MediaQuery.of(context).padding.top; return(new Container( height: statusBarHeight + DrawerHeaderUtils._kDrawerHeaderHeight, margin: this.margin, decoration: new BoxDecoration( border: new Border( bottom: Divider.createBorderSide(context) ) ), child: new AnimatedContainer( padding: this.padding.add(EdgeInsets.only(top: statusBarHeight)), decoration: this.decoration, duration: this.duration, curve: this.curve, child: this.child == null ? null : new DefaultTextStyle( style: theme.textTheme.body2, child: MediaQuery.removePadding( context: context, removeTop: true, child: this.child) ) ) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); ThemeData themeData = Theme.of(context); TextStyle style = themeData.textTheme.body1; return(ListView.builder( dragStartBehavior: this.widget.dragStartBehavior, controller: this.scrollController, itemExtent: _itemExtent, itemCount: this.widget.lastDate.Year - this.widget.firstDate.Year + 1, itemBuilder: (BuildContext _context, int index) => { int year = this.widget.firstDate.Year + index; bool isSelected = year == this.widget.selectedDate.Year; TextStyle itemStyle = isSelected ? themeData.textTheme.headline.copyWith(color: themeData.accentColor) : style; return new InkWell( key: new ValueKey <int>(year), onTap: () => { this.widget.onChanged(new DateTime(year, this.widget.selectedDate.Month, this.widget.selectedDate.Day)); }, child: new Center( child: new Text(year.ToString(), style: itemStyle) ) ); } )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasMediaQuery(context)); SliderThemeData sliderTheme = SliderTheme.of(context); if (this.widget.activeColor != null || this.widget.inactiveColor != null) { sliderTheme = sliderTheme.copyWith( activeTrackColor: this.widget.activeColor, inactiveTrackColor: this.widget.inactiveColor, activeTickMarkColor: this.widget.inactiveColor, inactiveTickMarkColor: this.widget.activeColor, thumbColor: this.widget.activeColor, valueIndicatorColor: this.widget.activeColor, overlayColor: this.widget.activeColor?.withAlpha(0x29) ); } return(new _SliderRenderObjectWidget( value: this._unlerp(this.widget.value), divisions: this.widget.divisions, label: this.widget.label, sliderTheme: sliderTheme, mediaQueryData: MediaQuery.of(context), onChanged: (this.widget.onChanged != null) && (this.widget.max > this.widget.min) ? this._handleChanged : (ValueChanged <float>)null, onChangeStart: this.widget.onChangeStart != null ? this._handleDragStart : (ValueChanged <float>)null, onChangeEnd: this.widget.onChangeEnd != null ? this._handleDragEnd : (ValueChanged <float>)null, state: this )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); ThemeData themeData = Theme.of(context); Size size; switch (this.widget.materialTapTargetSize ?? themeData.materialTapTargetSize) { case MaterialTapTargetSize.padded: size = new Size(2 * Constants.kRadialReactionRadius + 8.0f, 2 * Constants.kRadialReactionRadius + 8.0f); break; case MaterialTapTargetSize.shrinkWrap: size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius); break; default: throw new Exception("Unknown material tap target size"); } BoxConstraints additionalConstraints = BoxConstraints.tight(size); return(new _RadioRenderObjectWidget( selected: this.widget.value == this.widget.groupValue, activeColor: this.widget.activeColor ?? themeData.toggleableActiveColor, inactiveColor: this._getInactiveColor(themeData), onChanged: this._enabled ? this._handleChanged : (ValueChanged <bool?>)null, additionalConstraints: additionalConstraints, vsync: this )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); Color currentColor; if (this.onPressed != null) { currentColor = this.color; } else { currentColor = this.disabledColor ?? Theme.of(context).disabledColor; } Widget result = new ConstrainedBox( constraints: new BoxConstraints(minWidth: IconButtonUtils._kMinButtonSize, minHeight: IconButtonUtils._kMinButtonSize), child: new Padding( padding: this.padding, child: new SizedBox( height: this.iconSize, width: this.iconSize, child: new Align( alignment: this.alignment, child: IconTheme.merge( data: new IconThemeData( size: this.iconSize, color: currentColor), child: this.icon) ) ) ) ); if (this.tooltip != null) { result = new Tooltip( message: this.tooltip, child: result); } return(new InkResponse( onTap: () => { if (this.onPressed != null) { this.onPressed(); } }, child: result, highlightColor: this.highlightColor ?? Theme.of(context).highlightColor, splashColor: this.splashColor ?? Theme.of(context).splashColor, radius: Mathf.Max( Material.defaultSplashRadius, (this.iconSize + Mathf.Min(this.padding.horizontal, this.padding.vertical)) * 0.7f) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.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 override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); Widget result = new LayoutBuilder( builder: this._build ); if (this.widget.width != null || this.widget.height != null) { result = new SizedBox( width: this.widget.width, height: this.widget.height, child: result); } return(result); }
Widget buildMaterialSwitch(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); ThemeData theme = Theme.of(context); bool isDark = theme.brightness == Brightness.dark; Color activeThumbColor = this.widget.activeColor ?? theme.toggleableActiveColor; Color activeTrackColor = this.widget.activeTrackColor ?? activeThumbColor.withAlpha(0x80); Color inactiveThumbColor; Color inactiveTrackColor; if (this.widget.onChanged != null) { Color black32 = new Color(0x52000000); // Black with 32% opacity inactiveThumbColor = this.widget.inactiveThumbColor ?? (isDark ? Colors.grey.shade400 : Colors.grey.shade50); inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white30 : black32); } else { inactiveThumbColor = this.widget.inactiveThumbColor ?? (isDark ? Colors.grey.shade800 : Colors.grey.shade400); inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white10 : Colors.black12); } return(new _SwitchRenderObjectWidget( dragStartBehavior: this.widget.dragStartBehavior, value: this.widget.value, activeColor: activeThumbColor, inactiveColor: inactiveThumbColor, activeThumbImage: this.widget.activeThumbImage, inactiveThumbImage: this.widget.inactiveThumbImage, activeTrackColor: activeTrackColor, inactiveTrackColor: inactiveTrackColor, configuration: ImageUtils.createLocalImageConfiguration(context), onChanged: this.widget.onChanged, additionalConstraints: BoxConstraints.tight(this.getSwitchSize(theme)), vsync: this )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); float height = 0f; Widget label = null; if (this.icon == null) { height = TabsUtils._kTabHeight; label = this._buildLabelText(); } else if (this.text == null) { height = TabsUtils._kTabHeight; label = this.icon; } else { height = TabsUtils._kTextAndIconTabHeight; label = new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Container( child: this.icon, margin: EdgeInsets.only(bottom: 10.0f) ), this._buildLabelText() } ); } return(new SizedBox( height: height, child: new Center( child: label, widthFactor: 1.0f) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); return(new DrawerHeader( decoration: this.widget.decoration ?? new BoxDecoration( color: Theme.of(context).primaryColor ), margin: this.widget.margin, padding: EdgeInsets.only(top: 16.0f, left: 16.0f), child: new SafeArea( bottom: false, child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new Expanded( child: new Padding( padding: EdgeInsets.only(right: 16.0f), child: new _AccountPictures( currentAccountPicture: this.widget.currentAccountPicture, otherAccountsPictures: this.widget.otherAccountsPictures ) ) ), new _AccountDetails( accountName: this.widget.accountName, accountEmail: this.widget.accountEmail, isOpen: this._isOpen, onTap: this.widget.onDetailsPressed == null ? (VoidCallback)null : () => { this._handleDetailsPressed(); }) } ) ) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); ThemeData themeData = Theme.of(context); Size size; switch (this.widget.materialTapTargetSize ?? themeData.materialTapTargetSize) { case MaterialTapTargetSize.padded: size = new Size(2 * Constants.kRadialReactionRadius + 8.0f, 2 * Constants.kRadialReactionRadius + 8.0f); break; case MaterialTapTargetSize.shrinkWrap: size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius); break; default: throw new Exception("Unknown target size: " + this.widget.materialTapTargetSize); } BoxConstraints additionalConstraints = BoxConstraints.tight(size); return(new _CheckboxRenderObjectWidget( value: this.widget.value, tristate: this.widget.tristate, activeColor: this.widget.activeColor ?? themeData.toggleableActiveColor, checkColor: this.widget.checkColor ?? new Color(0xFFFFFFFF), inactiveColor: this.widget.onChanged != null ? themeData.unselectedWidgetColor : themeData.disabledColor, onChanged: this.widget.onChanged, additionalConstraints: additionalConstraints, vsync: this )); }
public virtual bool debugCheckContext(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); return(true); }
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) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); ThemeData themeData = Theme.of(context); TextStyle style = this.widget.style ?? themeData.textTheme.subhead; Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = this._effectiveController; FocusNode focusNode = this._effectiveFocusNode; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } Widget child = new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: focusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: style, textAlign: this.widget.textAlign, textDirection: this.widget.textDirection, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, selectionColor: themeData.textSelectionColor, selectionControls: this.widget.enableInteractiveSelection ? MaterialUtils.materialTextSelectionControls : null, onChanged: this.widget.onChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, onSelectionChanged: this._handleSelectionChanged, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: this.widget.cursorRadius, cursorColor: this.widget.cursorColor ?? Theme.of(context).cursorColor, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: this.widget.enableInteractiveSelection ) ); if (this.widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: this._getEffectiveDecoration(), baseStyle: this.widget.style, textAlign: this.widget.textAlign, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), child: _child )); }, child: child ); } return(new IgnorePointer( ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true), child: new GestureDetector( behavior: HitTestBehavior.translucent, onTapDown: this._handleTapDown, onTap: this._handleTap, onTapCancel: this._handleTapCancel, onLongPress: this._handleLongPress, child: child ) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); List <Widget> items = this._enabled ? new List <Widget>(this.widget.items) : new List <Widget>(); int hintIndex = 0; if (this.widget.hint != null || (!this._enabled && this.widget.disabledHint != null)) { Widget emplacedHint = this._enabled ? this.widget.hint : new DropdownMenuItem <Widget>(child: this.widget.disabledHint ?? this.widget.hint); hintIndex = items.Count; items.Add(new DefaultTextStyle( style: this._textStyle.copyWith(color: Theme.of(context).hintColor), child: new IgnorePointer( child: emplacedHint ) )); } EdgeInsets padding = ButtonTheme.of(context).alignedDropdown ? DropdownConstants._kAlignedButtonPadding : DropdownConstants._kUnalignedButtonPadding; IndexedStack innerItemsWidget = new IndexedStack( index: this._enabled ? (this._selectedIndex ?? hintIndex) : hintIndex, alignment: Alignment.centerLeft, children: items ); Widget result = new DefaultTextStyle( style: this._textStyle, child: new Container( padding: padding, height: this.widget.isDense ? this._denseButtonHeight : null, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, children: new List <Widget> { this.widget.isExpanded ? new Expanded(child: innerItemsWidget) : (Widget)innerItemsWidget, new Icon(Icons.arrow_drop_down, size: this.widget.iconSize, color: this._downArrowColor ) } ) ) ); if (!DropdownButtonHideUnderline.at(context)) { float bottom = this.widget.isDense ? 0.0f : 8.0f; result = new Stack( children: new List <Widget> { result, new Positioned( left: 0.0f, right: 0.0f, bottom: bottom, child: new Container( height: 1.0f, decoration: new BoxDecoration( border: new Border( bottom: new BorderSide(color: new Color(0xFFBDBDBD), width: 0.0f)) ) ) ) } ); } return(new GestureDetector( onTap: this._enabled ? (GestureTapCallback)this._handleTap : null, behavior: HitTestBehavior.opaque, child: result )); }
public override Widget build(BuildContext context) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); D.assert( !(this.widget.style != null && this.widget.style.inherit == false && (this.widget.style.fontSize == null || this.widget.style.textBaseline == null)), "inherit false style must supply fontSize and textBaseline" ); ThemeData themeData = Theme.of(context); TextStyle style = themeData.textTheme.subhead.merge(this.widget.style); Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = this._effectiveController; FocusNode focusNode = this._effectiveFocusNode; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } bool forcePressEnabled = false; TextSelectionControls textSelectionControls = MaterialUtils.materialTextSelectionControls;; bool paintCursorAboveText = false; bool cursorOpacityAnimates = false; Offset cursorOffset = null; Color cursorColor = this.widget.cursorColor ?? themeData.cursorColor; Radius cursorRadius = this.widget.cursorRadius; Widget child = new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: focusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: style, textAlign: this.widget.textAlign, textDirection: this.widget.textDirection, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, selectionColor: themeData.textSelectionColor, selectionControls: this.widget.selectionEnabled ? textSelectionControls : null, onChanged: this.widget.onChanged, onSelectionChanged: this._handleSelectionChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: cursorRadius, cursorColor: cursorColor, cursorOpacityAnimates: cursorOpacityAnimates, cursorOffset: cursorOffset, paintCursorAboveText: paintCursorAboveText, backgroundCursorColor: new Color(0xFF8E8E93),// TODO: CupertinoColors.inactiveGray, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: this.widget.enableInteractiveSelection == true, dragStartBehavior: this.widget.dragStartBehavior ) ); if (this.widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: this._getEffectiveDecoration(), baseStyle: this.widget.style, textAlign: this.widget.textAlign, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), child: _child )); }, child: child ); } return(new IgnorePointer( ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true), child: new TextSelectionGestureDetector( onTapDown: this._handleTapDown, // onForcePressStart: forcePressEnabled ? this._handleForcePressStarted : null, // TODO: Remove this when force press is added onSingleTapUp: this._handleSingleTapUp, onSingleTapCancel: this._handleSingleTapCancel, onSingleLongTapStart: this._handleLongPress, onDragSelectionStart: this._handleDragSelectionStart, onDragSelectionUpdate: this._handleDragSelectionUpdate, behavior: HitTestBehavior.translucent, child: child ) )); }