Commit c4f52177 authored by Hans Muller's avatar Hans Muller

demo updates

parent 55f65930
...@@ -22,21 +22,10 @@ class TabsDemo extends StatefulComponent { ...@@ -22,21 +22,10 @@ class TabsDemo extends StatefulComponent {
} }
class _TabsDemoState extends State<TabsDemo> { class _TabsDemoState extends State<TabsDemo> {
double _viewWidth = 100.0;
void _handleSizeChanged(Size newSize) {
setState(() {
_viewWidth = newSize.width;
});
}
Widget build(_) { Widget build(_) {
return new SizeObserver( return new TabBarView<String>(
onSizeChanged: _handleSizeChanged,
child: new TabBarView<String>(
selection: _selection, selection: _selection,
items: _iconNames, items: _iconNames,
itemExtent: _viewWidth,
itemBuilder: (BuildContext context, String iconName, int index) { itemBuilder: (BuildContext context, String iconName, int index) {
return new Container( return new Container(
key: new ValueKey<String>(iconName), key: new ValueKey<String>(iconName),
...@@ -46,7 +35,6 @@ class _TabsDemoState extends State<TabsDemo> { ...@@ -46,7 +35,6 @@ class _TabsDemoState extends State<TabsDemo> {
) )
); );
} }
)
); );
} }
} }
......
...@@ -272,25 +272,15 @@ class StockHomeState extends State<StockHome> { ...@@ -272,25 +272,15 @@ class StockHomeState extends State<StockHome> {
); );
} }
double _viewWidth = 100.0;
void _handleSizeChanged(Size newSize) {
setState(() {
_viewWidth = newSize.width;
});
}
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
toolBar: _isSearching ? buildSearchBar() : buildToolBar(), toolBar: _isSearching ? buildSearchBar() : buildToolBar(),
floatingActionButton: buildFloatingActionButton(), floatingActionButton: buildFloatingActionButton(),
drawer: _buildDrawer(context), drawer: _buildDrawer(context),
body: new SizeObserver( body: new TabBarView<StockHomeTab>(
onSizeChanged: _handleSizeChanged,
child: new TabBarView<StockHomeTab>(
selection: _tabBarSelection, selection: _tabBarSelection,
items: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio], items: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio],
itemExtent: _viewWidth,
itemBuilder: (BuildContext context, StockHomeTab tab, _) { itemBuilder: (BuildContext context, StockHomeTab tab, _) {
switch (tab) { switch (tab) {
case StockHomeTab.market: case StockHomeTab.market:
...@@ -302,7 +292,6 @@ class StockHomeState extends State<StockHome> { ...@@ -302,7 +292,6 @@ class StockHomeState extends State<StockHome> {
} }
} }
) )
)
); );
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment