Created
June 6, 2019 15:54
-
-
Save Andrious/367472f0431ac02b4827ca93aa0f3f35 to your computer and use it in GitHub Desktop.
Introduces the BottomAppBar widget
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/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) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Sample Code'), | |
), | |
body: Center( | |
child: Text('You have pressed the button $_count times.'), | |
), | |
bottomNavigationBar: BottomAppBar( | |
shape: CircularNotchedRectangle(), | |
notchMargin: 4.0, | |
child: Row( | |
mainAxisSize: MainAxisSize.max, | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.menu), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.search), | |
onPressed: () {}, | |
), | |
], | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () => setState(() { | |
_count++; | |
}), | |
tooltip: 'Increment Counter', | |
child: Icon(Icons.add), | |
), | |
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment