| Index: sky/sdk/example/widgets/tabs.dart
|
| diff --git a/sky/sdk/example/widgets/tabs.dart b/sky/sdk/example/widgets/tabs.dart
|
| index 872a3e719152aea9be79dde986b5eeeafbfe5b54..411495f9bc8ca65e84ea59e4d34b7cf7d3a7ef1e 100644
|
| --- a/sky/sdk/example/widgets/tabs.dart
|
| +++ b/sky/sdk/example/widgets/tabs.dart
|
| @@ -14,12 +14,13 @@ import 'package:sky/widgets/widget.dart';
|
|
|
| class TabbedNavigatorApp extends App {
|
| // The index of the selected tab for each of the TabNavigators constructed below.
|
| - List<int> selectedIndices = new List<int>.filled(4, 0);
|
| + List<int> selectedIndices = new List<int>.filled(5, 0);
|
|
|
| - TabNavigator _buildTabNavigator(int n, List<TabNavigatorView> views) {
|
| + TabNavigator _buildTabNavigator(int n, List<TabNavigatorView> views, {scrollable: false}) {
|
| return new TabNavigator(
|
| views: views,
|
| selectedIndex: selectedIndices[n],
|
| + scrollable: scrollable,
|
| onChanged: (tabIndex) {
|
| setState(() { selectedIndices[n] = tabIndex; } );
|
| }
|
| @@ -72,31 +73,59 @@ class TabbedNavigatorApp extends App {
|
| return _buildTabNavigator(n, views);
|
| }
|
|
|
| + TabNavigator _buildScrollableTabNavigator(int n) {
|
| + Iterable<TabNavigatorView> views = [
|
| + "MIN WIDTH",
|
| + "THIS TAB LABEL IS SO WIDE THAT IT OCCUPIES TWO LINES",
|
| + "THIS TAB IS PRETTY WIDE TOO",
|
| + "MORE",
|
| + "TABS",
|
| + "TO",
|
| + "STRETCH",
|
| + "OUT",
|
| + "THE",
|
| + "TAB BAR"
|
| + ]
|
| + .map((text) {
|
| + return new TabNavigatorView(
|
| + label: new TabLabel(text: text),
|
| + builder: () => _buildContent(text)
|
| + );
|
| + });
|
| + return _buildTabNavigator(n, views.toList(), scrollable: true);
|
| + }
|
| +
|
| +
|
| Container _buildCard(TabNavigator tabNavigator) {
|
| return new Container(
|
| - child: new Card(child: tabNavigator),
|
| + child: new Card(child: new Padding(child: tabNavigator, padding: const EdgeDims.all(8.0))),
|
| padding: const EdgeDims.all(12.0),
|
| decoration: new BoxDecoration(backgroundColor: Theme.of(this).primary[50])
|
| );
|
| }
|
|
|
| Widget build() {
|
| + int n = 0;
|
| List<TabNavigatorView> views = <TabNavigatorView>[
|
| new TabNavigatorView(
|
| label: const TabLabel(text: 'TEXT'),
|
| - builder: () => _buildCard(_buildTextLabelsTabNavigator(0))
|
| + builder: () => _buildCard(_buildTextLabelsTabNavigator(n++))
|
| ),
|
| new TabNavigatorView(
|
| label: const TabLabel(text: 'ICONS'),
|
| - builder: () => _buildCard(_buildIconLabelsTabNavigator(1))
|
| + builder: () => _buildCard(_buildIconLabelsTabNavigator(n++))
|
| ),
|
| new TabNavigatorView(
|
| label: const TabLabel(text: 'BOTH'),
|
| - builder: () => _buildCard(_buildTextAndIconLabelsTabNavigator(2))
|
| + builder: () => _buildCard(_buildTextAndIconLabelsTabNavigator(n++))
|
| + ),
|
| + new TabNavigatorView(
|
| + label: const TabLabel(text: 'SCROLL'),
|
| + builder: () => _buildCard(_buildScrollableTabNavigator(n++))
|
| )
|
| ];
|
|
|
| - TabNavigator tabNavigator = _buildTabNavigator(3, views);
|
| + TabNavigator tabNavigator = _buildTabNavigator(n++, views);
|
|
|
| ToolBar toolbar = new ToolBar(
|
| center: new Text('Tabbed Navigator', style: typography.white.title)
|
|
|