Exemple #1
0
        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 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
                       ));
        }