Skip to content

Instantly share code, notes, and snippets.

@silverAndroid
Created December 9, 2017 18:35
Show Gist options
  • Select an option

  • Save silverAndroid/eb40f5faaa2d8a0296baf2f9c337ec2b to your computer and use it in GitHub Desktop.

Select an option

Save silverAndroid/eb40f5faaa2d8a0296baf2f9c337ec2b to your computer and use it in GitHub Desktop.
Code with bottom nav that gets pushed up by the keyboard
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
'You have pushed the button this many times:',
),
new TextField(),
],
),
),
bottomNavigationBar: new BottomNavigationBar(
items: [
new BottomNavigationBarItem(
icon: new Icon(Icons.search),
title: new Text('Search'),
),
new BottomNavigationBarItem(
icon: new Icon(Icons.star),
title: new Text('Favourites'),
),
],
),
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment