Пример #1
0
 Widget _buildCountdownTimerPicker(BuildContext context)
 {
     return(new GestureDetector(
                onTap: () =>
     {
         CupertinoRouteUtils.showCupertinoModalPopup(
             context: context,
             semanticsDismissible: true,
             builder: (BuildContext context1) =>
         {
             return new _BottomPicker(
                 child: new CupertinoTimerPicker(
                     backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1),
                     initialTimerDuration: timer,
                     onTimerDurationChanged: (TimeSpan newTimer) => {
                 setState(() => timer = newTimer);
             }
                     )
                 );
         }
             );
     },
                child: new _Menu(
                    children: new List <Widget> {
         new Text("Countdown Timer"),
         new Text(
             $"{timer.Hours}:" +
             $"{(timer.Minutes % 60).ToString("00")}:" +
             $"{(timer.Seconds % 60).ToString("00")}",
             style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context))
             ),
     }
                    )
                ));
 }
Пример #2
0
 Widget _buildDateAndTimePicker(BuildContext context)
 {
     return(new GestureDetector(
                onTap: () => {
         CupertinoRouteUtils.showCupertinoModalPopup(
             context: context,
             semanticsDismissible: true,
             builder: (BuildContext context1) => {
             return new _BottomPicker(
                 child: new CupertinoDatePicker(
                     backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1),
                     mode: CupertinoDatePickerMode.dateAndTime,
                     initialDateTime: dateTime,
                     onDateTimeChanged: (newDateTime) => {
                 setState(() => dateTime = newDateTime);
             }
                     )
                 );
         }
             );
     },
                child: new _Menu(
                    children: new List <Widget> {
         new Text("Date and Time"),
         new Text(
             dateTime.ToString("MMMM dd, yyyy") + " " + dateTime.ToString("HH:mm tt"),
             style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context))
             ),
     }
                    )
                ));
 }
Пример #3
0
 Widget _buildDateAndTimePicker(BuildContext context)
 {
     return(new GestureDetector(
                onTap: () => {
         CupertinoRouteUtils.showCupertinoModalPopup(
             context: context,
             builder: (BuildContext _context) => {
             return this._buildBottomPicker(
                 new CupertinoDatePicker(
                     mode: CupertinoDatePickerMode.dateAndTime,
                     initialDateTime: this.dateTime,
                     onDateTimeChanged: (DateTime newDateTime) => {
                 this.setState(() => this.dateTime = newDateTime);
             }
                     )
                 );
         }
             );
     },
                child: this._buildMenu(new List <Widget> {
         new Text("Date and Time"),
         new Text(
             this.dateTime.ToString("MMMM dd, yyyy h:mm tt"),
             style: new TextStyle(color: CupertinoColors.inactiveGray)
             )
     }
                                       )
                ));
 }
Пример #4
0
 Widget _buildCountdownTimerPicker(BuildContext context)
 {
     return(new GestureDetector(
                onTap: () => {
         CupertinoRouteUtils.showCupertinoModalPopup(
             context: context,
             builder: (BuildContext _context) => {
             return this._buildBottomPicker(
                 new CupertinoTimerPicker(
                     initialTimerDuration: this.timer,
                     onTimerDurationChanged: (TimeSpan newTimer) => {
                 this.setState(() => this.timer = newTimer);
             }
                     )
                 );
         }
             );
     },
                child: this._buildMenu(new List <Widget> {
         new Text("Countdown Timer"),
         new Text(
             $"{this.timer.Hours}:" +
             $"{(this.timer.Minutes % 60).ToString("00")}:" +
             $"{(this.timer.Seconds % 60).ToString("00")}",
             style: new TextStyle(color: CupertinoColors.inactiveGray)
             )
     }
                                       )
                ));
 }
Пример #5
0
 void showDemoActionSheet(BuildContext context = null, Widget child = null)
 {
     CupertinoRouteUtils.showCupertinoModalPopup <string>(
         context: context,
         builder: (BuildContext context1) => child
         ).then_((string value) => {
         if (value != null)
         {
             setState(() => { lastSelectedValue = value; });
         }
     });
 }
Пример #6
0
        Widget _buildColorPicker(BuildContext context)
        {
            FixedExtentScrollController scrollController =
                new FixedExtentScrollController(initialItem: this._selectedColorIndex);

            List <Widget> generateList()
            {
                var list = new List <Widget>();

                foreach (var item in CupertinoNavigationDemoUtils.coolColorNames)
                {
                    list.Add(new Center(child:
                                        new Text(item)
                                        ));
                }

                return(list);
            }

            return(new GestureDetector(
                       onTap: () => {
                CupertinoRouteUtils.showCupertinoModalPopup(
                    context: context,
                    builder: (BuildContext _context) => {
                    return this._buildBottomPicker(
                        new CupertinoPicker(
                            scrollController: scrollController,
                            itemExtent: CupertinoPickerDemoUtils._kPickerItemHeight,
                            backgroundColor: CupertinoColors.white,
                            onSelectedItemChanged: (int index) => {
                        this.setState(() => this._selectedColorIndex = index);
                    },
                            children: generateList()
                            )
                        );
                }
                    );
            },
                       child: this._buildMenu(new List <Widget> {
                new Text("Favorite Color"),
                new Text(
                    CupertinoNavigationDemoUtils.coolColorNames[this._selectedColorIndex],
                    style: new TextStyle(
                        color: CupertinoColors.inactiveGray
                        )
                    )
            }
                                              )
                       ));
        }
 void showDemoActionSheet(
     BuildContext context = null,
     Widget child         = null
     )
 {
     CupertinoRouteUtils.showCupertinoModalPopup(
         context: context,
         builder: (BuildContext _context) => child
         ).Then((object value) => {
         if (value != null)
         {
             this.setState(() => { this.lastSelectedValue = value as string; });
         }
     });
 }
Пример #8
0
        Widget _buildColorPicker(BuildContext context)
        {
            FixedExtentScrollController scrollController = new FixedExtentScrollController(initialItem: _selectedColorIndex);

            List <Widget> widgets = new List <Widget>();

            for (int i = 0; i < CupertinoPickerDemoUtils.coolColorNames.Count; i++)
            {
                widgets.Add(new Center(
                                child: new Text(CupertinoPickerDemoUtils.coolColorNames[i])
                                ));
            }

            return(new GestureDetector(
                       onTap: () => {
                CupertinoRouteUtils.showCupertinoModalPopup(
                    context: context,
                    semanticsDismissible: true,
                    builder: (BuildContext context1) => {
                    return new _BottomPicker(
                        child: new CupertinoPicker(
                            scrollController: scrollController,
                            itemExtent: CupertinoPickerDemoUtils._kPickerItemHeight,
                            backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1),
                            onSelectedItemChanged: (int index) => {
                        setState(() => _selectedColorIndex = index);
                    },
                            children: widgets
                            )
                        );
                }
                    );
            },
                       child: new _Menu(
                           children: new List <Widget> {
                new Text("Favorite Color"),
                new Text(
                    CupertinoPickerDemoUtils.coolColorNames[_selectedColorIndex],
                    style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context))
                    )
            }
                           )
                       ));
        }