private Future _selectTime(BuildContext context)
        {
            TimePickerUtils.showTimePicker(
                context: context,
                initialTime: this.selectedTime
                ).then((object value) =>
            {
                var picked = (TimeOfDay)value;
                if (picked != null && picked != this.selectedTime)
                {
                    this.selectTime(picked);
                }
            });

            return(null);
        }
Esempio n. 2
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme           = Theme.of(context);
            TextStyle dialogTextStyle = theme.textTheme.subtitle1.copyWith(color: theme.textTheme.caption.color);

            var children = new List <Widget>
            {
                new RaisedButton(
                    child: new Text("ALERT"),
                    onPressed: () => {
                    showDemoDialog <DialogDemoAction>(
                        context: context,
                        child: new AlertDialog(
                            content: new Text(
                                GalleryDialogDemoUtils._alertWithoutTitleText,
                                style: dialogTextStyle
                                ),
                            actions: new List <Widget> {
                        new FlatButton(
                            child: new Text("CANCEL"),
                            onPressed: () => { Navigator.pop(context, DialogDemoAction.cancel); }
                            ),
                        new FlatButton(
                            child: new Text("DISCARD"),
                            onPressed: () => { Navigator.pop(context, DialogDemoAction.discard); }
                            )
                    }
                            )
                        );
                }
                    ),
                new RaisedButton(
                    child: new Text("ALERT WITH TITLE"),
                    onPressed: () => {
                    showDemoDialog <DialogDemoAction>(
                        context: context,
                        child: new AlertDialog(
                            title: new Text("Use location service?"),
                            content: new Text(
                                GalleryDialogDemoUtils._alertWithTitleText,
                                style: dialogTextStyle
                                ),
                            actions: new List <Widget> {
                        new FlatButton(
                            child: new Text("DISAGREE"),
                            onPressed: () => { Navigator.pop(context, DialogDemoAction.disagree); }
                            ),
                        new FlatButton(
                            child: new Text("AGREE"),
                            onPressed: () => { Navigator.pop(context, DialogDemoAction.agree); }
                            )
                    }
                            )
                        );
                }
                    ),
                new RaisedButton(
                    child: new Text("SIMPLE"),
                    onPressed: () => {
                    showDemoDialog <String>(
                        context: context,
                        child: new SimpleDialog(
                            title: new Text("Set backup account"),
                            children: new List <Widget> {
                        new DialogDemoItem(
                            icon: Icons.account_circle,
                            color: theme.primaryColor,
                            text: "*****@*****.**",
                            onPressed: () => { Navigator.pop(context, "*****@*****.**"); }
                            ),
                        new DialogDemoItem(
                            icon: Icons.account_circle,
                            color: theme.primaryColor,
                            text: "*****@*****.**",
                            onPressed: () => { Navigator.pop(context, "*****@*****.**"); }
                            ),
                        new DialogDemoItem(
                            icon: Icons.add_circle,
                            text: "add account",
                            color: theme.disabledColor
                            )
                    }
                            )
                        );
                }
                    ),
                new RaisedButton(
                    child: new Text("CONFIRMATION"),
                    onPressed: () => {
                    TimePickerUtils.showTimePicker(
                        context: context,
                        initialTime: _selectedTime
                        )
                    .then((object value) => {
                        var time = (TimeOfDay)value;
                        if (time != null && time != _selectedTime)
                        {
                            _selectedTime = time;
                            _scaffoldKey.currentState.showSnackBar(new SnackBar(
                                                                       content: new Text($"You selected: {time.format(context)}")
                                                                       ));
                        }
                    });
                }
                    ),
                new RaisedButton(
                    child: new Text("FULLSCREEN"),
                    onPressed: () => {
                    /*Navigator.push(context, new MaterialPageRoute<DismissDialogAction>(
                     * builder: (BuildContext subContext) => new FullScreenDialogDemo(),
                     * fullscreenDialog: true
                     * ));*/

                    D.assert(false, () => "TO DO >>>");
                }
                    )
            };

            return(new Scaffold(
                       key: _scaffoldKey,
                       appBar: new AppBar(
                           title: new Text("Dialogs"),
                           actions: new List <Widget> {
                new MaterialDemoDocumentationButton(DialogDemo.routeName)
            }
                           ),
                       body: new ListView(
                           padding: EdgeInsets.symmetric(vertical: 24.0f, horizontal: 72.0f),
                           children: children.Select <Widget, Widget>((Widget button) => {
                return new Container(
                    padding: EdgeInsets.symmetric(vertical: 8.0f),
                    child: button
                    );
            })
                           .ToList()
                           )
                       ));
        }