main.dart 2.14 KB
Newer Older
1 2 3 4
// 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.

5
import 'package:flutter/material.dart';
6

7 8 9 10 11 12
final GlobalKey _kNameKey = new GlobalKey(debugLabel: 'name field');
final GlobalKey _kPhoneKey = new GlobalKey(debugLabel: 'phone field');
final GlobalKey _kEmailKey = new GlobalKey(debugLabel: 'email field');
final GlobalKey _kAddressKey = new GlobalKey(debugLabel: 'address field');
final GlobalKey _kRingtoneKey = new GlobalKey(debugLabel: 'ringtone field');
final GlobalKey _kNoteKey = new GlobalKey(debugLabel: 'note field');
13

Adam Barth's avatar
Adam Barth committed
14 15
class AddressBookHome extends StatelessComponent {
  Widget build(BuildContext context) {
16
    return new Scaffold(
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
      toolBar: new ToolBar(
        center: new Text('Edit contact'),
        right: <Widget>[
          new IconButton(icon: 'navigation/check')
        ]
      ),
      body: new Block(
        children: <Widget>[
          new AspectRatio(
            aspectRatio: 16.0 / 9.0,
            child: new Container(
              decoration: new BoxDecoration(backgroundColor: Colors.purple[300])
            )
          ),
          new Input(key: _kNameKey, icon: 'social/person', labelText: 'Name', style: Typography.black.display1),
          new Input(key: _kPhoneKey, icon: 'communication/phone', hintText: 'Phone'),
          new Input(key: _kEmailKey, icon: 'communication/email', hintText: 'Email'),
          new Input(key: _kAddressKey, icon: 'maps/place', hintText: 'Address'),
          new Input(key: _kRingtoneKey, icon: 'av/volume_up', hintText: 'Ringtone'),
          new Input(key: _kNoteKey, icon: 'content/add', hintText: 'Add note'),
        ]
      ),
      floatingActionButton: new FloatingActionButton(
        child: new Icon(icon: 'image/photo_camera')
      )
Eric Seidel's avatar
Eric Seidel committed
42 43
    );
  }
44 45
}

Adam Barth's avatar
Adam Barth committed
46 47 48 49 50 51
final ThemeData theme = new ThemeData(
  brightness: ThemeBrightness.light,
  primarySwatch: Colors.teal,
  accentColor: Colors.pinkAccent[100]
);

52
void main() {
Adam Barth's avatar
Adam Barth committed
53
  runApp(new MaterialApp(
Adam Barth's avatar
Adam Barth committed
54 55 56
    title: 'Address Book',
    theme: theme,
    routes: <String, RouteBuilder>{
Adam Barth's avatar
Adam Barth committed
57
      '/': (RouteArguments args) => new AddressBookHome()
Adam Barth's avatar
Adam Barth committed
58 59
    }
  ));
60
}