Simplify TabView API

Instead of taking a builder and a generic type, we can just take a
List<Widget>.
This commit is contained in:
Adam Barth
2016-01-10 21:29:37 -08:00
parent f757211f02
commit dd08bf7973
5 changed files with 23 additions and 39 deletions

View File

@@ -85,9 +85,8 @@ class TabViewDemo extends StatelessComponent {
)
),
new Flexible(
child: new TabBarView<String>(
items: _iconNames,
itemBuilder: _buildTabView
child: new TabBarView(
children: _iconNames.map(_buildTabView).toList()
)
)
]);

View File

@@ -27,9 +27,8 @@ class TabsDemo extends StatefulComponent {
class _TabsDemoState extends State<TabsDemo> {
Widget build(_) {
return new TabBarView<String>(
items: _iconNames,
itemBuilder: (String iconName) {
return new TabBarView(
children: _iconNames.map((String iconName) {
return new Container(
key: new ValueKey<String>(iconName),
padding: const EdgeDims.all(12.0),
@@ -37,7 +36,7 @@ class _TabsDemoState extends State<TabsDemo> {
child: new Center(child: new Icon(icon: "action/$iconName", size:IconSize.s48))
)
);
}
}).toList()
);
}
}