Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Andrious
Created June 6, 2019 16:37
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 Andrious/54ec301ba2060925f5c04c5f458ac096 to your computer and use it in GitHub Desktop.
Save Andrious/54ec301ba2060925f5c04c5f458ac096 to your computer and use it in GitHub Desktop.
A Text field will 'hide' the so-called persistent FooterButtons
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
State createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _count = 0;
@override
Widget build(BuildContext context) {
final title = 'Floating App Bar';
return MaterialApp(
debugShowCheckedModeBanner: false,
title: title,
home: Scaffold(
appBar: AppBar(
title: Text('Sample Code'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('You have pressed the button $_count times.'),
TextField(
decoration: InputDecoration(
hintText: 'Text field to type anything',
),
),
],
)),
bottomNavigationBar: BottomAppBar(
child: Container(
height: 50.0,
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => setState(() {
_count++;
}),
tooltip: 'Increment Counter',
child: Icon(Icons.add),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
persistentFooterButtons: <Widget>[
IconButton(icon: Icon(Icons.insert_emoticon), onPressed: () {}),
IconButton(icon: Icon(Icons.mood), onPressed: () {}),
IconButton(icon: Icon(Icons.mood_bad), onPressed: () {}),
IconButton(
icon: Icon(Icons.sentiment_dissatisfied), onPressed: () {}),
IconButton(icon: Icon(Icons.sentiment_neutral), onPressed: () {}),
IconButton(icon: Icon(Icons.sentiment_satisfied), onPressed: () {}),
IconButton(
icon: Icon(Icons.sentiment_very_dissatisfied), onPressed: () {}),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment