Move theme into material.dart

Also, introduce Colors and Typography to hold the material colors and the
typography declarations. Previously we expected clients of these libraries to
import them into a namespace, but that doesn't play nice with re-exporting them
from material.dart.
This commit is contained in:
Adam Barth 2015-09-18 09:49:20 -07:00
parent 6227554507
commit d481a3e9d1
2 changed files with 8 additions and 9 deletions

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/material.dart';
import 'package:sky/widgets.dart';
class Field extends Component {
@ -66,7 +65,7 @@ class AddressBookApp extends App {
new AspectRatio(
aspectRatio: 16.0 / 9.0,
child: new Container(
decoration: new BoxDecoration(backgroundColor: colors.Purple[300])
decoration: new BoxDecoration(backgroundColor: Colors.purple[300])
)
),
new Field(inputKey: nameKey, icon: "social/person", placeholder: "Name"),
@ -102,13 +101,13 @@ class AddressBookApp extends App {
Widget build() {
ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light,
primarySwatch: colors.Teal,
accentColor: colors.PinkAccent[100]
primarySwatch: Colors.teal,
accentColor: Colors.pinkAccent[100]
);
return new Theme(
data: theme,
child: new DefaultTextStyle(
style: typography.error, // if you see this, you've forgotten to correctly configure the text style!
style: Typography.error, // if you see this, you've forgotten to correctly configure the text style!
child: new Title(
title: 'Address Book',
child: new Navigator(_navigationState)

View File

@ -4,10 +4,10 @@
import 'dart:sky' as sky;
import 'dart:math';
import 'package:sky/services.dart';
import 'package:sky/material.dart';
import 'package:sky/painting.dart';
import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/services.dart';
import 'package:sky/widgets.dart';
// Classic minesweeper-inspired game. The mouse controls are standard
@ -184,7 +184,7 @@ class MineDiggerApp extends App {
toolbar: buildToolBar(),
body: new Container(
child: new Center(child: board),
decoration: new BoxDecoration(backgroundColor: colors.Grey[50])
decoration: new BoxDecoration(backgroundColor: Colors.grey[50])
)
)
);