Skip to content

Instantly share code, notes, and snippets.

@ayoubm
Created March 8, 2021 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayoubm/99a72bae479a1f84bb70804f416de017 to your computer and use it in GitHub Desktop.
Save ayoubm/99a72bae479a1f84bb70804f416de017 to your computer and use it in GitHub Desktop.
Flutter BottomSheet
class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
bool showFab = true;
@override
Widget build(BuildContext context) {
return showFab
? FloatingActionButton(
onPressed: () {
var bottomSheetController = showBottomSheet(
context: context,
builder: (context) => Container(
color: Colors.grey[900],
height: 250,
));
showFoatingActionButton(false);
bottomSheetController.closed.then((value) {
showFoatingActionButton(true);
});
},
)
: Container();
}
void showFoatingActionButton(bool value) {
setState(() {
showFab = value;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment