Exemplo n.º 1
0
        private void _showConfigurationSheet()
        {
            setState(() =>
            {
                _bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) =>
                {
                    return(new DecoratedBox(
                               decoration: new BoxDecoration(
                                   border: new Border(top: new BorderSide(color: Colors.black26))
                                   ),
                               child: new ListView(
                                   shrinkWrap: true,
                                   primary: false,
                                   children: new List <Widget>
                    {
                        new CheckboxListTile(
                            dense: true,
                            title: new Text("Reverse"),
                            value: _reverse,
                            onChanged: changeReverse
                            ),
                        new RadioListTile <_ReorderableListType>(
                            dense: true,
                            title: new Text("Horizontal Avatars"),
                            value: _ReorderableListType.horizontalAvatar,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            ),
                        new RadioListTile <_ReorderableListType>(
                            dense: true,
                            title: new Text("Vertical Avatars"),
                            value: _ReorderableListType.verticalAvatar,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            ),
                        new RadioListTile <_ReorderableListType>(
                            dense: true,
                            title: new Text("Three-line"),
                            value: _ReorderableListType.threeLine,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            )
                    }
                                   )
                               ));
                });

                // Garbage collect the bottom sheet when it closes.
                _bottomSheet.closed.whenComplete(() =>
                {
                    if (mounted)
                    {
                        setState(() => { _bottomSheet = null; });
                    }
                });
            });
        }
Exemplo n.º 2
0
        private void _showConfigurationSheet()
        {
            PersistentBottomSheetController <object> bottomSheet = scaffoldKey.currentState.showBottomSheet(
                (BuildContext bottomSheetContext) =>
            {
                return(new Container(
                           decoration: new BoxDecoration(
                               border: new Border(top: new BorderSide(color: Colors.black26))
                               ),
                           child: new ListView(
                               shrinkWrap: true,
                               primary: false,
                               children: new List <Widget>
                {
                    new ListTile(
                        dense: true,
                        title: new Text("One-line"),
                        trailing: new Radio <_MaterialListType>(
                            value: _showAvatars
                                            ? _MaterialListType.oneLineWithAvatar
                                            : _MaterialListType.oneLine,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Two-line"),
                        trailing: new Radio <_MaterialListType>(
                            value: _MaterialListType.twoLine,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Three-line"),
                        trailing: new Radio <_MaterialListType>(
                            value: _MaterialListType.threeLine,
                            groupValue: _itemType,
                            onChanged: changeItemType
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Show avatar"),
                        trailing: new Checkbox(
                            value: _showAvatars,
                            onChanged: (bool?value) =>
                    {
                        setState(() => { _showAvatars = value.Value; });
                        _bottomSheet?.setState(() => { });
                    }
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Show icon"),
                        trailing: new Checkbox(
                            value: _showIcons,
                            onChanged: (bool?value) =>
                    {
                        setState(() => { _showIcons = value.Value; });
                        _bottomSheet?.setState(() => { });
                    }
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Show dividers"),
                        trailing: new Checkbox(
                            value: _showDividers,
                            onChanged: (bool?value) =>
                    {
                        setState(() => { _showDividers = value.Value; });
                        _bottomSheet?.setState(() => { });
                    }
                            )
                        ),
                    new ListTile(
                        dense: true,
                        title: new Text("Dense layout"),
                        trailing: new Checkbox(
                            value: _dense,
                            onChanged: (bool?value) =>
                    {
                        setState(() => { _dense = value.Value; });
                        _bottomSheet?.setState(() => { });
                    }
                            )
                        )
                }
                               )
                           ));
            });

            setState(() => { _bottomSheet = bottomSheet; });

            _bottomSheet.closed.whenComplete(() =>
            {
                if (mounted)
                {
                    setState(() => { _bottomSheet = null; });
                }
            });
        }