Created
May 31, 2021 15:06
-
-
Save matuella/6b57991e4c09a7116a033bca79542476 to your computer and use it in GitHub Desktop.
`Scaffold.bottomSheet` issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(BottomSheetApp()); | |
class BottomSheetApp extends StatefulWidget { | |
@override | |
_BottomSheetAppState createState() => _BottomSheetAppState(); | |
} | |
class _BottomSheetAppState extends State<BottomSheetApp> { | |
bool showsSheet = false; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Center( | |
child: ElevatedButton( | |
child: Text('Toggle sheet'), | |
onPressed: () => setState(() => showsSheet = !showsSheet), | |
), | |
), | |
bottomSheet: showsSheet ? Container(color: Colors.blue) : null, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment