public override Widget build(BuildContext context) { if (maintainSize) { Widget result = child; if (!maintainInteractivity) { result = new IgnorePointer( child: child, ignoring: !visible //todo : ignoringSemantics: !visible && !maintainSemantics, ); } return(new Opacity( opacity: visible ? 1.0f : 0.0f, //alwaysIncludeSemantics: maintainSemantics, child: result )); } D.assert(!maintainInteractivity); D.assert(!maintainSemantics); D.assert(!maintainSize); if (maintainState) { Widget result = child; if (!maintainAnimation) { result = new TickerMode(child: child, enabled: visible); } return(new Offstage( child: result, offstage: !visible )); } D.assert(!maintainAnimation); D.assert(!maintainState); return(visible ? child : replacement); }
public override Widget build(BuildContext context) { if (this.maintainSize) { Widget result = this.child; if (!this.maintainInteractivity) { result = new IgnorePointer( child: this.child, ignoring: !this.visible ); } return(new Opacity( opacity: this.visible ? 1.0f : 0.0f, child: result )); } D.assert(!this.maintainInteractivity); D.assert(!this.maintainSize); if (this.maintainState) { Widget result = this.child; if (!this.maintainAnimation) { result = new TickerMode(child: this.child, enabled: this.visible); } return(new Offstage( child: result, offstage: !this.visible )); } D.assert(!this.maintainAnimation); D.assert(!this.maintainState); return(this.visible ? this.child : this.replacement); }
public override Widget build(BuildContext context) { MaterialLocalizations localizations = MaterialLocalizations.of(context); ThemeData themeData = Theme.of(context); TextTheme headerTextTheme = themeData.primaryTextTheme; Color dayColor = null; Color yearColor = null; switch (themeData.primaryColorBrightness) { case Brightness.light: dayColor = this.mode == DatePickerMode.day ? Colors.black87 : Colors.black54; yearColor = this.mode == DatePickerMode.year ? Colors.black87 : Colors.black54; break; case Brightness.dark: dayColor = this.mode == DatePickerMode.day ? Colors.white : Colors.white70; yearColor = this.mode == DatePickerMode.year ? Colors.white : Colors.white70; break; } TextStyle dayStyle = headerTextTheme.display1.copyWith(color: dayColor, height: 1.4f); TextStyle yearStyle = headerTextTheme.subhead.copyWith(color: yearColor, height: 1.4f); Color backgroundColor = null; switch (themeData.brightness) { case Brightness.light: backgroundColor = themeData.primaryColor; break; case Brightness.dark: backgroundColor = themeData.backgroundColor; break; } float width = 0f; float height = 0f; EdgeInsets padding = null; MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center; switch (this.orientation) { case Orientation.portrait: height = DatePickerUtils._kDatePickerHeaderPortraitHeight; padding = EdgeInsets.symmetric(horizontal: 16.0f); mainAxisAlignment = MainAxisAlignment.center; break; case Orientation.landscape: width = DatePickerUtils._kDatePickerHeaderLandscapeWidth; padding = EdgeInsets.all(8.0f); mainAxisAlignment = MainAxisAlignment.start; break; } Widget yearButton = new IgnorePointer( ignoring: this.mode != DatePickerMode.day, child: new _DateHeaderButton( color: backgroundColor, onTap: Feedback.wrapForTap(() => this._handleChangeMode(DatePickerMode.year), context), child: new Text(localizations.formatYear(this.selectedDate), style: yearStyle) ) ); Widget dayButton = new IgnorePointer( ignoring: this.mode == DatePickerMode.day, child: new _DateHeaderButton( color: backgroundColor, onTap: Feedback.wrapForTap(() => this._handleChangeMode(DatePickerMode.day), context), child: new Text(localizations.formatMediumDate(this.selectedDate), style: dayStyle) ) ); return(new Container( width: width, height: height, padding: padding, color: backgroundColor, child: new Column( mainAxisAlignment: mainAxisAlignment, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { yearButton, dayButton } ) )); }