Rename ListItem to ListTile, document ListTile fixed height geometry (#8769)

This commit is contained in:
Hans Muller
2017-03-14 11:46:30 -07:00
committed by GitHub
parent c670cd9e64
commit 859da8d28b
19 changed files with 106 additions and 103 deletions

View File

@@ -420,7 +420,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
final Iterable<Widget> detailItems = section.details.map((SectionDetail detail) {
return new SectionDetailView(detail: detail);
});
return ListItem.divideItems(context: context, items: detailItems).map((Widget item) {
return ListTile.divideTiles(context: context, tiles: detailItems).map((Widget item) {
return new SliverToBoxAdapter(child: item);
});
}

View File

@@ -143,7 +143,7 @@ class SectionDetailView extends StatelessWidget {
child: image,
);
} else {
item = new ListItem(
item = new ListTile(
title: new Text(detail.title),
subtitle: new Text(detail.subtitle),
leading: new SizedBox(width: 32.0, height: 32.0, child: image),

View File

@@ -141,7 +141,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new ListItem(
new ListTile(
title: new Text('Simple dropdown:'),
trailing: new DropdownButton<String>(
value: dropdown1Value,
@@ -161,7 +161,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
const SizedBox(
height: 24.0,
),
new ListItem(
new ListTile(
title: new Text('Dropdown with a hint:'),
trailing: new DropdownButton<String>(
value: dropdown2Value,
@@ -182,7 +182,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
const SizedBox(
height: 24.0,
),
new ListItem(
new ListTile(
title: new Text('Scrollable dropdown:'),
trailing: new DropdownButton<String>(
value: dropdown3Value,

View File

@@ -103,13 +103,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
},
background: new Container(
color: theme.primaryColor,
child: new ListItem(
child: new ListTile(
leading: new Icon(Icons.delete, color: Colors.white, size: 36.0)
)
),
secondaryBackground: new Container(
color: theme.primaryColor,
child: new ListItem(
child: new ListTile(
trailing: new Icon(Icons.archive, color: Colors.white, size: 36.0)
)
),
@@ -118,7 +118,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
backgroundColor: theme.canvasColor,
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new ListItem(
child: new ListTile(
title: new Text(item.name),
subtitle: new Text('${item.subject}\n${item.body}'),
isThreeLine: true

View File

@@ -43,7 +43,7 @@ class _ListDemoState extends State<ListDemo> {
child: new ListView(
shrinkWrap: true,
children: <Widget>[
new ListItem(
new ListTile(
dense: true,
title: new Text('One-line'),
trailing: new Radio<MaterialListType>(
@@ -52,7 +52,7 @@ class _ListDemoState extends State<ListDemo> {
onChanged: changeItemType,
)
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Two-line'),
trailing: new Radio<MaterialListType>(
@@ -61,7 +61,7 @@ class _ListDemoState extends State<ListDemo> {
onChanged: changeItemType,
)
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Three-line'),
trailing: new Radio<MaterialListType>(
@@ -70,7 +70,7 @@ class _ListDemoState extends State<ListDemo> {
onChanged: changeItemType,
),
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Show avatar'),
trailing: new Checkbox(
@@ -83,7 +83,7 @@ class _ListDemoState extends State<ListDemo> {
},
),
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Show icon'),
trailing: new Checkbox(
@@ -96,7 +96,7 @@ class _ListDemoState extends State<ListDemo> {
},
),
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Show dividers'),
trailing: new Checkbox(
@@ -109,7 +109,7 @@ class _ListDemoState extends State<ListDemo> {
},
),
),
new ListItem(
new ListTile(
dense: true,
title: new Text('Dense layout'),
trailing: new Checkbox(
@@ -140,7 +140,7 @@ class _ListDemoState extends State<ListDemo> {
});
}
Widget buildListItem(BuildContext context, String item) {
Widget buildListTile(BuildContext context, String item) {
Widget secondary;
if (_itemType == MaterialListType.twoLine) {
secondary = new Text("Additional item information.");
@@ -149,7 +149,7 @@ class _ListDemoState extends State<ListDemo> {
"Even more additional list item information appears on line three.",
);
}
return new ListItem(
return new ListTile(
isThreeLine: _itemType == MaterialListType.threeLine,
dense: _dense,
leading: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
@@ -176,9 +176,9 @@ class _ListDemoState extends State<ListDemo> {
break;
}
Iterable<Widget> listItems = items.map((String item) => buildListItem(context, item));
Iterable<Widget> listTiles = items.map((String item) => buildListTile(context, item));
if (_showDividers)
listItems = ListItem.divideItems(context: context, items: listItems);
listTiles = ListTile.divideTiles(context: context, tiles: listTiles);
return new Scaffold(
key: scaffoldKey,
@@ -205,7 +205,7 @@ class _ListDemoState extends State<ListDemo> {
body: new Scrollbar(
child: new ListView(
padding: new EdgeInsets.symmetric(vertical: _dense ? 4.0 : 8.0),
children: listItems.toList(),
children: listTiles.toList(),
),
),
);

View File

@@ -89,7 +89,7 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows
// a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state.
new ListItem(
new ListTile(
title: new Text('An item with a context menu button'),
trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero,
@@ -113,7 +113,7 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows
// a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one.
new ListItem(
new ListTile(
title: new Text('An item with a sectioned menu'),
trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero,
@@ -121,21 +121,21 @@ class MenuDemoState extends State<MenuDemo> {
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
new PopupMenuItem<String>(
value: 'Preview',
child: new ListItem(
child: new ListTile(
leading: new Icon(Icons.visibility),
title: new Text('Preview')
)
),
new PopupMenuItem<String>(
value: 'Share',
child: new ListItem(
child: new ListTile(
leading: new Icon(Icons.person_add),
title: new Text('Share')
)
),
new PopupMenuItem<String>(
value: 'Get Link',
child: new ListItem(
child: new ListTile(
leading: new Icon(Icons.link),
title: new Text('Get link')
)
@@ -143,7 +143,7 @@ class MenuDemoState extends State<MenuDemo> {
new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771
new PopupMenuItem<String>(
value: 'Remove',
child: new ListItem(
child: new ListTile(
leading: new Icon(Icons.delete),
title: new Text('Remove')
)
@@ -158,7 +158,7 @@ class MenuDemoState extends State<MenuDemo> {
padding: EdgeInsets.zero,
initialValue: _simpleValue,
onSelected: showMenuSelection,
child: new ListItem(
child: new ListTile(
title: new Text('An item with a simple menu'),
subtitle: new Text(_simpleValue)
),
@@ -179,7 +179,7 @@ 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(
new ListTile(
title: new Text('An item with a checklist menu'),
trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero,

View File

@@ -64,7 +64,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
itemCount: _items.length,
itemBuilder: (BuildContext context, int index) {
final String item = _items[index];
return new ListItem(
return new ListTile(
isThreeLine: true,
leading: new CircleAvatar(child: new Text(item)),
title: new Text('This item represents $item.'),

View File

@@ -61,7 +61,7 @@ class ShrinePageState extends State<ShrinePage> {
return new ListView(
padding: const EdgeInsets.symmetric(vertical: 8.0),
children: config.shoppingCart.values.map((Order order) {
return new ListItem(
return new ListTile(
title: new Text(order.product.name),
leading: new Text('${order.quantity}'),
subtitle: new Text(order.product.vendor.name)

View File

@@ -26,7 +26,7 @@ class GalleryItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new ListItem(
return new ListTile(
title: new Text(title),
subtitle: new Text(subtitle),
onTap: () {