Beispiel #1
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    middle: new Text("Picker"),
                    // We"re specifying a back label here because the previous page is a
                    // Material page. CupertinoPageRoutes could auto-populate these back
                    // labels.
                    previousPageTitle: "Cupertino",
                    trailing: new CupertinoDemoDocumentationButton(CupertinoPickerDemo.routeName)
                    ),
                child: new DefaultTextStyle(
                    style: CupertinoTheme.of(context).textTheme.textStyle,
                    child: new DecoratedBox(
                        decoration: new BoxDecoration(
                            color: CupertinoTheme.of(context).brightness == Brightness.light
                         ? CupertinoColors.extraLightBackgroundGray
                         : CupertinoColors.darkBackgroundGray
                            ),
                        child: new SafeArea(
                            child: new ListView(
                                children: new List <Widget> {
         new Padding(padding: EdgeInsets.only(top: 32.0f)),
         this._buildColorPicker(context),
         this._buildCountdownTimerPicker(context),
         this._buildDatePicker(context),
         this._buildTimePicker(context),
         this._buildDateAndTimePicker(context)
     }
                                )
                            )
                        )
                    )
                ));
 }
Beispiel #2
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    middle: new  Text("Picker"),
                    // We're specifying a back label here because the previous page is a
                    // Material page. CupertinoPageRoutes could auto-populate these back
                    // labels.
                    previousPageTitle: "Cupertino"
                    //trailing: CupertinoDemoDocumentationButton(CupertinoPickerDemo.routeName)
                    ),
                child: new DefaultTextStyle(
                    style: CupertinoTheme.of(context).textTheme.textStyle,
                    child: new ListView(
                        children: new List <Widget> {
         new Padding(padding: EdgeInsets.only(top: 32.0f)),
         _buildColorPicker(context),
         _buildCountdownTimerPicker(context),
         _buildDatePicker(context),
         _buildTimePicker(context),
         _buildDateAndTimePicker(context),
     }
                        )
                    )
                ));
 }
Beispiel #3
0
        public override Widget build(BuildContext context)
        {
            return(new WillPopScope(
                       //onWillPop: () => { return Promise<bool>.Resolved(true); },
                       //onWillPop: this.onWillPop,
                       child: new DefaultTextStyle(
                           style: CupertinoTheme.of(context).textTheme.textStyle,
                           child: new CupertinoTabScaffold(
                               tabBar: new CupertinoTabBar(
                                   items: new List <BottomNavigationBarItem> {
                new BottomNavigationBarItem(
                    icon: new Icon(CupertinoIcons.home),
                    title: new Text("Home")
                    ),
                new BottomNavigationBarItem(
                    icon: new Icon(CupertinoIcons.conversation_bubble),
                    title: new Text("Support")
                    ),
                new BottomNavigationBarItem(
                    icon: new Icon(CupertinoIcons.profile_circled),
                    title: new Text("Profile")
                    )
            }

                                   ),
                               tabBuilder: (BuildContext _context, int index) => {
                D.assert(index >= 0 && index <= 2);
                switch (index)
                {
                case 0:
                    return new CupertinoTabView(
                        builder: (BuildContext _context1) => {
                        return new CupertinoDemoTab1(
                            colorItems: colorItems,
                            colorNameItems: colorNameItems
                            );
                    },
                        defaultTitle: "Colors"
                        );

                case 1:
                    return new CupertinoTabView(
                        builder: (BuildContext _context2) => new CupertinoDemoTab2(),
                        defaultTitle: "Support Chat"
                        );

                case 2:
                    return new CupertinoTabView(
                        builder: (BuildContext _context3) => new CupertinoDemoTab3(),
                        defaultTitle: "Account"
                        );
                }

                return null;
            }
                               )
                           )
                       ));
        }
Beispiel #4
0
        public override Widget build(BuildContext context)
        {
            _ListItem getListItem(int index)
            {
                if (index < randomizedContacts.Count && index > 0)
                {
                    return(new _ListItem(
                               name: randomizedContacts[index][0],
                               place: randomizedContacts[index][1],
                               date: randomizedContacts[index][2],
                               called: randomizedContacts[index][3] == "true"
                               ));
                }
                else
                {
                    return(new _ListItem());
                }
            }

            return(new DefaultTextStyle(
                       style: CupertinoTheme.of(context).textTheme.textStyle,
                       child: new CupertinoPageScaffold(
                           backgroundColor: CupertinoColors.systemGroupedBackground,
                           child: new CustomScrollView(
                               physics: new BouncingScrollPhysics(parent: new AlwaysScrollableScrollPhysics()),
                               slivers: new List <Widget> {
                new CupertinoSliverNavigationBar(
                    largeTitle: new Text("Refresh"),
                    previousPageTitle: "Cupertino"
                    //trailing: CupertinoDemoDocumentationButton(CupertinoRefreshControlDemo.routeName),
                    ),
                new CupertinoSliverRefreshControl(
                    onRefresh: () => {
                    return Future.delayed(new TimeSpan(0, 0, 0, 2)).then((_) => {
                        if (mounted)
                        {
                            setState(() => repopulateList());
                        }
                    });
                }
                    ),
                new SliverSafeArea(
                    top: false, // Top safe area is consumed by the navigation bar.
                    sliver: new SliverList(
                        del: new SliverChildBuilderDelegate(
                            (BuildContext context1, int index) =>
                {
                    return getListItem(index);
                },
                            childCount: 20
                            )
                        )
                    ),
            }
                               )
                           )
                       ));
        }
Beispiel #5
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    trailing: CupertinoNavigationDemoUtils.trailingButtons
                    ),
                child: new SafeArea(
                    child: new DecoratedBox(
                        decoration: new BoxDecoration(
                            color: CupertinoTheme.of(context).brightness == Brightness.light
                         ? CupertinoColors.extraLightBackgroundGray
                         : CupertinoColors.darkBackgroundGray
                            ),
                        child: new ListView(
                            children: new List <Widget> {
         new Padding(padding: EdgeInsets.only(top: 32.0f)),
         new GestureDetector(
             onTap: () => {
             Navigator.of(context, rootNavigator: true).push(
                 new CupertinoPageRoute(
                     fullscreenDialog: true,
                     builder: (BuildContext _context) => new Tab3Dialog()
                     )
                 );
         },
             child: new Container(
                 decoration: new BoxDecoration(
                     color: CupertinoTheme.of(context).scaffoldBackgroundColor,
                     border: new Border(
                         top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f),
                         bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
                         )
                     ),
                 height: 44.0f,
                 child: new Padding(
                     padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
                     child: new SafeArea(
                         top: false,
                         bottom: false,
                         child: new Row(
                             children: new List <Widget> {
             new Text(
                 "Sign in",
                 style: new TextStyle(color: CupertinoTheme.of(context)
                                      .primaryColor)
                 ),
         }
                             )
                         )
                     )
                 )
             )
     }
                            )
                        )
                    )
                ));
 }
Beispiel #6
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    middle: new Text("Switch"),
                    previousPageTitle: "Cupertino",
                    trailing: new CupertinoDemoDocumentationButton(CupertinoSwitchDemo.routeName)
                    ),
                child: new DefaultTextStyle(
                    style: CupertinoTheme.of(context).textTheme.textStyle,
                    child: new SafeArea(
                        child: new Center(
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.spaceAround,
                                children: new List <Widget> {
         new Column(
             children: new List <Widget> {
             new CupertinoSwitch(
                 value: this._switchValue,
                 onChanged: (bool value) => {
                 this.setState(() => { this._switchValue = value; });
             }
                 ),
             new Text(
                 "Enabled - " + (this._switchValue ? "On" : "Off")
                 ),
         }
             ),
         new Column(
             children: new List <Widget> {
             new CupertinoSwitch(
                 value: true,
                 onChanged: null
                 ),
             new Text(
                 "Disabled - On"
                 ),
         }
             ),
         new Column(
             children: new List <Widget> {
             new CupertinoSwitch(
                 value: false,
                 onChanged: null
                 ),
             new Text(
                 "Disabled - Off"
                 ),
         }
             )
     }
                                )
                            )
                        )
                    )
                ));
 }
Beispiel #7
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                child: new Center(
                    child: new Text("Hello Cupertino",
                                    style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle
                                    )
                    )
                ));
 }
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    middle: new Text("Sliders"),
                    previousPageTitle: "Cupertino",
                    trailing: new CupertinoDemoDocumentationButton(CupertinoSliderDemo.routeName)
                    ),
                child: new DefaultTextStyle(
                    style: CupertinoTheme.of(context).textTheme.textStyle,
                    child: new SafeArea(
                        child: new Center(
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.spaceAround,
                                children: new List <Widget> {
         new Column(
             mainAxisSize: MainAxisSize.min,
             children: new List <Widget> {
             new CupertinoSlider(
                 value: this._value,
                 min: 0.0f,
                 max: 100.0f,
                 onChanged: (float value) => {
                 this.setState(() => { this._value = value; });
             }
                 ),
             new Text($"Cupertino Continuous: {this._value.ToString("F1")}"),
         }
             ),
         new Column(
             mainAxisSize: MainAxisSize.min,
             children: new List <Widget> {
             new CupertinoSlider(
                 value: this._discreteValue,
                 min: 0.0f,
                 max: 100.0f,
                 divisions: 5,
                 onChanged: (float value) => {
                 this.setState(() => { this._discreteValue = value; });
             }
                 ),
             new Text($"Cupertino Discrete: {this._discreteValue}"),
         }
             ),
     }
                                )
                            )
                        )
                    )
                ));
 }
Beispiel #9
0
 Widget _buildMenu(List <Widget> children)
 {
     return(new Container(
                decoration: new BoxDecoration(
                    color: CupertinoTheme.of(this.context).scaffoldBackgroundColor,
                    border: new Border(
                        top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f),
                        bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
                        )
                    ),
                height: 44.0f,
                child: new Padding(
                    padding: EdgeInsets.symmetric(horizontal: 16.0f),
                    child: new SafeArea(
                        top: false,
                        bottom: false,
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: children
                            )
                        )
                    )
                ));
 }
Beispiel #10
0
        public override Widget build(BuildContext context)
        {
            Color backgroundColor = null;
            Color foregroundColor = null;

            switch (color)
            {
            case Tab2ConversationBubbleColor.gray:
                backgroundColor = CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context);
                foregroundColor = CupertinoDynamicColor.resolve(CupertinoColors.label, context);
                break;

            case Tab2ConversationBubbleColor.blue:
                backgroundColor = CupertinoTheme.of(context).primaryColor;
                foregroundColor = CupertinoColors.white;
                break;
            }

            return(new Container(
                       decoration: new BoxDecoration(
                           borderRadius: BorderRadius.all(Radius.circular(18.0f)),
                           color: backgroundColor
                           ),
                       margin: EdgeInsets.symmetric(horizontal: 8.0f, vertical: 8.0f),
                       padding: EdgeInsets.symmetric(horizontal: 14.0f, vertical: 10.0f),
                       child: new Text(
                           text,
                           style: new TextStyle(
                               color: foregroundColor,
                               letterSpacing: -0.4f,
                               fontSize: 15.0f,
                               fontWeight: FontWeight.w400
                               )
                           )
                       ));
        }
Beispiel #11
0
        public override Widget build(BuildContext context)
        {
            base.build(context);
            D.assert(() => { return(_controller._textSpan.visitChildren((InlineSpan span) => span is TextSpan)); },
                     () => "SelectableText only supports TextSpan; Other type of InlineSpan is not allowed");
            D.assert(WidgetsD.debugCheckHasMediaQuery(context));
            D.assert(WidgetsD.debugCheckHasDirectionality(context));
            D.assert(
                !(widget.style != null && widget.style.inherit == false &&
                  (widget.style.fontSize == null || widget.style.textBaseline == null)),
                () => "inherit false style must supply fontSize and textBaseline"
                );

            ThemeData themeData = Theme.of(context);
            FocusNode focusNode = _effectiveFocusNode;

            TextSelectionControls textSelectionControls;
            bool   paintCursorAboveText;
            bool   cursorOpacityAnimates;
            Offset cursorOffset = Offset.zero;
            Color  cursorColor  = widget.cursorColor;
            Radius cursorRadius = widget.cursorRadius;

            switch (themeData.platform)
            {
            case RuntimePlatform.IPhonePlayer:
            case RuntimePlatform.OSXEditor:
            case RuntimePlatform.OSXPlayer:
                forcePressEnabled     = true;
                textSelectionControls = CupertinoTextFieldUtils.cupertinoTextSelectionControls;
                paintCursorAboveText  = true;
                cursorOpacityAnimates = true;
                cursorColor           = cursorColor ?? CupertinoTheme.of(context).primaryColor;
                cursorRadius          = cursorRadius ?? Radius.circular(2.0f);
                cursorOffset          =
                    new Offset(SelectableTextUtils.iOSHorizontalOffset / MediaQuery.of(context).devicePixelRatio,
                               0);
                break;

            default:
                forcePressEnabled     = false;
                textSelectionControls = _MaterialTextSelectionControls.materialTextSelectionControls;
                paintCursorAboveText  = false;
                cursorOpacityAnimates = false;
                cursorColor           = cursorColor ?? themeData.cursorColor;
                break;
            }

            DefaultTextStyle defaultTextStyle   = DefaultTextStyle.of(context);
            TextStyle        effectiveTextStyle = widget.style;

            if (widget.style == null || widget.style.inherit)
            {
                effectiveTextStyle = defaultTextStyle.style.merge(widget.style);
            }
            if (MediaQuery.boldTextOverride(context))
            {
                effectiveTextStyle = effectiveTextStyle.merge(new TextStyle(fontWeight: FontWeight.bold));
            }

            Widget child = new RepaintBoundary(
                child: new EditableText(
                    key: editableTextKey,
                    style: effectiveTextStyle,
                    readOnly: true,
                    textWidthBasis: widget.textWidthBasis ?? defaultTextStyle.textWidthBasis,
                    showSelectionHandles: _showSelectionHandles,
                    showCursor: widget.showCursor,
                    controller: _controller,
                    focusNode: focusNode,
                    strutStyle: widget.strutStyle ?? new StrutStyle(),
                    textAlign: widget.textAlign ?? defaultTextStyle.textAlign ?? TextAlign.start,
                    textDirection: widget.textDirection,
                    textScaleFactor: widget.textScaleFactor,
                    autofocus: widget.autofocus,
                    forceLine: false,
                    toolbarOptions: widget.toolbarOptions,
                    minLines: widget.minLines,
                    maxLines: widget.maxLines ?? defaultTextStyle.maxLines,
                    selectionColor: themeData.textSelectionColor,
                    selectionControls: widget.selectionEnabled ? textSelectionControls : null,
                    onSelectionChanged: _handleSelectionChanged,
                    onSelectionHandleTapped: _handleSelectionHandleTapped,
                    rendererIgnoresPointer: true,
                    cursorWidth: widget.cursorWidth,
                    cursorRadius: cursorRadius,
                    cursorColor: cursorColor,
                    cursorOpacityAnimates: cursorOpacityAnimates,
                    cursorOffset: cursorOffset,
                    paintCursorAboveText: paintCursorAboveText,
                    backgroundCursorColor: CupertinoColors.inactiveGray,
                    enableInteractiveSelection: widget.enableInteractiveSelection,
                    dragStartBehavior: widget.dragStartBehavior,
                    scrollPhysics: widget.scrollPhysics
                    )
                );

            return(_selectionGestureDetectorBuilder.buildGestureDetector(
                       behavior: HitTestBehavior.translucent,
                       child: child
                       ));
        }
Beispiel #12
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                color: CupertinoDynamicColor.resolve(CupertinoColors.systemBackground, context),
                height: 60.0f,
                padding: EdgeInsets.only(top: 9.0f),
                child: new Row(
                    children: new List <Widget> {
         new Container(
             width: 38.0f,
             child: called
             ? new Align(
                 alignment: Alignment.topCenter,
                 child: new Icon(
                     CupertinoIcons.phone_solid,
                     color: CupertinoColors.inactiveGray.resolveFrom(context),
                     size: 18.0f
                     )
                 )
             : null
             ),
         new Expanded(
             child: new Container(
                 decoration: new  BoxDecoration(
                     border: new Border(
                         bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
                         )
                     ),
                 padding: EdgeInsets.only(left: 1.0f, bottom: 9.0f, right: 10.0f),
                 child: new Row(
                     children: new List <Widget> {
             new Expanded(
                 child: new Column(
                     crossAxisAlignment: CrossAxisAlignment.start,
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                     children: new List <Widget> {
                 new Text(
                     name ?? "",
                     maxLines: 1,
                     overflow: TextOverflow.ellipsis,
                     style: new TextStyle(
                         fontWeight: FontWeight.w600,
                         letterSpacing: -0.18f
                         )
                     ),
                 new Text(
                     place ?? "",
                     maxLines: 1,
                     overflow: TextOverflow.ellipsis,
                     style: new TextStyle(
                         fontSize: 15.0f,
                         letterSpacing: -0.24f,
                         color: CupertinoColors.inactiveGray.resolveFrom(context)
                         )
                     ),
             }
                     )
                 ),
             new Text(
                 date ?? "",
                 style: new TextStyle(
                     color: CupertinoColors.inactiveGray.resolveFrom(context),
                     fontSize: 15.0f,
                     letterSpacing: -0.41f
                     )
                 ),
             new Padding(
                 padding: EdgeInsets.only(left: 9.0f),
                 child: new Icon(
                     CupertinoIcons.info,
                     color: CupertinoTheme.of(context).primaryColor
                     )
                 )
         }
                     )
                 )
             )
     }
                    )
                ));
 }
Beispiel #13
0
        public override Widget build(BuildContext context)
        {
            return(new CupertinoPageScaffold(
                       navigationBar: new CupertinoNavigationBar(
                           middle: new Text("Segmented Control"),
                           previousPageTitle: "Cupertino"

                           ),
                       child: new DefaultTextStyle(
                           style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 13),
                           child: new SafeArea(
                               child: new Column(
                                   children: new List <Widget> {
                new Padding(padding: EdgeInsets.all(16.0f)),
                new SizedBox(
                    width: 500.0f,
                    child: new CupertinoSegmentedControl <int>(
                        children: children,
                        onValueChanged: onValueChanged,
                        groupValue: currentSegment
                        )
                    ),
                new SizedBox(
                    width: 500,
                    child: new Padding(
                        padding: EdgeInsets.all(16.0f),
                        child: new CupertinoSlidingSegmentedControl <int>(
                            children: children,
                            onValueChanged: onValueChanged,
                            groupValue: currentSegment
                            )
                        )
                    ),
                new Expanded(
                    child:  new Padding(
                        padding: EdgeInsets.symmetric(
                            vertical: 32.0f,
                            horizontal: 16.0f
                            ),
                        child: new CupertinoUserInterfaceLevel(
                            data: CupertinoUserInterfaceLevelData.elevatedlayer,
                            child: new Builder(
                                builder: (BuildContext context1) => {
                    return new Container(
                        padding: EdgeInsets.symmetric(
                            vertical: 64.0f,
                            horizontal: 16.0f
                            ),
                        decoration:  new BoxDecoration(
                            color: CupertinoTheme.of(context1).scaffoldBackgroundColor,
                            borderRadius: BorderRadius.circular(3.0f),
                            boxShadow: new List <BoxShadow> {
                        new BoxShadow(
                            offset: new Offset(0.0f, 3.0f),
                            blurRadius: 5.0f,
                            spreadRadius: -1.0f,
                            color: _kKeyUmbraOpacity
                            ),
                        new BoxShadow(
                            offset: new Offset(0.0f, 6.0f),
                            blurRadius: 10.0f,
                            spreadRadius: 0.0f,
                            color: _kKeyPenumbraOpacity
                            ),
                        new BoxShadow(
                            offset: new Offset(0.0f, 1.0f),
                            blurRadius: 18.0f,
                            spreadRadius: 0.0f,
                            color: _kAmbientShadowOpacity
                            )
                    }
                            ),
                        child: icons[currentSegment]
                        );
                }
                                )
                            )
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #14
0
        public override Widget build(BuildContext context)
        {
            List <Widget> createWidgets(BuildContext context1)
            {
                List <Widget> widgets = new List <Widget>();

                widgets.Add(new CupertinoScrollbar(
                                child: new ListView(
                                    // Add more padding to the normal safe area.
                                    padding: EdgeInsets.symmetric(vertical: 24.0f, horizontal: 72.0f)
                                    + MediaQuery.of(context1).padding,
                                    children: new List <Widget>
                {
                    CupertinoButton.filled(
                        child: new Text("Alert"),
                        onPressed: () => _onAlertPress(context1)
                        ),
                    new Padding(padding: EdgeInsets.all(8.0f)),
                    CupertinoButton.filled(
                        child: new Text("Alert with Title"),
                        padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                        onPressed: () => _onAlertWithTitlePress(context1)
                        ),
                    new Padding(padding: EdgeInsets.all(8.0f)),
                    CupertinoButton.filled(
                        child: new Text("Alert with Buttons"),
                        padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                        onPressed: () => _onAlertWithButtonsPress(context1)
                        ),
                    new Padding(padding: EdgeInsets.all(8.0f)),
                    CupertinoButton.filled(
                        child: new Text("Alert Buttons Only"),
                        padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                        onPressed: () =>
                    {
                        showDemoDialog(
                            context: context1,
                            child: new CupertinoDessertDialog()
                            );
                    }
                        ),
                    new Padding(padding: EdgeInsets.all(8.0f)),
                    CupertinoButton.filled(
                        child: new Text("Action Sheet"),
                        padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                        onPressed: () => _onActionSheetPress(context1)
                        )
                }
                                    )
                                ));
                if (lastSelectedValue != null)
                {
                    widgets.Add(new Positioned(
                                    bottom: 32.0f,
                                    child: new Text($"You selected: {lastSelectedValue}")
                                    ));
                }
                return(widgets);
            }

            return(new CupertinoPageScaffold(
                       navigationBar:  new CupertinoNavigationBar(
                           middle: new Text("Alerts"),
                           previousPageTitle: "Cupertino"
                           //,trailing: CupertinoDemoDocumentationButton(CupertinoAlertDemo.routeName)
                           ),
                       child: new DefaultTextStyle(
                           style: CupertinoTheme.of(context).textTheme.textStyle,
                           child: new Builder(
                               builder: (BuildContext context1) => {
                return new Stack(
                    alignment: Alignment.center,
                    children: createWidgets(context1)

                    );
            }
                               )
                           )
                       ));
        }
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    middle: new Text("Buttons"),
                    previousPageTitle: "Cupertino",
                    trailing: new CupertinoDemoDocumentationButton(CupertinoButtonsDemo.routeName)
                    ),
                child: new DefaultTextStyle(
                    style: CupertinoTheme.of(context).textTheme.textStyle,
                    child: new SafeArea(
                        child: new Column(
                            children: new List <Widget> {
         new Padding(
             padding: EdgeInsets.all(16.0f),
             child: new Text(
                 "iOS themed buttons are flat. They can have borders or backgrounds but only when necessary."
                 )
             ),
         new Expanded(
             child: new Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: new List <Widget> {
             new Text(this._pressedCount > 0
                                         ? $"Button pressed {this._pressedCount} time" +
                      (this._pressedCount == 1 ? "" : "s")
                                         : " "),
             new Padding(padding: EdgeInsets.all(12.0f)),
             new Align(
                 alignment: new Alignment(0.0f, -0.2f),
                 child:
                 new Row(
                     mainAxisSize: MainAxisSize.min,
                     children: new List <Widget> {
                 new CupertinoButton(
                     child: new Text("Cupertino Button"),
                     onPressed:
                     () => { this.setState(() => { this._pressedCount += 1; }); }
                     ),
                 new CupertinoButton(
                     child: new Text("Disabled"),
                     onPressed: null
                     )
             }
                     )
                 ),
             new Padding(padding: EdgeInsets.all(12.0f)),
             CupertinoButton.filled(
                 child: new Text("With Background"),
                 onPressed:
                 () => { this.setState(() => { this._pressedCount += 1; }); }
                 ),
             new Padding(padding: EdgeInsets.all(12.0f)),
             CupertinoButton.filled(
                 child: new Text("Disabled"),
                 onPressed: null
                 ),
         }
                 )
             )
     }
                            )
                        )
                    )
                ));
 }
        public override Widget build(BuildContext context)
        {
            return(new CupertinoPageScaffold(
                       navigationBar: new CupertinoNavigationBar(
                           middle: new Text("Alerts"),
                           previousPageTitle: "Cupertino",
                           trailing: new CupertinoDemoDocumentationButton(CupertinoAlertDemo.routeName)
                           ),
                       child:
                       new DefaultTextStyle(
                           style: CupertinoTheme.of(context).textTheme.textStyle,
                           child: new Builder(
                               builder: (BuildContext _context) => {
                List <Widget> stackChildren = new List <Widget> {
                    new ListView(
                        padding: EdgeInsets.symmetric(vertical: 24.0f, horizontal: 72.0f)
                        + MediaQuery.of(_context).padding,
                        children: new List <Widget> {
                        CupertinoButton.filled(
                            child: new Text("Alert"),
                            onPressed: () => {
                            this.showDemoDialog(
                                context: _context,
                                child:
                                new CupertinoAlertDialog(
                                    title: new Text("Discard draft?"),
                                    actions: new List <Widget> {
                                new CupertinoDialogAction(
                                    child: new Text("Discard"),
                                    isDestructiveAction: true,
                                    onPressed: () => { Navigator.pop(_context, "Discard"); }
                                    ),
                                new CupertinoDialogAction(
                                    child: new Text("Cancel"),
                                    isDefaultAction: true,
                                    onPressed: () => { Navigator.pop(_context, "Cancel"); }
                                    ),
                            }
                                    )
                                );
                        }
                            ),
                        new Padding(padding: EdgeInsets.all(8.0f)),
                        CupertinoButton.filled(
                            child: new Text("Alert with Title"),
                            padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                            onPressed: () => {
                            this.showDemoDialog(
                                context: _context,
                                child: new CupertinoAlertDialog(
                                    title: new Text(
                                        "Allow \"Maps\" to access your location while you are using the app?")
                                    ,
                                    content: new Text(
                                        "Your current location will be displayed on the map and used \n" +
                                        "for directions, nearby search results, and estimated travel times.")
                                    ,
                                    actions: new List <Widget> {
                                new CupertinoDialogAction(
                                    child: new Text("Don\"t Allow"),
                                    onPressed: () => {
                                    Navigator.pop(_context, "Disallow");
                                }
                                    ),
                                new CupertinoDialogAction(
                                    child: new Text("Allow"),
                                    onPressed: () => { Navigator.pop(_context, "Allow"); }
                                    ),
                            }
                                    )
                                );
                        }
                            ),
                        new Padding(padding: EdgeInsets.all(8.0f)),
                        CupertinoButton.filled(
                            child: new Text("Alert with Buttons"),
                            padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                            onPressed: () => {
                            this.showDemoDialog(
                                context: _context,
                                child: new CupertinoDessertDialog(
                                    title: new Text("Select Favorite Dessert"),
                                    content: new Text(
                                        "Please select your favorite type of dessert from the \n" +
                                        "list below. Your selection will be used to customize the suggested \n" +
                                        "list of eateries in your area.")
                                    )
                                );
                        }
                            ),
                        new Padding(padding: EdgeInsets.all(8.0f)),
                        CupertinoButton.filled(
                            child: new Text("Alert Buttons Only"),
                            padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                            onPressed: () => {
                            this.showDemoDialog(
                                context: _context,
                                child: new CupertinoDessertDialog()
                                );
                        }
                            ),
                        // TODO: FIX BUG
                        new Padding(padding: EdgeInsets.all(8.0f)),
                        CupertinoButton.filled(
                            child: new Text("Action Sheet"),
                            padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
                            onPressed: () => {
                            this.showDemoActionSheet(
                                context: _context,
                                child: new CupertinoActionSheet(
                                    title: new Text("Favorite Dessert"),
                                    message: new Text(
                                        "Please select the best dessert from the options below."),
                                    actions: new List <Widget> {
                                new CupertinoActionSheetAction(
                                    child: new Text("Profiteroles"),
                                    onPressed: () => {
                                    Navigator.pop(_context, "Profiteroles");
                                }
                                    ),
                                new CupertinoActionSheetAction(
                                    child: new Text("Cannolis"),
                                    onPressed: () => {
                                    Navigator.pop(_context, "Cannolis");
                                }
                                    ),
                                new CupertinoActionSheetAction(
                                    child: new Text("Trifle"),
                                    onPressed: () => { Navigator.pop(_context, "Trifle"); }
                                    )
                            },
                                    cancelButton: new CupertinoActionSheetAction(
                                        child: new Text("Cancel"),
                                        isDefaultAction: true,
                                        onPressed: () => { Navigator.pop(_context, "Cancel"); }
                                        )
                                    )
                                );
                        }
                            )
                    }
                        )
                };

                if (this.lastSelectedValue != null)
                {
                    stackChildren.Add(
                        new Positioned(
                            bottom: 32.0f,
                            child: new Text($"You selected: {this.lastSelectedValue}")
                            )
                        );
                }

                return new Stack(
                    alignment: Alignment.center,
                    children: stackChildren
                    );
            }
                               )
                           )
                       ));
        }