demo updates
This commit is contained in:
@@ -22,31 +22,19 @@ class TabsDemo extends StatefulComponent {
|
||||
}
|
||||
|
||||
class _TabsDemoState extends State<TabsDemo> {
|
||||
double _viewWidth = 100.0;
|
||||
|
||||
void _handleSizeChanged(Size newSize) {
|
||||
setState(() {
|
||||
_viewWidth = newSize.width;
|
||||
});
|
||||
}
|
||||
|
||||
Widget build(_) {
|
||||
return new SizeObserver(
|
||||
onSizeChanged: _handleSizeChanged,
|
||||
child: new TabBarView<String>(
|
||||
selection: _selection,
|
||||
items: _iconNames,
|
||||
itemExtent: _viewWidth,
|
||||
itemBuilder: (BuildContext context, String iconName, int index) {
|
||||
return new Container(
|
||||
key: new ValueKey<String>(iconName),
|
||||
padding: const EdgeDims.all(12.0),
|
||||
child: new Card(
|
||||
child: new Center(child: new Icon(icon: "action/$iconName", size:IconSize.s48))
|
||||
)
|
||||
);
|
||||
}
|
||||
)
|
||||
return new TabBarView<String>(
|
||||
selection: _selection,
|
||||
items: _iconNames,
|
||||
itemBuilder: (BuildContext context, String iconName, int index) {
|
||||
return new Container(
|
||||
key: new ValueKey<String>(iconName),
|
||||
padding: const EdgeDims.all(12.0),
|
||||
child: new Card(
|
||||
child: new Center(child: new Icon(icon: "action/$iconName", size:IconSize.s48))
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,36 +272,25 @@ class StockHomeState extends State<StockHome> {
|
||||
);
|
||||
}
|
||||
|
||||
double _viewWidth = 100.0;
|
||||
void _handleSizeChanged(Size newSize) {
|
||||
setState(() {
|
||||
_viewWidth = newSize.width;
|
||||
});
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
key: _scaffoldKey,
|
||||
toolBar: _isSearching ? buildSearchBar() : buildToolBar(),
|
||||
floatingActionButton: buildFloatingActionButton(),
|
||||
drawer: _buildDrawer(context),
|
||||
body: new SizeObserver(
|
||||
onSizeChanged: _handleSizeChanged,
|
||||
child: new TabBarView<StockHomeTab>(
|
||||
selection: _tabBarSelection,
|
||||
items: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio],
|
||||
itemExtent: _viewWidth,
|
||||
itemBuilder: (BuildContext context, StockHomeTab tab, _) {
|
||||
switch (tab) {
|
||||
case StockHomeTab.market:
|
||||
return _buildStockTab(context, tab, config.symbols);
|
||||
case StockHomeTab.portfolio:
|
||||
return _buildStockTab(context, tab, portfolioSymbols);
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
body: new TabBarView<StockHomeTab>(
|
||||
selection: _tabBarSelection,
|
||||
items: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio],
|
||||
itemBuilder: (BuildContext context, StockHomeTab tab, _) {
|
||||
switch (tab) {
|
||||
case StockHomeTab.market:
|
||||
return _buildStockTab(context, tab, config.symbols);
|
||||
case StockHomeTab.portfolio:
|
||||
return _buildStockTab(context, tab, portfolioSymbols);
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user