Created
October 8, 2019 16:38
-
-
Save stargazing-dino/4ae16f93dfe5d54195969a21b272f868 to your computer and use it in GitHub Desktop.
Flutter Issue
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'; | |
/// This is possibly an issue with the flutter framework where | |
/// when returning a container for FAB, it won't show a | |
/// floating snackbar but it will show a fixed one | |
class FloatingIssue extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
floatingActionButton: Container(), | |
body: Builder( | |
builder: (context) { | |
return Center( | |
child: FlatButton( | |
child: Text('Click me'), | |
onPressed: () { | |
Scaffold.of(context).showSnackBar( | |
SnackBar( | |
content: Text('hi'), | |
behavior: SnackBarBehavior.floating, | |
), | |
); | |
}, | |
), | |
); | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment