Chromium Code Reviews| 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/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 } | |
| OLD | NEW |