Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: sky/examples/widgets/tabs.dart

Issue 1205953002: Version 0 of TabLabel, Tab, and TabBar components (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Updates per Ian's feedback Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/sdk/BUILD.gn » ('j') | sky/sdk/lib/widgets/tabs.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/widgets/tabs.dart
diff --git a/sky/examples/widgets/tabs.dart b/sky/examples/widgets/tabs.dart
new file mode 100644
index 0000000000000000000000000000000000000000..72bce2776aa86f692914cb401aac6008e81ee6dc
--- /dev/null
+++ b/sky/examples/widgets/tabs.dart
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:sky/rendering/sky_binding.dart';
+import 'package:sky/theme/colors.dart';
+import 'package:sky/theme/typography.dart';
+import 'package:sky/widgets/basic.dart';
+import 'package:sky/widgets/material.dart';
+import 'package:sky/widgets/scaffold.dart';
+import 'package:sky/widgets/tabs.dart';
+import 'package:sky/widgets/tool_bar.dart';
+import 'package:sky/widgets/widget.dart';
+
+class TabbedNavigatorApp extends App {
+ Widget build() {
+ Iterable<String> items = <String>["ONE", "TWO", "FREE", "FOUR"];
+
+ Iterable<TabLabel> textLabels = items
+ .map((s) => new TabLabel(text: "ITEM " + s));
+
+ Iterable<TabLabel> iconLabels = items
+ .map((s) => new TabLabel(icon: 'action/search_white'));
+
+ Iterable<TabLabel> textAndIconLabels = items
+ .map((s) => new TabLabel(text: "ITEM " + s, icon: 'action/search_white'));
+
+ Iterable<Widget> tabNavigators = [textLabels, iconLabels, textAndIconLabels]
+ .map((labels) {
+ return new Container(
+ child: new TabBar(labels: labels.toList()),
+ margin: new EdgeDims.only(bottom: 16.0)
+ );
+ });
+
+ ToolBar toolbar = new ToolBar(
+ center: new Text('Tabbed Navigator', style: white.title),
+ backgroundColor: Blue[500]);
+
+ return new Scaffold(
+ toolbar: toolbar,
+ body: new Material(
+ child: new Center(child: new Block(tabNavigators.toList())),
+ color: Grey[500]
+ )
+ );
+ }
+}
+
+void main() {
+ runApp(new TabbedNavigatorApp());
+ SkyBinding.instance.onFrame = () {
+ // uncomment this for debugging:
+ // SkyBinding.instance.debugDumpRenderTree();
+ };
+}
« no previous file with comments | « no previous file | sky/sdk/BUILD.gn » ('j') | sky/sdk/lib/widgets/tabs.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698