From ede5dfce30efd81fe52a95b14bc7a7c696a4cb10 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 12 Mar 2016 17:22:40 -0800 Subject: [PATCH] [rename fixit] ToolBar -> AppBar * left -> leading (Removes an LTR bias) * center -> title (Widget was actually centered) * right -> actions (Removes an LTR bias, asymmetric with leading) Fixes #2348 --- dev/manual_tests/card_collection.dart | 8 +- dev/manual_tests/drag_and_drop.dart | 4 +- dev/manual_tests/overlay_geometry.dart | 2 +- dev/manual_tests/pageable_list.dart | 10 +-- dev/manual_tests/raw_keyboard.dart | 4 +- examples/layers/widgets/gestures.dart | 4 +- examples/layers/widgets/media_query.dart | 4 +- examples/layers/widgets/sectors.dart | 4 +- examples/layers/widgets/styled_text.dart | 4 +- .../lib/demo/buttons_demo.dart | 4 +- .../material_gallery/lib/demo/cards_demo.dart | 4 +- .../material_gallery/lib/demo/chip_demo.dart | 2 +- .../lib/demo/colors_demo.dart | 4 +- .../lib/demo/date_picker_demo.dart | 2 +- .../lib/demo/dialog_demo.dart | 4 +- .../lib/demo/drop_down_demo.dart | 2 +- .../lib/demo/fitness_demo.dart | 4 +- .../lib/demo/flexible_space_demo.dart | 4 +- .../lib/demo/full_screen_dialog_demo.dart | 8 +- .../lib/demo/grid_list_demo.dart | 10 +-- .../material_gallery/lib/demo/icons_demo.dart | 4 +- .../lib/demo/leave_behind_demo.dart | 6 +- .../material_gallery/lib/demo/list_demo.dart | 6 +- .../material_gallery/lib/demo/menu_demo.dart | 10 +-- .../lib/demo/modal_bottom_sheet_demo.dart | 2 +- .../lib/demo/page_selector_demo.dart | 2 +- .../demo/persistent_bottom_sheet_demo.dart | 2 +- .../lib/demo/progress_indicator_demo.dart | 2 +- .../lib/demo/scrolling_techniques_demo.dart | 12 +-- .../lib/demo/slider_demo.dart | 2 +- .../lib/demo/snack_bar_demo.dart | 4 +- .../material_gallery/lib/demo/tabs_demo.dart | 4 +- .../lib/demo/tabs_fab_demo.dart | 4 +- .../lib/demo/text_field_demo.dart | 4 +- .../lib/demo/time_picker_demo.dart | 2 +- .../lib/demo/toggle_controls_demo.dart | 2 +- .../lib/demo/tooltip_demo.dart | 4 +- .../lib/demo/two_level_list_demo.dart | 2 +- .../lib/demo/typography_demo.dart | 2 +- .../lib/demo/weather_demo.dart | 8 +- .../material_gallery/lib/gallery/home.dart | 2 +- .../material_gallery/lib/gallery/section.dart | 2 +- examples/stocks/lib/stock_home.dart | 16 ++-- examples/stocks/lib/stock_settings.dart | 8 +- examples/stocks/lib/stock_symbol_viewer.dart | 4 +- packages/flutter/lib/material.dart | 2 +- .../material/{tool_bar.dart => app_bar.dart} | 38 ++++----- .../flutter/lib/src/material/constants.dart | 4 +- .../lib/src/material/flexible_space_bar.dart | 4 +- .../flutter/lib/src/material/scaffold.dart | 78 +++++++++---------- packages/flutter_markdown/example/demo.dart | 2 +- .../templates/create/lib/main.dart.tmpl | 4 +- 52 files changed, 170 insertions(+), 170 deletions(-) rename packages/flutter/lib/src/material/{tool_bar.dart => app_bar.dart} (87%) diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart index c384317a83..4550cbb741 100644 --- a/dev/manual_tests/card_collection.dart +++ b/dev/manual_tests/card_collection.dart @@ -272,9 +272,9 @@ class CardCollectionState extends State { ); } - Widget _buildToolBar(BuildContext context) { - return new ToolBar( - right: [ + Widget _buildAppBar(BuildContext context) { + return new AppBar( + actions: [ new Text(_dismissDirectionText(_dismissDirection)) ], flexibleSpace: (_) { @@ -451,7 +451,7 @@ class CardCollectionState extends State { primarySwatch: _primaryColor ), child: new Scaffold( - toolBar: _buildToolBar(context), + appBar: _buildAppBar(context), drawer: _buildDrawer(), body: body ) diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart index 58daccc841..16326832e8 100644 --- a/dev/manual_tests/drag_and_drop.dart +++ b/dev/manual_tests/drag_and_drop.dart @@ -223,8 +223,8 @@ class DragAndDropAppState extends State { } Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Drag and Drop Flutter Demo') + appBar: new AppBar( + title: new Text('Drag and Drop Flutter Demo') ), body: new Column( children: [ diff --git a/dev/manual_tests/overlay_geometry.dart b/dev/manual_tests/overlay_geometry.dart index f22472b8c2..566f8e55aa 100644 --- a/dev/manual_tests/overlay_geometry.dart +++ b/dev/manual_tests/overlay_geometry.dart @@ -154,7 +154,7 @@ class OverlayGeometryAppState extends State { Widget build(BuildContext context) { List layers = [ new Scaffold( - toolBar: new ToolBar(center: new Text('Tap a Card')), + appBar: new AppBar(title: new Text('Tap a Card')), body: new Container( padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), child: new ScrollableMixedWidgetList( diff --git a/dev/manual_tests/pageable_list.dart b/dev/manual_tests/pageable_list.dart index 9dbf328d8e..d13eaca5a1 100644 --- a/dev/manual_tests/pageable_list.dart +++ b/dev/manual_tests/pageable_list.dart @@ -105,10 +105,10 @@ class PageableListAppState extends State { ); } - Widget _buildToolBar() { - return new ToolBar( - center: new Text('PageableList'), - right: [ + Widget _buildAppBar() { + return new AppBar( + title: new Text('PageableList'), + actions: [ new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical") ] ); @@ -126,7 +126,7 @@ class PageableListAppState extends State { return new IconTheme( data: const IconThemeData(color: Colors.white), child: new Scaffold( - toolBar: _buildToolBar(), + appBar: _buildAppBar(), drawer: _buildDrawer(), body: _buildBody(context) ) diff --git a/dev/manual_tests/raw_keyboard.dart b/dev/manual_tests/raw_keyboard.dart index ea82ce16ab..c704658053 100644 --- a/dev/manual_tests/raw_keyboard.dart +++ b/dev/manual_tests/raw_keyboard.dart @@ -15,8 +15,8 @@ void main() { routes: { '/': (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text("Hardware Key Demo") + appBar: new AppBar( + title: new Text("Hardware Key Demo") ), body: new Material( child: new RawKeyboardDemo( diff --git a/examples/layers/widgets/gestures.dart b/examples/layers/widgets/gestures.dart index afd6301972..28668adf80 100644 --- a/examples/layers/widgets/gestures.dart +++ b/examples/layers/widgets/gestures.dart @@ -217,8 +217,8 @@ void main() { routes: { '/': (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Gestures Demo')), + appBar: new AppBar( + title: new Text('Gestures Demo')), body: new GestureDemo() ); } diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart index 9b4c9b4f0f..20120d0e78 100644 --- a/examples/layers/widgets/media_query.dart +++ b/examples/layers/widgets/media_query.dart @@ -100,8 +100,8 @@ void main() { routes: { '/': (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Media Query Example') + appBar: new AppBar( + title: new Text('Media Query Example') ), body: new Material(child: new AdaptiveContainer(names: _kNames)) ); diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart index e368a4f56e..0a3f7bf765 100644 --- a/examples/layers/widgets/sectors.dart +++ b/examples/layers/widgets/sectors.dart @@ -154,8 +154,8 @@ class SectorAppState extends State { routes: { '/': (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Sector Layout in a Widget Tree') + appBar: new AppBar( + title: new Text('Sector Layout in a Widget Tree') ), body: buildBody() ); diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart index 93ac0eb075..3a14d7e041 100644 --- a/examples/layers/widgets/styled_text.dart +++ b/examples/layers/widgets/styled_text.dart @@ -121,8 +121,8 @@ void main() { routes: { '/': (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Hal and Dave')), + appBar: new AppBar( + title: new Text('Hal and Dave')), body: new Material( color: Colors.grey[50], child: new StyledTextDemo() diff --git a/examples/material_gallery/lib/demo/buttons_demo.dart b/examples/material_gallery/lib/demo/buttons_demo.dart index 4fb92b2895..dd9c9f1932 100644 --- a/examples/material_gallery/lib/demo/buttons_demo.dart +++ b/examples/material_gallery/lib/demo/buttons_demo.dart @@ -196,8 +196,8 @@ class _ButtonsDemoState extends State { return new TabBarSelection<_ButtonDemo>( values: demos, child: new Scaffold( - toolBar: new ToolBar( - center: new Text("Buttons"), + appBar: new AppBar( + title: new Text("Buttons"), tabBar: new TabBar<_ButtonDemo>( isScrollable: true, labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel) diff --git a/examples/material_gallery/lib/demo/cards_demo.dart b/examples/material_gallery/lib/demo/cards_demo.dart index c8e8911e9b..722dddd4b3 100644 --- a/examples/material_gallery/lib/demo/cards_demo.dart +++ b/examples/material_gallery/lib/demo/cards_demo.dart @@ -117,8 +117,8 @@ class TravelDestinationItem extends StatelessWidget { class CardsDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text("Travel Stream") + appBar: new AppBar( + title: new Text("Travel Stream") ), body: new Block( padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0), diff --git a/examples/material_gallery/lib/demo/chip_demo.dart b/examples/material_gallery/lib/demo/chip_demo.dart index e6cf5a4455..2c1f331282 100644 --- a/examples/material_gallery/lib/demo/chip_demo.dart +++ b/examples/material_gallery/lib/demo/chip_demo.dart @@ -36,7 +36,7 @@ class _ChipDemoState extends State { } return new Scaffold( - toolBar: new ToolBar(center: new Text("Chips")), + appBar: new AppBar(title: new Text("Chips")), body: new Block( children: chips.map((Widget widget) { return new Container( diff --git a/examples/material_gallery/lib/demo/colors_demo.dart b/examples/material_gallery/lib/demo/colors_demo.dart index e34ce9dc77..342806ef7f 100644 --- a/examples/material_gallery/lib/demo/colors_demo.dart +++ b/examples/material_gallery/lib/demo/colors_demo.dart @@ -111,9 +111,9 @@ class ColorsDemo extends StatelessWidget { return new TabBarSelection( values: colorSwatches, child: new Scaffold( - toolBar: new ToolBar( + appBar: new AppBar( elevation: 0, - center: new Text("Colors"), + title: new Text("Colors"), tabBar: new TabBar( isScrollable: true, labels: new Map.fromIterable(colorSwatches, value: (ColorSwatch swatch) { diff --git a/examples/material_gallery/lib/demo/date_picker_demo.dart b/examples/material_gallery/lib/demo/date_picker_demo.dart index 794c833cd0..6bab652a70 100644 --- a/examples/material_gallery/lib/demo/date_picker_demo.dart +++ b/examples/material_gallery/lib/demo/date_picker_demo.dart @@ -31,7 +31,7 @@ class _DatePickerDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Date Picker")), + appBar: new AppBar(title: new Text("Date Picker")), body: new Column( children: [ new Text(new DateFormat.yMMMd().format(_selectedDate)), diff --git a/examples/material_gallery/lib/demo/dialog_demo.dart b/examples/material_gallery/lib/demo/dialog_demo.dart index 9a2540a0fb..e30aef11d5 100644 --- a/examples/material_gallery/lib/demo/dialog_demo.dart +++ b/examples/material_gallery/lib/demo/dialog_demo.dart @@ -80,8 +80,8 @@ class DialogDemoState extends State { return new Scaffold( key: scaffoldKey, - toolBar: new ToolBar( - center: new Text('Dialogs') + appBar: new AppBar( + title: new Text('Dialogs') ), body: new Block( padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), diff --git a/examples/material_gallery/lib/demo/drop_down_demo.dart b/examples/material_gallery/lib/demo/drop_down_demo.dart index 55afe0d92c..91e017979d 100644 --- a/examples/material_gallery/lib/demo/drop_down_demo.dart +++ b/examples/material_gallery/lib/demo/drop_down_demo.dart @@ -20,7 +20,7 @@ class _DropDownDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Dropdown Button")), + appBar: new AppBar(title: new Text("Dropdown Button")), body: new Center( child: new DropDownButton( items: buildItems(), diff --git a/examples/material_gallery/lib/demo/fitness_demo.dart b/examples/material_gallery/lib/demo/fitness_demo.dart index 355e2a9604..91df6b0e98 100644 --- a/examples/material_gallery/lib/demo/fitness_demo.dart +++ b/examples/material_gallery/lib/demo/fitness_demo.dart @@ -18,8 +18,8 @@ class FitnessDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text("Fitness") + appBar: new AppBar( + title: new Text("Fitness") ), body: new _FitnessDemoContents() ); diff --git a/examples/material_gallery/lib/demo/flexible_space_demo.dart b/examples/material_gallery/lib/demo/flexible_space_demo.dart index e17502ffe8..c0719f63dc 100644 --- a/examples/material_gallery/lib/demo/flexible_space_demo.dart +++ b/examples/material_gallery/lib/demo/flexible_space_demo.dart @@ -85,8 +85,8 @@ class FlexibleSpaceDemoState extends State { appBarHeight: appBarHeight, scrollableKey: scrollableKey, appBarBehavior: AppBarBehavior.scroll, - toolBar: new ToolBar( - right: [ + appBar: new AppBar( + actions: [ new IconButton( icon: Icons.create, tooltip: 'Search' diff --git a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart index 3f7d3e652a..f6cf882ef7 100644 --- a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart +++ b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart @@ -141,13 +141,13 @@ class FullScreenDialogDemoState extends State { final ThemeData theme = Theme.of(context); return new Scaffold( - toolBar: new ToolBar( - left: new IconButton( + appBar: new AppBar( + leading: new IconButton( icon: Icons.clear, onPressed: () { handleDismissButton(context); } ), - center: new Text('New Event'), - right: [ + title: new Text('New Event'), + actions: [ new FlatButton( child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)), onPressed: () { diff --git a/examples/material_gallery/lib/demo/grid_list_demo.dart b/examples/material_gallery/lib/demo/grid_list_demo.dart index 834735bf4d..e36cf787cd 100644 --- a/examples/material_gallery/lib/demo/grid_list_demo.dart +++ b/examples/material_gallery/lib/demo/grid_list_demo.dart @@ -41,8 +41,8 @@ class GridDemoPhotoItem extends StatelessWidget { Navigator.push(context, new MaterialPageRoute( builder: (BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text(photo.title) + appBar: new AppBar( + title: new Text(photo.title) ), body: new Material( child: new AssetImage( @@ -172,9 +172,9 @@ class GridListDemoState extends State { Widget build(BuildContext context) { final Orientation orientation = MediaQuery.of(context).orientation; return new Scaffold( - toolBar: new ToolBar( - center: new Text('Grid List'), - right: [ + appBar: new AppBar( + title: new Text('Grid List'), + actions: [ new IconButton( icon: Icons.more_vert, onPressed: () { showTileStyleMenu(context); }, diff --git a/examples/material_gallery/lib/demo/icons_demo.dart b/examples/material_gallery/lib/demo/icons_demo.dart index a46d6711fd..f7b9086f81 100644 --- a/examples/material_gallery/lib/demo/icons_demo.dart +++ b/examples/material_gallery/lib/demo/icons_demo.dart @@ -66,8 +66,8 @@ class IconsDemoState extends State { final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); return new Scaffold( - toolBar: new ToolBar( - center: new Text('Icons') + appBar: new AppBar( + title: new Text('Icons') ), body: new IconTheme( data: new IconThemeData(opacity: iconOpacity), diff --git a/examples/material_gallery/lib/demo/leave_behind_demo.dart b/examples/material_gallery/lib/demo/leave_behind_demo.dart index 30e695af34..cbc86aa2cd 100644 --- a/examples/material_gallery/lib/demo/leave_behind_demo.dart +++ b/examples/material_gallery/lib/demo/leave_behind_demo.dart @@ -125,9 +125,9 @@ class LeaveBehindDemoState extends State { Widget build(BuildContext context) { return new Scaffold( key: _scaffoldKey, - toolBar: new ToolBar( - center: new Text('Swipe Items to Dismiss'), - right: [ + appBar: new AppBar( + title: new Text('Swipe Items to Dismiss'), + actions: [ new PopupMenuButton( onSelected: handleDemoAction, items: >[ diff --git a/examples/material_gallery/lib/demo/list_demo.dart b/examples/material_gallery/lib/demo/list_demo.dart index 71391082c1..b0730461b8 100644 --- a/examples/material_gallery/lib/demo/list_demo.dart +++ b/examples/material_gallery/lib/demo/list_demo.dart @@ -174,9 +174,9 @@ class ListDemoState extends State { return new Scaffold( key: scaffoldKey, - toolBar: new ToolBar( - center: new Text('Scrolling List\n$itemSizeText$layoutText'), - right: [ + appBar: new AppBar( + title: new Text('Scrolling List\n$itemSizeText$layoutText'), + actions: [ new IconButton( icon: Icons.sort_by_alpha, tooltip: 'Sort', diff --git a/examples/material_gallery/lib/demo/menu_demo.dart b/examples/material_gallery/lib/demo/menu_demo.dart index c3eac68976..24a4eb9e57 100644 --- a/examples/material_gallery/lib/demo/menu_demo.dart +++ b/examples/material_gallery/lib/demo/menu_demo.dart @@ -56,15 +56,15 @@ class MenuDemoState extends State { Widget build(BuildContext context) { return new Scaffold( key: _scaffoldKey, - toolBar: new ToolBar( - center: new Text('Menus'), - right: [ + appBar: new AppBar( + title: new Text('Menus'), + actions: [ new PopupMenuButton( onSelected: showMenuSelection, items: >[ new PopupMenuItem( - value: 'ToolBar Menu', - child: new Text('ToolBar Menu') + value: 'AppBar Menu', + child: new Text('AppBar Menu') ), new PopupMenuItem( value: 'Right Here', diff --git a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart index 6341377bc1..295fe4b550 100644 --- a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart +++ b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart @@ -13,7 +13,7 @@ class ModalBottomSheetDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Modal Bottom Sheet")), + appBar: new AppBar(title: new Text("Modal Bottom Sheet")), body: new Center( child: new Container( width: 200.0, diff --git a/examples/material_gallery/lib/demo/page_selector_demo.dart b/examples/material_gallery/lib/demo/page_selector_demo.dart index 4158e461ef..34125572fd 100644 --- a/examples/material_gallery/lib/demo/page_selector_demo.dart +++ b/examples/material_gallery/lib/demo/page_selector_demo.dart @@ -23,7 +23,7 @@ class PageSelectorDemo extends StatelessWidget { ]; return new Scaffold( - toolBar: new ToolBar(center: new Text('Page Selector')), + appBar: new AppBar(title: new Text('Page Selector')), body: new TabBarSelection( values: icons, child: new Builder( diff --git a/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart b/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart index 6513863768..b003d5fa6e 100644 --- a/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart +++ b/examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart @@ -28,7 +28,7 @@ class PersistentBottomSheetDemo extends StatelessWidget { Widget build(BuildContext notUsed) { // Can't find the Scaffold from this context. return new Scaffold( - toolBar: new ToolBar(center: new Text("Persistent Bottom Sheet")), + appBar: new AppBar(title: new Text("Persistent Bottom Sheet")), floatingActionButton: new FloatingActionButton( child: new Icon(icon: Icons.add), backgroundColor: Colors.redAccent[200] diff --git a/examples/material_gallery/lib/demo/progress_indicator_demo.dart b/examples/material_gallery/lib/demo/progress_indicator_demo.dart index b6245ad2cd..f26f07dcea 100644 --- a/examples/material_gallery/lib/demo/progress_indicator_demo.dart +++ b/examples/material_gallery/lib/demo/progress_indicator_demo.dart @@ -83,7 +83,7 @@ class _ProgressIndicatorDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text('Progress Indicators')), + appBar: new AppBar(title: new Text('Progress Indicators')), body: new DefaultTextStyle( style: Theme.of(context).textTheme.title, child: new GestureDetector( diff --git a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart index d5ac4fe1dc..35d4a12263 100644 --- a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart +++ b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart @@ -48,8 +48,8 @@ class _StatusBarGraphic extends _BarGraphic { ); } -class _ToolBarGraphic extends _BarGraphic { - _ToolBarGraphic() : super( +class _AppBarGraphic extends _BarGraphic { + _AppBarGraphic() : super( height: 48.0, color: Colors.blue[400], leftText: 'Tool Bar', @@ -113,7 +113,7 @@ const String _introText = class ScrollingTechniquesDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text('Scrolling Techniques')), + appBar: new AppBar(title: new Text('Scrolling Techniques')), body: new Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: new Block( @@ -127,7 +127,7 @@ class ScrollingTechniquesDemo extends StatelessWidget { titleText: 'Standard', barGraphics: [ new _StatusBarGraphic(), - new _ToolBarGraphic() + new _AppBarGraphic() ] ), new _TechniqueItem( @@ -135,7 +135,7 @@ class ScrollingTechniquesDemo extends StatelessWidget { builder: (BuildContext context) => new FlexibleSpaceDemo(), barGraphics: [ new _StatusBarGraphic(), - new _ToolBarGraphic(), + new _AppBarGraphic(), new _TabBarGraphic() ] ), @@ -144,7 +144,7 @@ class ScrollingTechniquesDemo extends StatelessWidget { builder: (BuildContext context) => new FlexibleSpaceDemo(), barGraphics: [ new _StatusBarGraphic(), - new _ToolBarGraphic(), + new _AppBarGraphic(), new _FlexibleSpaceGraphic() ] ) diff --git a/examples/material_gallery/lib/demo/slider_demo.dart b/examples/material_gallery/lib/demo/slider_demo.dart index a86ed46d2e..bf0f0c258f 100644 --- a/examples/material_gallery/lib/demo/slider_demo.dart +++ b/examples/material_gallery/lib/demo/slider_demo.dart @@ -13,7 +13,7 @@ class _SliderDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Sliders")), + appBar: new AppBar(title: new Text("Sliders")), body: new Block(children: [ new Container( height: 100.0, diff --git a/examples/material_gallery/lib/demo/snack_bar_demo.dart b/examples/material_gallery/lib/demo/snack_bar_demo.dart index 0b1595ed18..d487c2a1fd 100644 --- a/examples/material_gallery/lib/demo/snack_bar_demo.dart +++ b/examples/material_gallery/lib/demo/snack_bar_demo.dart @@ -58,8 +58,8 @@ class SnackBarDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('SnackBar') + appBar: new AppBar( + title: new Text('SnackBar') ), body: new Builder( // Create an inner BuildContext so that the snackBar onPressed methods diff --git a/examples/material_gallery/lib/demo/tabs_demo.dart b/examples/material_gallery/lib/demo/tabs_demo.dart index 48c9ba3ebb..3764670605 100644 --- a/examples/material_gallery/lib/demo/tabs_demo.dart +++ b/examples/material_gallery/lib/demo/tabs_demo.dart @@ -28,8 +28,8 @@ class TabsDemo extends StatelessWidget { return new TabBarSelection( values: icons, child: new Scaffold( - toolBar: new ToolBar( - center: new Text("Scrollable Tabs"), + appBar: new AppBar( + title: new Text("Scrollable Tabs"), tabBar: new TabBar( isScrollable: true, labels: new Map.fromIterable( diff --git a/examples/material_gallery/lib/demo/tabs_fab_demo.dart b/examples/material_gallery/lib/demo/tabs_fab_demo.dart index 9cbe49b9bd..723c4e9bcd 100644 --- a/examples/material_gallery/lib/demo/tabs_fab_demo.dart +++ b/examples/material_gallery/lib/demo/tabs_fab_demo.dart @@ -94,8 +94,8 @@ class _TabsFabDemoState extends State { onChanged: _handleTabSelection, child: new Scaffold( key: scaffoldKey, - toolBar: new ToolBar( - center: new Text("FAB per Tab"), + appBar: new AppBar( + title: new Text("FAB per Tab"), tabBar: new TabBar<_Page>( labels: new Map<_Page, TabLabel>.fromIterable(pages, value: (_Page page) => page.tabLabel) ) diff --git a/examples/material_gallery/lib/demo/text_field_demo.dart b/examples/material_gallery/lib/demo/text_field_demo.dart index dffdc30105..daea2a4345 100644 --- a/examples/material_gallery/lib/demo/text_field_demo.dart +++ b/examples/material_gallery/lib/demo/text_field_demo.dart @@ -62,8 +62,8 @@ class TextFieldDemoState extends State { Widget build(BuildContext context) { return new Scaffold( key: _scaffoldKey, - toolBar: new ToolBar( - center: new Text('Text Fields') + appBar: new AppBar( + title: new Text('Text Fields') ), body: new Block( padding: const EdgeInsets.all(8.0), diff --git a/examples/material_gallery/lib/demo/time_picker_demo.dart b/examples/material_gallery/lib/demo/time_picker_demo.dart index 56a26f0209..7d346aa0c6 100644 --- a/examples/material_gallery/lib/demo/time_picker_demo.dart +++ b/examples/material_gallery/lib/demo/time_picker_demo.dart @@ -27,7 +27,7 @@ class _TimePickerDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Time Picker")), + appBar: new AppBar(title: new Text("Time Picker")), body: new Column( children: [ new Text('$_selectedTime'), diff --git a/examples/material_gallery/lib/demo/toggle_controls_demo.dart b/examples/material_gallery/lib/demo/toggle_controls_demo.dart index eb92ee8bec..9a63647e18 100644 --- a/examples/material_gallery/lib/demo/toggle_controls_demo.dart +++ b/examples/material_gallery/lib/demo/toggle_controls_demo.dart @@ -33,7 +33,7 @@ class _ToggleControlsDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text("Selection Controls")), + appBar: new AppBar(title: new Text("Selection Controls")), body: new Column( children: [ new Row( diff --git a/examples/material_gallery/lib/demo/tooltip_demo.dart b/examples/material_gallery/lib/demo/tooltip_demo.dart index a4a5dca9eb..ed78c2267b 100644 --- a/examples/material_gallery/lib/demo/tooltip_demo.dart +++ b/examples/material_gallery/lib/demo/tooltip_demo.dart @@ -13,8 +13,8 @@ class TooltipDemo extends StatelessWidget { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); return new Scaffold( - toolBar: new ToolBar( - center: new Text('Tooltip') + appBar: new AppBar( + title: new Text('Tooltip') ), body: new Builder( builder: (BuildContext context) { diff --git a/examples/material_gallery/lib/demo/two_level_list_demo.dart b/examples/material_gallery/lib/demo/two_level_list_demo.dart index a9105ff824..f47738fea3 100644 --- a/examples/material_gallery/lib/demo/two_level_list_demo.dart +++ b/examples/material_gallery/lib/demo/two_level_list_demo.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; class TwoLevelListDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar(center: new Text('Expand/Collapse List Control')), + appBar: new AppBar(title: new Text('Expand/Collapse List Control')), body: new Padding( padding: const EdgeInsets.all(0.0), child: new TwoLevelList( diff --git a/examples/material_gallery/lib/demo/typography_demo.dart b/examples/material_gallery/lib/demo/typography_demo.dart index 83c0f5587c..1311edbf4e 100644 --- a/examples/material_gallery/lib/demo/typography_demo.dart +++ b/examples/material_gallery/lib/demo/typography_demo.dart @@ -62,7 +62,7 @@ class TypographyDemo extends StatelessWidget { } return new Scaffold( - toolBar: new ToolBar(center: new Text('Typography')), + appBar: new AppBar(title: new Text('Typography')), body: new Block(children: styleItems) ); } diff --git a/examples/material_gallery/lib/demo/weather_demo.dart b/examples/material_gallery/lib/demo/weather_demo.dart index 1cd56dabbe..4919f5c751 100644 --- a/examples/material_gallery/lib/demo/weather_demo.dart +++ b/examples/material_gallery/lib/demo/weather_demo.dart @@ -61,8 +61,8 @@ class _WeatherDemoState extends State { Widget build(BuildContext context) { if (!assetsLoaded) { return new Scaffold( - toolBar: new ToolBar( - center: new Text("Weather") + appBar: new AppBar( + title: new Text("Weather") ), body: new Container( decoration: new BoxDecoration( @@ -73,8 +73,8 @@ class _WeatherDemoState extends State { } return new Scaffold( - toolBar: new ToolBar( - center: new Text("Weather") + appBar: new AppBar( + title: new Text("Weather") ), body: new Material( child: new Stack( diff --git a/examples/material_gallery/lib/gallery/home.dart b/examples/material_gallery/lib/gallery/home.dart index 9214e20537..af6c4807d1 100644 --- a/examples/material_gallery/lib/gallery/home.dart +++ b/examples/material_gallery/lib/gallery/home.dart @@ -50,7 +50,7 @@ class GalleryHomeState extends State { return new Scaffold( appBarHeight: 128.0, drawer: new GalleryDrawer(), - toolBar: new ToolBar( + appBar: new AppBar( flexibleSpace: (BuildContext context) { return new Container( padding: const EdgeInsets.only(left: 16.0, bottom: 24.0), diff --git a/examples/material_gallery/lib/gallery/section.dart b/examples/material_gallery/lib/gallery/section.dart index 83e88d71f4..c1060f11d7 100644 --- a/examples/material_gallery/lib/gallery/section.dart +++ b/examples/material_gallery/lib/gallery/section.dart @@ -39,7 +39,7 @@ class GallerySection extends StatelessWidget { appBarHeight: appBarHeight, appBarBehavior: AppBarBehavior.scroll, scrollableKey: scrollableKey, - toolBar: new ToolBar( + appBar: new AppBar( flexibleSpace: (BuildContext context) => new FlexibleSpaceBar(title: new Text(title)) ), body: new Material( diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart index fd58211ef7..093fc9e1cf 100644 --- a/examples/stocks/lib/stock_home.dart +++ b/examples/stocks/lib/stock_home.dart @@ -206,11 +206,11 @@ class StockHomeState extends State { Navigator.popAndPushNamed(context, '/settings'); } - Widget buildToolBar() { - return new ToolBar( + Widget buildAppBar() { + return new AppBar( elevation: 0, - center: new Text(StockStrings.of(context).title()), - right: [ + title: new Text(StockStrings.of(context).title()), + actions: [ new IconButton( icon: Icons.search, onPressed: _handleSearchBegin, @@ -303,14 +303,14 @@ class StockHomeState extends State { // TODO(abarth): Should we factor this into a SearchBar in the framework? Widget buildSearchBar() { - return new ToolBar( - left: new IconButton( + return new AppBar( + leading: new IconButton( icon: Icons.arrow_back, color: Theme.of(context).accentColor, onPressed: _handleSearchEnd, tooltip: 'Back' ), - center: new Input( + title: new Input( value: _searchQuery, autofocus: true, hintText: 'Search stocks', @@ -341,7 +341,7 @@ class StockHomeState extends State { values: [StockHomeTab.market, StockHomeTab.portfolio], child: new Scaffold( key: _scaffoldKey, - toolBar: _isSearching ? buildSearchBar() : buildToolBar(), + appBar: _isSearching ? buildSearchBar() : buildAppBar(), floatingActionButton: buildFloatingActionButton(), drawer: _buildDrawer(context), body: new TabBarView( diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart index 46600abc26..23f33c7373 100644 --- a/examples/stocks/lib/stock_settings.dart +++ b/examples/stocks/lib/stock_settings.dart @@ -94,9 +94,9 @@ class StockSettingsState extends State { config.updater(value); } - Widget buildToolBar(BuildContext context) { - return new ToolBar( - center: new Text('Settings') + Widget buildAppBar(BuildContext context) { + return new AppBar( + title: new Text('Settings') ); } @@ -247,7 +247,7 @@ class StockSettingsState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: buildToolBar(context), + appBar: buildAppBar(context), body: buildSettingsPane(context) ); } diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart index dee4f2a2d3..ee00a45282 100644 --- a/examples/stocks/lib/stock_symbol_viewer.dart +++ b/examples/stocks/lib/stock_symbol_viewer.dart @@ -73,8 +73,8 @@ class StockSymbolPage extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text(stock.name) + appBar: new AppBar( + title: new Text(stock.name) ), body: new Block( children: [ diff --git a/packages/flutter/lib/material.dart b/packages/flutter/lib/material.dart index f529776783..046437e0e0 100644 --- a/packages/flutter/lib/material.dart +++ b/packages/flutter/lib/material.dart @@ -8,6 +8,7 @@ library material; export 'src/material/app.dart'; +export 'src/material/app_bar.dart'; export 'src/material/bottom_sheet.dart'; export 'src/material/button.dart'; export 'src/material/card.dart'; @@ -56,7 +57,6 @@ export 'src/material/theme_data.dart'; export 'src/material/time_picker.dart'; export 'src/material/time_picker_dialog.dart'; export 'src/material/toggleable.dart'; -export 'src/material/tool_bar.dart'; export 'src/material/tooltip.dart'; export 'src/material/two_level_list.dart'; export 'src/material/typography.dart'; diff --git a/packages/flutter/lib/src/material/tool_bar.dart b/packages/flutter/lib/src/material/app_bar.dart similarity index 87% rename from packages/flutter/lib/src/material/tool_bar.dart rename to packages/flutter/lib/src/material/app_bar.dart index 7182c4b598..7520eb6d7f 100644 --- a/packages/flutter/lib/src/material/tool_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -11,12 +11,12 @@ import 'material.dart'; import 'theme.dart'; import 'typography.dart'; -class ToolBar extends StatelessWidget { - ToolBar({ +class AppBar extends StatelessWidget { + AppBar({ Key key, - this.left, - this.center, - this.right, + this.leading, + this.title, + this.actions, this.flexibleSpace, this.foregroundOpacity: 1.0, this.tabBar, @@ -29,9 +29,9 @@ class ToolBar extends StatelessWidget { assert((tabBar != null) ? flexibleSpace == null : true); } - final Widget left; - final Widget center; - final List right; + final Widget leading; + final Widget title; + final List actions; final WidgetBuilder flexibleSpace; final double foregroundOpacity; final Widget tabBar; @@ -40,7 +40,7 @@ class ToolBar extends StatelessWidget { final TextTheme textTheme; final EdgeInsets padding; - ToolBar copyWith({ + AppBar copyWith({ Key key, Widget left, Widget center, @@ -52,11 +52,11 @@ class ToolBar extends StatelessWidget { TextTheme textTheme, EdgeInsets padding }) { - return new ToolBar( + return new AppBar( key: key ?? this.key, - left: left ?? this.left, - center: center ?? this.center, - right: right ?? this.right, + leading: left ?? this.leading, + title: center ?? this.title, + actions: right ?? this.actions, flexibleSpace: flexibleSpace ?? this.flexibleSpace, foregroundOpacity: foregroundOpacity ?? this.foregroundOpacity, tabBar: tabBar ?? this.tabBar, @@ -98,18 +98,18 @@ class ToolBar extends StatelessWidget { } final List toolBarRow = []; - if (left != null) - toolBarRow.add(left); + if (leading != null) + toolBarRow.add(leading); toolBarRow.add( new Flexible( child: new Padding( padding: new EdgeInsets.only(left: 24.0), - child: center != null ? new DefaultTextStyle(style: centerStyle, child: center) : null + child: title != null ? new DefaultTextStyle(style: centerStyle, child: title) : null ) ) ); - if (right != null) - toolBarRow.addAll(right); + if (actions != null) + toolBarRow.addAll(actions); EdgeInsets combinedPadding = new EdgeInsets.symmetric(horizontal: 8.0); if (padding != null) @@ -117,7 +117,7 @@ class ToolBar extends StatelessWidget { // If the toolBar's height shrinks below toolBarHeight, it will be clipped and bottom // justified. This is so that the toolbar appears to move upwards as its height is reduced. - final double toolBarHeight = kToolBarHeight + combinedPadding.top + combinedPadding.bottom; + final double toolBarHeight = kAppBarHeight + combinedPadding.top + combinedPadding.bottom; final Widget toolBar = new ConstrainedBox( constraints: new BoxConstraints(maxHeight: toolBarHeight), child: new Padding( diff --git a/packages/flutter/lib/src/material/constants.dart b/packages/flutter/lib/src/material/constants.dart index 72c9c4b95b..93f37f0e76 100644 --- a/packages/flutter/lib/src/material/constants.dart +++ b/packages/flutter/lib/src/material/constants.dart @@ -9,8 +9,8 @@ import 'package:flutter/widgets.dart'; // Mobile Landscape: 48dp // Mobile Portrait: 56dp // Tablet/Desktop: 64dp -const double kToolBarHeight = 56.0; -const double kExtendedToolBarHeight = 128.0; +const double kAppBarHeight = 56.0; +const double kExtendedAppBarHeight = 128.0; const double kTextTabBarHeight = 48.0; const double kIconTabBarHeight = 48.0; diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart index f61b63e810..b9d44081d1 100644 --- a/packages/flutter/lib/src/material/flexible_space_bar.dart +++ b/packages/flutter/lib/src/material/flexible_space_bar.dart @@ -27,7 +27,7 @@ class _FlexibleSpaceBarState extends State { final double appBarHeight = Scaffold.of(context).appBarHeight; final Animation animation = Scaffold.of(context).appBarAnimation; final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero; - final double toolBarHeight = kToolBarHeight + toolBarPadding.top; + final double toolBarHeight = kAppBarHeight + toolBarPadding.top; final List children = []; // background image @@ -63,7 +63,7 @@ class _FlexibleSpaceBarState extends State { color: titleStyle.color.withAlpha(new Tween(begin: 255.0, end: 0.0).evaluate(opacityCurve).toInt()) ); final double yAlignStart = 1.0; - final double yAlignEnd = (toolBarPadding.top + kToolBarHeight / 2.0) / toolBarHeight; + final double yAlignEnd = (toolBarPadding.top + kAppBarHeight / 2.0) / toolBarHeight; final double scaleAndAlignEnd = (appBarHeight - toolBarHeight) / appBarHeight; final CurvedAnimation scaleAndAlignCurve = new CurvedAnimation( parent: animation, diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index a415863fb4..8cb699da4d 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -8,6 +8,7 @@ import 'dart:math' as math; import 'package:flutter/widgets.dart'; +import 'app_bar.dart'; import 'bottom_sheet.dart'; import 'constants.dart'; import 'drawer.dart'; @@ -15,7 +16,6 @@ import 'icons.dart'; import 'icon_button.dart'; import 'material.dart'; import 'snack_bar.dart'; -import 'tool_bar.dart'; const double _kFloatingActionButtonMargin = 16.0; // TODO(hmuller): should be device dependent const Duration _kFloatingActionButtonSegue = const Duration(milliseconds: 400); @@ -27,7 +27,7 @@ enum AppBarBehavior { enum _ScaffoldSlot { body, - toolBar, + appBar, bottomSheet, snackBar, floatingActionButton, @@ -42,18 +42,18 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate { void performLayout(Size size) { BoxConstraints looseConstraints = new BoxConstraints.loose(size); - // This part of the layout has the same effect as putting the toolbar and + // This part of the layout has the same effect as putting the app bar and // body in a column and making the body flexible. What's different is that - // in this case the toolbar appears -after- the body in the stacking order, - // so the toolbar's shadow is drawn on top of the body. + // in this case the app bar appears -after- the body in the stacking order, + // so the app bar's shadow is drawn on top of the body. final BoxConstraints fullWidthConstraints = looseConstraints.tighten(width: size.width); double contentTop = padding.top; double contentBottom = size.height - padding.bottom; - if (hasChild(_ScaffoldSlot.toolBar)) { - contentTop = layoutChild(_ScaffoldSlot.toolBar, fullWidthConstraints).height; - positionChild(_ScaffoldSlot.toolBar, Offset.zero); + if (hasChild(_ScaffoldSlot.appBar)) { + contentTop = layoutChild(_ScaffoldSlot.appBar, fullWidthConstraints).height; + positionChild(_ScaffoldSlot.appBar, Offset.zero); } if (hasChild(_ScaffoldSlot.body)) { @@ -183,7 +183,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr class Scaffold extends StatefulWidget { Scaffold({ Key key, - this.toolBar, + this.appBar, this.body, this.floatingActionButton, this.drawer, @@ -192,10 +192,10 @@ class Scaffold extends StatefulWidget { this.appBarHeight }) : super(key: key) { assert((appBarBehavior == AppBarBehavior.scroll) ? scrollableKey != null : true); - assert((appBarBehavior == AppBarBehavior.scroll) ? appBarHeight != null && appBarHeight > kToolBarHeight : true); + assert((appBarBehavior == AppBarBehavior.scroll) ? appBarHeight != null && appBarHeight > kAppBarHeight : true); } - final ToolBar toolBar; + final AppBar appBar; final Widget body; final Widget floatingActionButton; final Widget drawer; @@ -375,12 +375,12 @@ class ScaffoldState extends State { bool _shouldShowBackArrow; - Widget _getModifiedToolBar({ EdgeInsets padding, double foregroundOpacity: 1.0, int elevation }) { - ToolBar toolBar = config.toolBar; - if (toolBar == null) + Widget _getModifiedAppBar({ EdgeInsets padding, double foregroundOpacity: 1.0, int elevation }) { + AppBar appBar = config.appBar; + if (appBar == null) return null; - EdgeInsets toolBarPadding = new EdgeInsets.only(top: padding.top); - Widget left = toolBar.left; + EdgeInsets appBarPadding = new EdgeInsets.only(top: padding.top); + Widget left = appBar.leading; if (left == null) { if (config.drawer != null) { left = new IconButton( @@ -399,9 +399,9 @@ class ScaffoldState extends State { } } } - return toolBar.copyWith( - elevation: elevation ?? toolBar.elevation ?? 4, - padding: toolBarPadding, + return appBar.copyWith( + elevation: elevation ?? appBar.elevation ?? 4, + padding: appBarPadding, foregroundOpacity: foregroundOpacity, left: left ); @@ -421,9 +421,9 @@ class ScaffoldState extends State { return false; } - double _toolBarOpacity(double progress) { - // The value of progress is 1.0 if the entire (padded) toolbar is visible, 0.0 - // if the toolbar's height is zero. + double _appBarOpacity(double progress) { + // The value of progress is 1.0 if the entire (padded) app bar is visible, 0.0 + // if the app bar's height is zero. return new Tween(begin: 0.0, end: 1.0).evaluate(new CurvedAnimation( parent: new AnimationController()..value = progress.clamp(0.0, 1.0), curve: new Interval(0.50, 1.0) @@ -431,35 +431,35 @@ class ScaffoldState extends State { } Widget _buildScrollableAppBar(BuildContext context) { - final EdgeInsets toolBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero; - final double toolBarHeight = kToolBarHeight + toolBarPadding.top; + final EdgeInsets appBarPadding = MediaQuery.of(context)?.padding ?? EdgeInsets.zero; + final double appBarHeight = kAppBarHeight + appBarPadding.top; Widget appBar; - if (_scrollOffset <= appBarHeight && _scrollOffset >= appBarHeight - toolBarHeight) { - // scrolled to the top, only the toolbar is (partially) visible + if (_scrollOffset <= appBarHeight && _scrollOffset >= appBarHeight - appBarHeight) { + // scrolled to the top, only the app bar is (partially) visible final double height = math.max(_floatingAppBarHeight, appBarHeight - _scrollOffset); - final double opacity = _toolBarOpacity(1.0 - ((toolBarHeight - height) / toolBarHeight)); + final double opacity = _appBarOpacity(1.0 - ((appBarHeight - height) / appBarHeight)); _appBarController.value = (appBarHeight - height) / appBarHeight; appBar = new SizedBox( height: height, - child: _getModifiedToolBar(padding: toolBarPadding, foregroundOpacity: opacity) + child: _getModifiedAppBar(padding: appBarPadding, foregroundOpacity: opacity) ); } else if (_scrollOffset > appBarHeight) { - // scrolled down, show the "floating" toolbar - _floatingAppBarHeight = (_floatingAppBarHeight + _scrollOffsetDelta).clamp(0.0, toolBarHeight); - final double toolBarOpacity = _toolBarOpacity(_floatingAppBarHeight / toolBarHeight); + // scrolled down, show the "floating" app bar + _floatingAppBarHeight = (_floatingAppBarHeight + _scrollOffsetDelta).clamp(0.0, appBarHeight); + final double appBarOpacity = _appBarOpacity(_floatingAppBarHeight / appBarHeight); _appBarController.value = (appBarHeight - _floatingAppBarHeight) / appBarHeight; appBar = new SizedBox( height: _floatingAppBarHeight, - child: _getModifiedToolBar(padding: toolBarPadding, foregroundOpacity: toolBarOpacity) + child: _getModifiedAppBar(padding: appBarPadding, foregroundOpacity: appBarOpacity) ); } else { - // _scrollOffset < appBarHeight - toolBarHeight, scrolled to the top, flexible space is visible + // _scrollOffset < appBarHeight - appBarHeight, scrolled to the top, flexible space is visible final double height = appBarHeight - _scrollOffset.clamp(0.0, appBarHeight); _appBarController.value = (appBarHeight - height) / appBarHeight; appBar = new SizedBox( height: height, - child: _getModifiedToolBar(padding: toolBarPadding, elevation: 0) + child: _getModifiedAppBar(padding: appBarPadding, elevation: 0) ); _floatingAppBarHeight = 0.0; } @@ -484,13 +484,13 @@ class ScaffoldState extends State { final List children = new List(); _addIfNonNull(children, config.body, _ScaffoldSlot.body); if (config.appBarBehavior == AppBarBehavior.anchor) { - Widget toolBar = new ConstrainedBox( - child: _getModifiedToolBar(padding: padding), - constraints: new BoxConstraints(maxHeight: config.appBarHeight ?? kExtendedToolBarHeight + padding.top) + Widget appBar = new ConstrainedBox( + child: _getModifiedAppBar(padding: padding), + constraints: new BoxConstraints(maxHeight: config.appBarHeight ?? kExtendedAppBarHeight + padding.top) ); - _addIfNonNull(children, toolBar, _ScaffoldSlot.toolBar); + _addIfNonNull(children, appBar, _ScaffoldSlot.appBar); } - // Otherwise the ToolBar will be part of a [toolbar, body] Stack. See AppBarBehavior.scroll below. + // Otherwise the AppBar will be part of a [app bar, body] Stack. See AppBarBehavior.scroll below. if (_currentBottomSheet != null || (_dismissedBottomSheets != null && _dismissedBottomSheets.isNotEmpty)) { diff --git a/packages/flutter_markdown/example/demo.dart b/packages/flutter_markdown/example/demo.dart index f83b7f1cd8..7877fe2b0d 100644 --- a/packages/flutter_markdown/example/demo.dart +++ b/packages/flutter_markdown/example/demo.dart @@ -31,7 +31,7 @@ void main() { title: "Markdown Demo", routes: { '/': (BuildContext context) => new Scaffold( - toolBar: new ToolBar(center: new Text("Markdown Demo")), + appBar: new AppBar(title: new Text("Markdown Demo")), body: new Markdown(data: _kMarkdownData) ) } diff --git a/packages/flutter_tools/templates/create/lib/main.dart.tmpl b/packages/flutter_tools/templates/create/lib/main.dart.tmpl index a5479f93b2..3acf2245e2 100644 --- a/packages/flutter_tools/templates/create/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/create/lib/main.dart.tmpl @@ -34,8 +34,8 @@ class _FlutterDemoState extends State { Widget build(BuildContext context) { return new Scaffold( - toolBar: new ToolBar( - center: new Text('Flutter Demo') + appBar: new AppBar( + title: new Text('Flutter Demo') ), body: new Center( child: new Text('Button tapped $_counter time${ _counter == 1 ? '' : 's' }.')