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

Side by Side Diff: sky/sdk/example/address_book/lib/main.dart

Issue 1234963002: Start an AddressBook example (to test text fields) (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/editing/input.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/theme/colors.dart' as colors;
6 import 'package:sky/theme/typography.dart' as typography;
7 import 'package:sky/widgets/basic.dart';
8 import 'package:sky/widgets/default_text_style.dart';
9 import 'package:sky/widgets/navigator.dart';
10 import 'package:sky/widgets/theme.dart';
11 import 'package:sky/widgets/widget.dart';
12 import 'package:sky/widgets/task_description.dart';
13 import 'package:sky/widgets/scaffold.dart';
14 import 'package:sky/widgets/tool_bar.dart';
15 import 'package:sky/widgets/icon_button.dart';
16 import 'package:sky/widgets/floating_action_button.dart';
17 import 'package:sky/widgets/icon.dart';
18 import 'package:sky/widgets/material.dart';
19 import 'package:sky/editing/input.dart';
20
21 class Field extends Container {
22 Field({this.icon: null, this.placeholder: null});
23
24 String icon;
25 String placeholder;
26
27 Widget build() {
28 return new Flex([
29 new Padding(
30 padding: const EdgeDims.symmetric(horizontal: 16.0),
31 child: new Icon(type:icon, size:24)
32 ),
33 new Flexible(child:new Input(placeholder:placeholder))
34 ],
35 direction: FlexDirection.horizontal
36 );
37 }
38 }
39
40
41 class AddressBookApp extends App {
42
43 Widget buildToolBar() {
44 return new ToolBar(
45 left: new IconButton(icon: "navigation/arrow_back"),
46 right: [new IconButton(icon: "navigation/check")]
47 );
48 }
49
50 Widget buildFloatingActionButton() {
51 return new FloatingActionButton(
52 child: new Icon(type: 'image/photo_camera', size: 24),
53 backgroundColor: Theme.of(this).accentColor
54 );
55 }
56
57 Widget buildBody() {
58 return new Material(
59 child:new Block([
60 new Field(icon:"social/person", placeholder:"Name"),
abarth-chromium 2015/07/13 18:28:47 s/:"/: "/
61 new Field(icon: "communication/phone", placeholder:"Phone"),
62 new Field(icon: "communication/email", placeholder:"Email"),
63 new Field(icon: "maps/place", placeholder:"Address"),
64 new Field(icon: "av/volume_up", placeholder:"Ringtone"),
65 new Field(icon: "content/add", placeholder:"Add note"),
66 ])
67 );
68 }
69
70 Widget buildMain() {
71 return new Scaffold(
72 toolbar: buildToolBar(),
73 body: buildBody(),
74 floatingActionButton: buildFloatingActionButton()
75 );
76 }
77
78 Widget build() {
79
80 ThemeData theme = new ThemeData(
81 brightness: ThemeBrightness.light,
82 primarySwatch: colors.Teal,
83 accentColor: colors.PinkAccent[100]
84 );
85
86 return new Theme(
87 data: theme,
88 child: new DefaultTextStyle(
89 style: typography.error, // if you see this, you've forgotten to corre ctly configure the text style!
90 child: new TaskDescription(
91 label: 'Address Book',
92 child: buildMain()
93 )
94 )
95 );
96 }
97 }
98
99 void main() {
100 runApp(new AddressBookApp());
101 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/editing/input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698