Automatically fill in the menu button when there's a drawer

Also, fill in a back arrow when we can go back.

Fixes #699
This commit is contained in:
Adam Barth
2015-12-03 16:18:12 -08:00
parent 5ad32f2987
commit e17c3eccf6
11 changed files with 56 additions and 53 deletions

View File

@@ -36,9 +36,8 @@ class Field extends StatelessComponent {
class AddressBookHome extends StatelessComponent {
Widget buildToolBar(BuildContext context) {
return new ToolBar(
left: new IconButton(icon: "navigation/arrow_back"),
right: <Widget>[new IconButton(icon: "navigation/check")]
);
right: <Widget>[new IconButton(icon: "navigation/check")]
);
}
Widget buildFloatingActionButton(BuildContext context) {

View File

@@ -55,7 +55,6 @@ class FeedFragment extends StatefulComponent {
class FeedFragmentState extends State<FeedFragment> {
FitnessMode _fitnessMode = FitnessMode.feed;
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
void _handleFitnessModeChange(FitnessMode value) {
setState(() {
@@ -104,9 +103,6 @@ class FeedFragmentState extends State<FeedFragment> {
Widget buildToolBar() {
return new ToolBar(
left: new IconButton(
icon: "navigation/menu",
onPressed: () => _scaffoldKey.currentState?.openDrawer()),
center: new Text(fitnessModeTitle)
);
}
@@ -207,7 +203,6 @@ class FeedFragmentState extends State<FeedFragment> {
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,
toolBar: buildToolBar(),
body: buildBody(),
floatingActionButton: buildFloatingActionButton(),

View File

@@ -26,10 +26,6 @@ class SettingsFragmentState extends State<SettingsFragment> {
Widget buildToolBar() {
return new ToolBar(
left: new IconButton(
icon: "navigation/arrow_back",
onPressed: () => Navigator.pop(context)
),
center: new Text('Settings')
);
}

View File

@@ -17,8 +17,6 @@ class GalleryPage extends StatefulComponent {
}
class _GalleryPageState extends State<GalleryPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
Widget _buildDrawer() {
List<Widget> items = <Widget>[
new DrawerHeader(child: new Text('Material demos')),
@@ -53,12 +51,7 @@ class _GalleryPageState extends State<GalleryPage> {
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,
toolBar: new ToolBar(
left: new IconButton(
icon: 'navigation/menu',
onPressed: () { _scaffoldKey.currentState?.openDrawer(); }
),
center: new Text(config.active?.title ?? 'Material gallery'),
tabBar: _buildTabBar()
),

View File

@@ -147,10 +147,6 @@ class StockHomeState extends State<StockHome> {
Widget buildToolBar() {
return new ToolBar(
elevation: 0,
left: new IconButton(
icon: "navigation/menu",
onPressed: () => _scaffoldKey.currentState?.openDrawer()
),
center: new Text('Stocks'),
right: <Widget>[
new IconButton(
@@ -230,7 +226,7 @@ class StockHomeState extends State<StockHome> {
Widget buildSearchBar() {
return new ToolBar(
left: new IconButton(
icon: "navigation/arrow_back",
icon: 'navigation/arrow_back',
colorFilter: new ColorFilter.mode(Theme.of(context).accentColor, ui.TransferMode.srcATop),
onPressed: _handleSearchEnd
),

View File

@@ -70,10 +70,6 @@ class StockSettingsState extends State<StockSettings> {
Widget buildToolBar(BuildContext context) {
return new ToolBar(
left: new IconButton(
icon: 'navigation/arrow_back',
onPressed: () => Navigator.pop(context)
),
center: new Text('Settings')
);
}

View File

@@ -55,12 +55,6 @@ class StockSymbolPage extends StatelessComponent {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(
left: new IconButton(
icon: 'navigation/arrow_back',
onPressed: () {
Navigator.pop(context);
}
),
center: new Text(stock.name)
),
body: new Block(<Widget>[

View File

@@ -46,8 +46,6 @@ class CardCollectionState extends State<CardCollection> {
InvalidatorCallback _invalidator;
Size _cardCollectionSize = new Size(200.0, 200.0);
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
void _initVariableSizedCardModels() {
List<double> cardHeights = <double>[
48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
@@ -268,7 +266,6 @@ class CardCollectionState extends State<CardCollection> {
Widget _buildToolBar() {
return new ToolBar(
left: new IconButton(icon: "navigation/menu", onPressed: () => _scaffoldKey.currentState?.openDrawer()),
right: <Widget>[
new Text(_dismissDirectionText(_dismissDirection))
],

View File

@@ -41,8 +41,6 @@ class PageableListAppState extends State<PageableListApp> {
ScrollDirection scrollDirection = ScrollDirection.horizontal;
bool itemsWrap = false;
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
void updatePageSize(Size newSize) {
setState(() {
pageSize = newSize;
@@ -114,7 +112,6 @@ class PageableListAppState extends State<PageableListApp> {
Widget _buildToolBar() {
return new ToolBar(
left: new IconButton(icon: "navigation/menu", onPressed: () => _scaffoldKey.currentState?.openDrawer()),
center: new Text('PageableList'),
right: <Widget>[
new Text(scrollDirection == ScrollDirection.horizontal ? "horizontal" : "vertical")