[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
This commit is contained in:
Adam Barth
2016-03-12 17:22:40 -08:00
parent e48c822ce3
commit ede5dfce30
52 changed files with 170 additions and 170 deletions

View File

@@ -217,8 +217,8 @@ void main() {
routes: <String, WidgetBuilder>{
'/': (BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(
center: new Text('Gestures Demo')),
appBar: new AppBar(
title: new Text('Gestures Demo')),
body: new GestureDemo()
);
}

View File

@@ -100,8 +100,8 @@ void main() {
routes: <String, WidgetBuilder>{
'/': (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))
);

View File

@@ -154,8 +154,8 @@ class SectorAppState extends State<SectorApp> {
routes: <String, WidgetBuilder>{
'/': (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()
);

View File

@@ -121,8 +121,8 @@ void main() {
routes: <String, WidgetBuilder>{
'/': (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()

View File

@@ -196,8 +196,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
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)

View File

@@ -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),

View File

@@ -36,7 +36,7 @@ class _ChipDemoState extends State<ChipDemo> {
}
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(

View File

@@ -111,9 +111,9 @@ class ColorsDemo extends StatelessWidget {
return new TabBarSelection<ColorSwatch>(
values: colorSwatches,
child: new Scaffold(
toolBar: new ToolBar(
appBar: new AppBar(
elevation: 0,
center: new Text("Colors"),
title: new Text("Colors"),
tabBar: new TabBar<ColorSwatch>(
isScrollable: true,
labels: new Map<ColorSwatch, TabLabel>.fromIterable(colorSwatches, value: (ColorSwatch swatch) {

View File

@@ -31,7 +31,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
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: <Widget>[
new Text(new DateFormat.yMMMd().format(_selectedDate)),

View File

@@ -80,8 +80,8 @@ class DialogDemoState extends State<DialogDemo> {
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),

View File

@@ -20,7 +20,7 @@ class _DropDownDemoState extends State<DropDownDemo> {
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<String>(
items: buildItems(),

View File

@@ -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()
);

View File

@@ -85,8 +85,8 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
appBarHeight: appBarHeight,
scrollableKey: scrollableKey,
appBarBehavior: AppBarBehavior.scroll,
toolBar: new ToolBar(
right: <Widget>[
appBar: new AppBar(
actions: <Widget>[
new IconButton(
icon: Icons.create,
tooltip: 'Search'

View File

@@ -141,13 +141,13 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
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: <Widget> [
title: new Text('New Event'),
actions: <Widget> [
new FlatButton(
child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
onPressed: () {

View File

@@ -41,8 +41,8 @@ class GridDemoPhotoItem extends StatelessWidget {
Navigator.push(context, new MaterialPageRoute<Null>(
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<GridListDemo> {
Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold(
toolBar: new ToolBar(
center: new Text('Grid List'),
right: <Widget>[
appBar: new AppBar(
title: new Text('Grid List'),
actions: <Widget>[
new IconButton(
icon: Icons.more_vert,
onPressed: () { showTileStyleMenu(context); },

View File

@@ -66,8 +66,8 @@ class IconsDemoState extends State<IconsDemo> {
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),

View File

@@ -125,9 +125,9 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,
toolBar: new ToolBar(
center: new Text('Swipe Items to Dismiss'),
right: <Widget>[
appBar: new AppBar(
title: new Text('Swipe Items to Dismiss'),
actions: <Widget>[
new PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction,
items: <PopupMenuEntry<LeaveBehindDemoAction>>[

View File

@@ -174,9 +174,9 @@ class ListDemoState extends State<ListDemo> {
return new Scaffold(
key: scaffoldKey,
toolBar: new ToolBar(
center: new Text('Scrolling List\n$itemSizeText$layoutText'),
right: <Widget>[
appBar: new AppBar(
title: new Text('Scrolling List\n$itemSizeText$layoutText'),
actions: <Widget>[
new IconButton(
icon: Icons.sort_by_alpha,
tooltip: 'Sort',

View File

@@ -56,15 +56,15 @@ class MenuDemoState extends State<MenuDemo> {
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,
toolBar: new ToolBar(
center: new Text('Menus'),
right: <Widget>[
appBar: new AppBar(
title: new Text('Menus'),
actions: <Widget>[
new PopupMenuButton<String>(
onSelected: showMenuSelection,
items: <PopupMenuItem<String>>[
new PopupMenuItem<String>(
value: 'ToolBar Menu',
child: new Text('ToolBar Menu')
value: 'AppBar Menu',
child: new Text('AppBar Menu')
),
new PopupMenuItem<String>(
value: 'Right Here',

View File

@@ -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,

View File

@@ -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<IconData>(
values: icons,
child: new Builder(

View File

@@ -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]

View File

@@ -83,7 +83,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
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(

View File

@@ -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: <Widget>[
new _StatusBarGraphic(),
new _ToolBarGraphic()
new _AppBarGraphic()
]
),
new _TechniqueItem(
@@ -135,7 +135,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
builder: (BuildContext context) => new FlexibleSpaceDemo(),
barGraphics: <Widget>[
new _StatusBarGraphic(),
new _ToolBarGraphic(),
new _AppBarGraphic(),
new _TabBarGraphic()
]
),
@@ -144,7 +144,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
builder: (BuildContext context) => new FlexibleSpaceDemo(),
barGraphics: <Widget>[
new _StatusBarGraphic(),
new _ToolBarGraphic(),
new _AppBarGraphic(),
new _FlexibleSpaceGraphic()
]
)

View File

@@ -13,7 +13,7 @@ class _SliderDemoState extends State<SliderDemo> {
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: <Widget>[
new Container(
height: 100.0,

View File

@@ -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

View File

@@ -28,8 +28,8 @@ class TabsDemo extends StatelessWidget {
return new TabBarSelection<IconData>(
values: icons,
child: new Scaffold(
toolBar: new ToolBar(
center: new Text("Scrollable Tabs"),
appBar: new AppBar(
title: new Text("Scrollable Tabs"),
tabBar: new TabBar<IconData>(
isScrollable: true,
labels: new Map<IconData, TabLabel>.fromIterable(

View File

@@ -94,8 +94,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
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)
)

View File

@@ -62,8 +62,8 @@ class TextFieldDemoState extends State<TextFieldDemo> {
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),

View File

@@ -27,7 +27,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
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: <Widget>[
new Text('$_selectedTime'),

View File

@@ -33,7 +33,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
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: <Widget>[
new Row(

View File

@@ -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) {

View File

@@ -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(

View File

@@ -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)
);
}

View File

@@ -61,8 +61,8 @@ class _WeatherDemoState extends State<WeatherDemo> {
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<WeatherDemo> {
}
return new Scaffold(
toolBar: new ToolBar(
center: new Text("Weather")
appBar: new AppBar(
title: new Text("Weather")
),
body: new Material(
child: new Stack(

View File

@@ -50,7 +50,7 @@ class GalleryHomeState extends State<GalleryHome> {
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),

View File

@@ -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(

View File

@@ -206,11 +206,11 @@ class StockHomeState extends State<StockHome> {
Navigator.popAndPushNamed(context, '/settings');
}
Widget buildToolBar() {
return new ToolBar(
Widget buildAppBar() {
return new AppBar(
elevation: 0,
center: new Text(StockStrings.of(context).title()),
right: <Widget>[
title: new Text(StockStrings.of(context).title()),
actions: <Widget>[
new IconButton(
icon: Icons.search,
onPressed: _handleSearchBegin,
@@ -303,14 +303,14 @@ class StockHomeState extends State<StockHome> {
// 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<StockHome> {
values: <StockHomeTab>[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<StockHomeTab>(

View File

@@ -94,9 +94,9 @@ class StockSettingsState extends State<StockSettings> {
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<StockSettings> {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: buildToolBar(context),
appBar: buildAppBar(context),
body: buildSettingsPane(context)
);
}

View File

@@ -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: <Widget>[