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 )); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); Widget picker = new Flexible( child: new SizedBox( height: DatePickerUtils._kMaxDayPickerHeight, child: this._buildPicker() ) ); Widget actions = ButtonTheme.bar( child: new ButtonBar( children: new List <Widget> { new FlatButton( child: new Text(this.localizations.cancelButtonLabel), onPressed: this._handleCancel ), new FlatButton( child: new Text(this.localizations.okButtonLabel), onPressed: this._handleOk ) } ) ); Dialog dialog = new Dialog( child: new OrientationBuilder( builder: (BuildContext _context, Orientation orientation) => { Widget header = new _DatePickerHeader( selectedDate: this._selectedDate, mode: this._mode, onModeChanged: this._handleModeChanged, orientation: orientation ); switch (orientation) { case Orientation.portrait: return(new SizedBox( width: DatePickerUtils._kMonthPickerPortraitWidth, child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { header, new Container( color: theme.dialogBackgroundColor, child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { picker, actions, } ) ) } ) )); case Orientation.landscape: return(new SizedBox( height: DatePickerUtils._kDatePickerLandscapeHeight, child: new Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { header, new Flexible( child: new Container( width: DatePickerUtils._kMonthPickerLandscapeWidth, color: theme.dialogBackgroundColor, child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { picker, actions } ) ) ) } ) )); } return(null); } ) ); return(new Theme( data: theme.copyWith( dialogBackgroundColor: Colors.transparent ), child: dialog )); }
public override Widget build(BuildContext context) { MediaQueryData mediaQueryData = MediaQuery.of(context); D.assert(this.animation != null); ThemeData theme = Theme.of(context); ThemeData darkTheme = new ThemeData( brightness: Brightness.dark, accentColor: theme.accentColor, accentColorBrightness: theme.accentColorBrightness ); List <Widget> children = new List <Widget> { new SizedBox(width: SnackBarUtils._kSnackBarPadding), new Expanded( child: new Container( padding: EdgeInsets.symmetric(vertical: SnackBarUtils._kSingleLineVerticalPadding), child: new DefaultTextStyle( style: darkTheme.textTheme.subhead, child: this.content) ) ) }; if (this.action != null) { children.Add(ButtonTheme.bar( padding: EdgeInsets.symmetric(horizontal: SnackBarUtils._kSnackBarPadding), textTheme: ButtonTextTheme.accent, child: this.action )); } else { children.Add(new SizedBox(width: SnackBarUtils._kSnackBarPadding)); } CurvedAnimation heightAnimation = new CurvedAnimation(parent: this.animation, curve: SnackBarUtils._snackBarHeightCurve); CurvedAnimation fadeAnimation = new CurvedAnimation(parent: this.animation, curve: SnackBarUtils._snackBarFadeCurve, reverseCurve: new Threshold(0.0f)); Widget snackbar = new SafeArea( top: false, child: new Row( children: children, crossAxisAlignment: CrossAxisAlignment.center ) ); snackbar = new Dismissible( key: Key.key("dismissible"), direction: DismissDirection.down, resizeDuration: null, onDismissed: (DismissDirection? direction) => { Scaffold.of(context).removeCurrentSnackBar(reason: SnackBarClosedReason.swipe); }, child: new Material( elevation: 6.0f, color: this.backgroundColor ?? SnackBarUtils._kSnackBackground, child: new Theme( data: darkTheme, child: mediaQueryData.accessibleNavigation ? snackbar : new FadeTransition( opacity: fadeAnimation, child: snackbar ) ) ) ); return(new ClipRect( child: mediaQueryData.accessibleNavigation ? snackbar : new AnimatedBuilder( animation: heightAnimation, builder: (BuildContext subContext, Widget child) => { return new Align( alignment: Alignment.topLeft, heightFactor: heightAnimation.value, child: child ); }, child: snackbar ) )); }