mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
parent
0734edbeb0
commit
c7369a40ac
@ -19,11 +19,11 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_showBottomSheetCallback = showBottomSheet;
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
}
|
||||
|
||||
|
||||
void showBottomSheet() {
|
||||
void _showBottomSheet() {
|
||||
setState(() { // disable the button
|
||||
_showBottomSheetCallback = null;
|
||||
});
|
||||
@ -47,18 +47,33 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
||||
})
|
||||
.closed.then((_) {
|
||||
setState(() { // re-enable the button
|
||||
_showBottomSheetCallback = showBottomSheet;
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void _showMessage() {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: new Dialog(
|
||||
content: new Text('You tapped the floating action button.'),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
onPressed: () { Navigator.of(context).pop(); },
|
||||
child: new Text('OK')
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: new AppBar(title: new Text('Persistent bottom sheet')),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
onPressed: null,
|
||||
onPressed: _showMessage,
|
||||
backgroundColor: Colors.redAccent[200],
|
||||
child: new Icon(Icons.add)
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user