Skip to content

Instantly share code, notes, and snippets.

@stargazing-dino
Created October 8, 2019 16:38
Show Gist options
  • Save stargazing-dino/4ae16f93dfe5d54195969a21b272f868 to your computer and use it in GitHub Desktop.
Save stargazing-dino/4ae16f93dfe5d54195969a21b272f868 to your computer and use it in GitHub Desktop.
Flutter Issue
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