OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 import 'package:sky/rendering/sky_binding.dart'; |
| 6 import 'package:sky/theme/colors.dart'; |
| 7 import 'package:sky/theme/typography.dart'; |
| 8 import 'package:sky/widgets/basic.dart'; |
| 9 import 'package:sky/widgets/material.dart'; |
| 10 import 'package:sky/widgets/scaffold.dart'; |
| 11 import 'package:sky/widgets/tabs.dart'; |
| 12 import 'package:sky/widgets/tool_bar.dart'; |
| 13 import 'package:sky/widgets/widget.dart'; |
| 14 |
| 15 class TabbedNavigatorApp extends App { |
| 16 Widget build() { |
| 17 Iterable<String> items = <String>["ONE", "TWO", "FREE", "FOUR"]; |
| 18 |
| 19 Iterable<TabLabel> textLabels = items |
| 20 .map((s) => new TabLabel(text: "ITEM " + s)); |
| 21 |
| 22 Iterable<TabLabel> iconLabels = items |
| 23 .map((s) => new TabLabel(icon: 'action/search_white')); |
| 24 |
| 25 Iterable<TabLabel> textAndIconLabels = items |
| 26 .map((s) => new TabLabel(text: "ITEM " + s, icon: 'action/search_white')); |
| 27 |
| 28 Iterable<Widget> tabNavigators = [textLabels, iconLabels, textAndIconLabels] |
| 29 .map((labels) { |
| 30 return new Container( |
| 31 child: new TabBar(labels: labels.toList()), |
| 32 margin: new EdgeDims.only(bottom: 16.0) |
| 33 ); |
| 34 }); |
| 35 |
| 36 ToolBar toolbar = new ToolBar( |
| 37 center: new Text('Tabbed Navigator', style: white.title), |
| 38 backgroundColor: Blue[500]); |
| 39 |
| 40 return new Scaffold( |
| 41 toolbar: toolbar, |
| 42 body: new Material( |
| 43 child: new Center(child: new Block(tabNavigators.toList())), |
| 44 color: Grey[500] |
| 45 ) |
| 46 ); |
| 47 } |
| 48 } |
| 49 |
| 50 void main() { |
| 51 runApp(new TabbedNavigatorApp()); |
| 52 SkyBinding.instance.onFrame = () { |
| 53 // uncomment this for debugging: |
| 54 // SkyBinding.instance.debugDumpRenderTree(); |
| 55 }; |
| 56 } |
OLD | NEW |