[rename fixit] left -> leading, right -> trailing

The terms "left" and "right" have an LTR bias. Instead, we now use
"leading" and "trailing", for these list and grid decorations so that
we can later rearrange them to match the reading order.

Fixes #2540
Fixes #2548
This commit is contained in:
Adam Barth
2016-03-12 17:15:53 -08:00
parent 6a2edbbff5
commit e48c822ce3
11 changed files with 110 additions and 103 deletions

View File

@@ -72,7 +72,7 @@ class GridDemoPhotoItem extends StatelessWidget {
return new GridTile(
header: new GridTileBar(
backgroundColor: Colors.black.withAlpha(0x08),
left: new Icon(icon: Icons.info, color: Colors.white70),
leading: new Icon(icon: Icons.info, color: Colors.white70),
title: new Text(photo.title)
),
child: image
@@ -83,8 +83,8 @@ class GridDemoPhotoItem extends StatelessWidget {
footer: new GridTileBar(
backgroundColor: Colors.black.withAlpha(0x08),
title: new Text(photo.title),
caption: new Text(photo.caption),
right: new Icon(icon: Icons.info, color: Colors.white70)
subtitle: new Text(photo.caption),
trailing: new Icon(icon: Icons.info, color: Colors.white70)
),
child: image
);

View File

@@ -99,13 +99,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
background: new Container(
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
child: new ListItem(
left: new Icon(icon: Icons.delete, color: Colors.white, size: 36.0)
leading: new Icon(icon: Icons.delete, color: Colors.white, size: 36.0)
)
),
secondaryBackground: new Container(
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
child: new ListItem(
right: new Icon(icon: Icons.archive, color: Colors.white, size: 36.0)
trailing: new Icon(icon: Icons.archive, color: Colors.white, size: 36.0)
)
),
child: new Container(
@@ -114,8 +114,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new ListItem(
primary: new Text(item.name),
secondary: new Text('${item.subject}\n${item.body}'),
title: new Text(item.name),
subtitle: new Text('${item.subject}\n${item.body}'),
isThreeLine: true
)
)

View File

@@ -49,8 +49,8 @@ class ListDemoState extends State<ListDemo> {
children: <Widget>[
new ListItem(
dense: true,
primary: new Text('One-line'),
right: new Radio<ListDemoItemSize>(
title: new Text('One-line'),
trailing: new Radio<ListDemoItemSize>(
value: ListDemoItemSize.oneLine,
groupValue: _itemSize,
onChanged: changeItemSize
@@ -58,8 +58,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Two-line'),
right: new Radio<ListDemoItemSize>(
title: new Text('Two-line'),
trailing: new Radio<ListDemoItemSize>(
value: ListDemoItemSize.twoLine,
groupValue: _itemSize,
onChanged: changeItemSize
@@ -67,8 +67,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Three-line'),
right: new Radio<ListDemoItemSize>(
title: new Text('Three-line'),
trailing: new Radio<ListDemoItemSize>(
value: ListDemoItemSize.threeLine,
groupValue: _itemSize,
onChanged: changeItemSize
@@ -76,8 +76,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Show Avatar'),
right: new Checkbox(
title: new Text('Show Avatar'),
trailing: new Checkbox(
value: _showAvatars,
onChanged: (bool value) {
setState(() {
@@ -89,8 +89,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Show Icon'),
right: new Checkbox(
title: new Text('Show Icon'),
trailing: new Checkbox(
value: _showIcons,
onChanged: (bool value) {
setState(() {
@@ -102,8 +102,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Show Dividers'),
right: new Checkbox(
title: new Text('Show Dividers'),
trailing: new Checkbox(
value: _showDividers,
onChanged: (bool value) {
setState(() {
@@ -115,8 +115,8 @@ class ListDemoState extends State<ListDemo> {
),
new ListItem(
dense: true,
primary: new Text('Dense Layout'),
right: new Checkbox(
title: new Text('Dense Layout'),
trailing: new Checkbox(
value: _dense,
onChanged: (bool value) {
setState(() {
@@ -146,10 +146,10 @@ class ListDemoState extends State<ListDemo> {
return new ListItem(
isThreeLine: _itemSize == ListDemoItemSize.threeLine,
dense: _dense,
left: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
primary: new Text('This item represents $item'),
secondary: secondary,
right: _showIcons ? new Icon(icon: Icons.info, color: Theme.of(context).disabledColor) : null
leading: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
title: new Text('This item represents $item'),
subtitle: secondary,
trailing: _showIcons ? new Icon(icon: Icons.info, color: Theme.of(context).disabledColor) : null
);
}

View File

@@ -85,8 +85,8 @@ class MenuDemoState extends State<MenuDemo> {
// a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state.
new ListItem(
primary: new Text('An item with a context menu button'),
right: new PopupMenuButton<String>(
title: new Text('An item with a context menu button'),
trailing: new PopupMenuButton<String>(
onSelected: showMenuSelection,
items: <PopupMenuItem<String>>[
new PopupMenuItem<String>(
@@ -108,37 +108,37 @@ class MenuDemoState extends State<MenuDemo> {
// a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one.
new ListItem(
primary: new Text('An item with a sectioned menu'),
right: new PopupMenuButton<String>(
title: new Text('An item with a sectioned menu'),
trailing: new PopupMenuButton<String>(
onSelected: showMenuSelection,
items: <PopupMenuEntry<String>>[
new PopupMenuItem<String>(
value: 'Preview',
child: new ListItem(
left: new Icon(icon: Icons.visibility),
primary: new Text('Preview')
leading: new Icon(icon: Icons.visibility),
title: new Text('Preview')
)
),
new PopupMenuItem<String>(
value: 'Share',
child: new ListItem(
left: new Icon(icon: Icons.person_add),
primary: new Text('Share')
leading: new Icon(icon: Icons.person_add),
title: new Text('Share')
)
),
new PopupMenuItem<String>(
value: 'Get Link',
child: new ListItem(
left: new Icon(icon: Icons.link),
primary: new Text('Get Link')
leading: new Icon(icon: Icons.link),
title: new Text('Get Link')
)
),
new PopupMenuDivider(),
new PopupMenuItem<String>(
value: 'Remove',
child: new ListItem(
left: new Icon(icon: Icons.delete),
primary: new Text('Remove')
leading: new Icon(icon: Icons.delete),
title: new Text('Remove')
)
)
]
@@ -151,8 +151,8 @@ class MenuDemoState extends State<MenuDemo> {
initialValue: _simpleValue,
onSelected: showMenuSelection,
child: new ListItem(
primary: new Text('An item with a simple menu'),
secondary: new Text(_simpleValue)
title: new Text('An item with a simple menu'),
subtitle: new Text(_simpleValue)
),
items: <PopupMenuItem<String>>[
new PopupMenuItem<String>(
@@ -172,8 +172,8 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows a menu
// whose items have checked icons that reflect this app's state.
new ListItem(
primary: new Text('An item with a checklist menu'),
right: new PopupMenuButton<String>(
title: new Text('An item with a checklist menu'),
trailing: new PopupMenuButton<String>(
onSelected: showCheckedMenuSelections,
items: <PopupMenuItem<String>>[
new CheckedPopupMenuItem<String>(

View File

@@ -13,17 +13,17 @@ class TwoLevelListDemo extends StatelessWidget {
child: new TwoLevelList(
type: MaterialListType.oneLine,
items: <Widget>[
new TwoLevelListItem(center: new Text('Top')),
new TwoLevelListItem(title: new Text('Top')),
new TwoLevelSublist(
center: new Text('Sublist'),
children: <Widget>[
new TwoLevelListItem(center: new Text('One')),
new TwoLevelListItem(center: new Text('Two')),
new TwoLevelListItem(center: new Text('Free')),
new TwoLevelListItem(center: new Text('Four'))
new TwoLevelListItem(title: new Text('One')),
new TwoLevelListItem(title: new Text('Two')),
new TwoLevelListItem(title: new Text('Free')),
new TwoLevelListItem(title: new Text('Four'))
]
),
new TwoLevelListItem(center: new Text('Bottom'))
new TwoLevelListItem(title: new Text('Bottom'))
]
)
)

View File

@@ -49,7 +49,7 @@ class GallerySection extends StatelessWidget {
type: MaterialListType.oneLine,
children: (demos ?? const <GalleryDemo>[]).map((GalleryDemo demo) {
return new ListItem(
primary: new Text(demo.title),
title: new Text(demo.title),
onTap: () { showDemo(demo, context, theme); }
);
})