Commit 4467a268 authored by Adam Barth's avatar Adam Barth

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.
parent 499d8322
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class Field extends Component { class Field extends Component {
...@@ -66,7 +65,7 @@ class AddressBookApp extends App { ...@@ -66,7 +65,7 @@ class AddressBookApp extends App {
new AspectRatio( new AspectRatio(
aspectRatio: 16.0 / 9.0, aspectRatio: 16.0 / 9.0,
child: new Container( 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"), new Field(inputKey: nameKey, icon: "social/person", placeholder: "Name"),
...@@ -102,13 +101,13 @@ class AddressBookApp extends App { ...@@ -102,13 +101,13 @@ class AddressBookApp extends App {
Widget build() { Widget build() {
ThemeData theme = new ThemeData( ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Teal, primarySwatch: Colors.teal,
accentColor: colors.PinkAccent[100] accentColor: Colors.pinkAccent[100]
); );
return new Theme( return new Theme(
data: theme, data: theme,
child: new DefaultTextStyle( 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( child: new Title(
title: 'Address Book', title: 'Address Book',
child: new Navigator(_navigationState) child: new Navigator(_navigationState)
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
AssetBundle _initBundle() { AssetBundle _initBundle() {
...@@ -58,7 +57,7 @@ class SkyDemo { ...@@ -58,7 +57,7 @@ class SkyDemo {
final String href; final String href;
final String bundle; final String bundle;
final String description; final String description;
final typography.TextTheme textTheme; final TextTheme textTheme;
final BoxDecoration decoration; final BoxDecoration decoration;
} }
...@@ -68,7 +67,7 @@ List<SkyDemo> demos = [ ...@@ -68,7 +67,7 @@ List<SkyDemo> demos = [
href: '../../stocks/lib/main.dart', href: '../../stocks/lib/main.dart',
bundle: 'stocks.skyx', bundle: 'stocks.skyx',
description: 'Multi-screen app with scrolling list', description: 'Multi-screen app with scrolling list',
textTheme: typography.black, textTheme: Typography.black,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundImage: new BackgroundImage( backgroundImage: new BackgroundImage(
image: _bundle.loadImage('assets/stocks_thumbnail.png'), image: _bundle.loadImage('assets/stocks_thumbnail.png'),
...@@ -81,7 +80,7 @@ List<SkyDemo> demos = [ ...@@ -81,7 +80,7 @@ List<SkyDemo> demos = [
href: '../../game/lib/main.dart', href: '../../game/lib/main.dart',
bundle: 'game.skyx', bundle: 'game.skyx',
description: '2D game using sprite sheets', description: '2D game using sprite sheets',
textTheme: typography.white, textTheme: Typography.white,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundImage: new BackgroundImage( backgroundImage: new BackgroundImage(
image: _bundle.loadImage('assets/game_thumbnail.png'), image: _bundle.loadImage('assets/game_thumbnail.png'),
...@@ -94,9 +93,9 @@ List<SkyDemo> demos = [ ...@@ -94,9 +93,9 @@ List<SkyDemo> demos = [
href: '../../fitness/lib/main.dart', href: '../../fitness/lib/main.dart',
bundle: 'fitness.skyx', bundle: 'fitness.skyx',
description: 'Track progress towards healthy goals', description: 'Track progress towards healthy goals',
textTheme: typography.white, textTheme: Typography.white,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: colors.Indigo[500] backgroundColor: Colors.indigo[500]
) )
), ),
new SkyDemo( new SkyDemo(
...@@ -104,9 +103,9 @@ List<SkyDemo> demos = [ ...@@ -104,9 +103,9 @@ List<SkyDemo> demos = [
href: '../../widgets/card_collection.dart', href: '../../widgets/card_collection.dart',
bundle: 'cards.skyx', bundle: 'cards.skyx',
description: 'Infinite list of swipeable cards', description: 'Infinite list of swipeable cards',
textTheme: typography.white, textTheme: Typography.white,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: colors.RedAccent[200] backgroundColor: Colors.redAccent[200]
) )
), ),
new SkyDemo( new SkyDemo(
...@@ -114,7 +113,7 @@ List<SkyDemo> demos = [ ...@@ -114,7 +113,7 @@ List<SkyDemo> demos = [
href: '../../rendering/interactive_flex.dart', href: '../../rendering/interactive_flex.dart',
bundle: 'interactive_flex.skyx', bundle: 'interactive_flex.skyx',
description: 'Swipe to reflow the app', description: 'Swipe to reflow the app',
textTheme: typography.white, textTheme: Typography.white,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: const Color(0xFF0081C6) backgroundColor: const Color(0xFF0081C6)
) )
...@@ -127,9 +126,9 @@ List<SkyDemo> demos = [ ...@@ -127,9 +126,9 @@ List<SkyDemo> demos = [
href: '../../mine_digger/lib/main.dart', href: '../../mine_digger/lib/main.dart',
bundle: 'mine_digger.skyx', bundle: 'mine_digger.skyx',
description: 'Clone of the classic Minesweeper game', description: 'Clone of the classic Minesweeper game',
textTheme: typography.white, textTheme: Typography.white,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: colors.black backgroundColor: Colors.black
) )
), ),
...@@ -188,7 +187,7 @@ class SkyHome extends App { ...@@ -188,7 +187,7 @@ class SkyHome extends App {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Teal primarySwatch: Colors.teal
), ),
child: new Title( child: new Title(
title: 'Sky Demos', title: 'Sky Demos',
......
...@@ -6,9 +6,10 @@ library fitness; ...@@ -6,9 +6,10 @@ library fitness;
import 'package:playfair/playfair.dart' as playfair; import 'package:playfair/playfair.dart' as playfair;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'user_data.dart'; import 'user_data.dart';
import 'date_utils.dart'; import 'date_utils.dart';
import 'dart:async'; import 'dart:async';
...@@ -171,8 +172,8 @@ class FitnessApp extends App { ...@@ -171,8 +172,8 @@ class FitnessApp extends App {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Indigo, primarySwatch: Colors.indigo,
accentColor: colors.PinkAccent[200] accentColor: Colors.pinkAccent[200]
), ),
child: new Title( child: new Title(
title: 'Fitness', title: 'Fitness',
......
...@@ -2,7 +2,7 @@ name: fitness ...@@ -2,7 +2,7 @@ name: fitness
dependencies: dependencies:
sky: any sky: any
sky_tools: any sky_tools: any
playfair: ^0.0.7 playfair: ^0.0.8
path: ^1.3.6 path: ^1.3.6
dependency_overrides: dependency_overrides:
material_design_icons: material_design_icons:
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
import 'dart:async'; import 'dart:async';
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/services.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/button_base.dart'; import 'package:sky/src/widgets/button_base.dart';
...@@ -13,7 +14,6 @@ import 'package:sky/src/widgets/framework.dart'; ...@@ -13,7 +14,6 @@ import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/navigator.dart'; import 'package:sky/src/widgets/navigator.dart';
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
import 'package:sky/src/widgets/title.dart'; import 'package:sky/src/widgets/title.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
import 'game_demo.dart'; import 'game_demo.dart';
...@@ -99,7 +99,7 @@ class GameDemoApp extends App { ...@@ -99,7 +99,7 @@ class GameDemoApp extends App {
// a custom theme swatch to match the purples in the sprites. // a custom theme swatch to match the purples in the sprites.
ThemeData theme = new ThemeData( ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Purple primarySwatch: Colors.purple
); );
return new Theme( return new Theme(
......
import 'dart:sky'; import 'dart:sky';
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
...@@ -37,7 +37,7 @@ class TestDrawAtlasApp extends App { ...@@ -37,7 +37,7 @@ class TestDrawAtlasApp extends App {
Widget build() { Widget build() {
ThemeData theme = new ThemeData( ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Purple primarySwatch: Colors.purple
); );
return new Theme( return new Theme(
......
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
...@@ -38,7 +38,7 @@ class TestApp extends App { ...@@ -38,7 +38,7 @@ class TestApp extends App {
Widget build() { Widget build() {
ThemeData theme = new ThemeData( ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Purple primarySwatch: Colors.purple
); );
return new Theme( return new Theme(
......
import 'dart:sky' as sky; import 'package:sky/material.dart';
import 'package:sky/services.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
...@@ -50,7 +48,7 @@ class TestApp extends App { ...@@ -50,7 +48,7 @@ class TestApp extends App {
Widget build() { Widget build() {
ThemeData theme = new ThemeData( ThemeData theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Purple primarySwatch: Colors.purple
); );
return new Theme( return new Theme(
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'dart:math'; import 'dart:math';
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
// Classic minesweeper-inspired game. The mouse controls are standard // Classic minesweeper-inspired game. The mouse controls are standard
...@@ -184,7 +184,7 @@ class MineDiggerApp extends App { ...@@ -184,7 +184,7 @@ class MineDiggerApp extends App {
toolbar: buildToolBar(), toolbar: buildToolBar(),
body: new Container( body: new Container(
child: new Center(child: board), child: new Center(child: board),
decoration: new BoxDecoration(backgroundColor: colors.Grey[50]) decoration: new BoxDecoration(backgroundColor: Colors.grey[50])
) )
) )
); );
......
...@@ -4,14 +4,15 @@ ...@@ -4,14 +4,15 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'solid_color_box.dart'; import 'solid_color_box.dart';
Color randomColor() { Color randomColor() {
final List<Color> allColors = [ final List<Color> allColors = [
colors.Blue, Colors.blue,
colors.Indigo Colors.indigo
].map((p) => p.values).fold([], (a, b) => a..addAll(b)); ].map((p) => p.values).fold([], (a, b) => a..addAll(b));
final random = new math.Random(); final random = new math.Random();
return allColors[random.nextInt(allColors.length)]; return allColors[random.nextInt(allColors.length)];
......
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
import 'dart:sky'; import 'dart:sky';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/theme/shadows.dart';
void main() { void main() {
var coloredBox = new RenderDecoratedBox( var coloredBox = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
gradient: new RadialGradient( gradient: new RadialGradient(
center: Point.origin, radius: 500.0, center: Point.origin, radius: 500.0,
colors: [colors.Yellow[500], colors.Blue[500]]), colors: [Colors.yellow[500], Colors.blue[500]]),
boxShadow: shadows[3]) boxShadow: shadows[3])
); );
var paddedBox = new RenderPadding( var paddedBox = new RenderPadding(
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
// Material design colors. :p // Material design colors. :p
List<Color> kColors = [ List<Color> kColors = [
colors.Teal[500], Colors.teal[500],
colors.Amber[500], Colors.amber[500],
colors.Purple[500], Colors.purple[500],
colors.LightBlue[500], Colors.lightBlue[500],
colors.DeepPurple[500], Colors.deepPurple[500],
colors.Lime[500], Colors.lime[500],
]; ];
class Dot { class Dot {
......
...@@ -7,9 +7,8 @@ library stocks; ...@@ -7,9 +7,8 @@ library stocks;
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'stock_data.dart'; import 'stock_data.dart';
...@@ -82,19 +81,19 @@ class StocksApp extends App { ...@@ -82,19 +81,19 @@ class StocksApp extends App {
if (optimismSetting == StockMode.optimistic) { if (optimismSetting == StockMode.optimistic) {
theme = new ThemeData( theme = new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Purple primarySwatch: Colors.purple
); );
} else { } else {
theme = new ThemeData( theme = new ThemeData(
brightness: ThemeBrightness.dark, brightness: ThemeBrightness.dark,
accentColor: colors.RedAccent[200] accentColor: Colors.redAccent[200]
); );
} }
return new Theme( return new Theme(
data: theme, data: theme,
child: new DefaultTextStyle( 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( child: new Title(
title: 'Stocks', title: 'Stocks',
child: new Navigator(_navigationState) child: new Navigator(_navigationState)
......
...@@ -18,8 +18,8 @@ class StockArrow extends Component { ...@@ -18,8 +18,8 @@ class StockArrow extends Component {
Color _colorForPercentChange(double percentChange) { Color _colorForPercentChange(double percentChange) {
if (percentChange > 0) if (percentChange > 0)
return colors.Green[_colorIndexForPercentChange(percentChange)]; return Colors.green[_colorIndexForPercentChange(percentChange)];
return colors.Red[_colorIndexForPercentChange(percentChange)]; return Colors.red[_colorIndexForPercentChange(percentChange)];
} }
Widget build() { Widget build() {
......
...@@ -275,7 +275,7 @@ class StockHome extends StatefulComponent { ...@@ -275,7 +275,7 @@ class StockHome extends StatefulComponent {
return _snackBarAnchor.build( return _snackBarAnchor.build(
new FloatingActionButton( new FloatingActionButton(
child: new Icon(type: 'content/add', size: 24), child: new Icon(type: 'content/add', size: 24),
backgroundColor: colors.RedAccent[200], backgroundColor: Colors.redAccent[200],
onPressed: _handleStockPurchased onPressed: _handleStockPurchased
)); ));
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:sky/theme/colors.dart' as colors;
class BigSwitchApp extends App { class BigSwitchApp extends App {
bool _value = false; bool _value = false;
...@@ -22,7 +22,7 @@ class BigSwitchApp extends App { ...@@ -22,7 +22,7 @@ class BigSwitchApp extends App {
padding: new EdgeDims.all(20.0), padding: new EdgeDims.all(20.0),
transform: scale, transform: scale,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: colors.Teal[600] backgroundColor: Colors.teal[600]
) )
); );
} }
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class CardModel { class CardModel {
...@@ -19,10 +18,10 @@ class CardModel { ...@@ -19,10 +18,10 @@ class CardModel {
class CardCollectionApp extends App { class CardCollectionApp extends App {
static const TextStyle cardLabelStyle = static const TextStyle cardLabelStyle =
const TextStyle(color: colors.white, fontSize: 18.0, fontWeight: bold); const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: bold);
final TextStyle backgroundTextStyle = final TextStyle backgroundTextStyle =
typography.white.title.copyWith(textAlign: TextAlign.center); Typography.white.title.copyWith(textAlign: TextAlign.center);
MixedViewportLayoutState _layoutState = new MixedViewportLayoutState(); MixedViewportLayoutState _layoutState = new MixedViewportLayoutState();
List<CardModel> _cardModels; List<CardModel> _cardModels;
...@@ -38,7 +37,7 @@ class CardCollectionApp extends App { ...@@ -38,7 +37,7 @@ class CardCollectionApp extends App {
48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0 48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0
]; ];
_cardModels = new List.generate(cardHeights.length, (i) { _cardModels = new List.generate(cardHeights.length, (i) {
Color color = Color.lerp(colors.Red[300], colors.Blue[900], i / cardHeights.length); Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardHeights.length);
return new CardModel(i, cardHeights[i], color); return new CardModel(i, cardHeights[i], color);
}); });
super.initState(); super.initState();
...@@ -211,8 +210,8 @@ class CardCollectionApp extends App { ...@@ -211,8 +210,8 @@ class CardCollectionApp extends App {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Blue, primarySwatch: Colors.blue,
accentColor: colors.RedAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title( child: new Title(
title: 'Cards', title: 'Cards',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
void main() => runApp(new DatePickerDemo()); void main() => runApp(new DatePickerDemo());
...@@ -26,7 +26,7 @@ class DatePickerDemo extends App { ...@@ -26,7 +26,7 @@ class DatePickerDemo extends App {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Teal primarySwatch: Colors.teal
), ),
child: new Stack([ child: new Stack([
new Scaffold( new Scaffold(
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
final double kTop = 10.0 + sky.view.paddingTop; final double kTop = 10.0 + sky.view.paddingTop;
...@@ -39,9 +39,9 @@ class ExampleDragTarget extends StatefulComponent { ...@@ -39,9 +39,9 @@ class ExampleDragTarget extends StatefulComponent {
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border.all( border: new Border.all(
width: 3.0, width: 3.0,
color: data.isEmpty ? colors.white : colors.Blue[500] color: data.isEmpty ? Colors.white : Colors.blue[500]
), ),
backgroundColor: data.isEmpty ? colors.Grey[500] : colors.Green[500] backgroundColor: data.isEmpty ? Colors.grey[500] : Colors.green[500]
), ),
child: new Center( child: new Center(
child: new Text(_text) child: new Text(_text)
...@@ -58,7 +58,7 @@ class Dot extends Component { ...@@ -58,7 +58,7 @@ class Dot extends Component {
width: 50.0, width: 50.0,
height: 50.0, height: 50.0,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: colors.DeepOrange[500] backgroundColor: Colors.deepOrange[500]
) )
); );
} }
...@@ -140,7 +140,7 @@ class DragAndDropApp extends App { ...@@ -140,7 +140,7 @@ class DragAndDropApp extends App {
} }
return new Container( return new Container(
decoration: new BoxDecoration(backgroundColor: colors.Pink[500]), decoration: new BoxDecoration(backgroundColor: Colors.pink[500]),
child: new Stack(layers) child: new Stack(layers)
); );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class CardModel { class CardModel {
...@@ -17,10 +17,10 @@ class CardModel { ...@@ -17,10 +17,10 @@ class CardModel {
class EnsureVisibleApp extends App { class EnsureVisibleApp extends App {
static const TextStyle cardLabelStyle = static const TextStyle cardLabelStyle =
const TextStyle(color: colors.white, fontSize: 18.0, fontWeight: bold); const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: bold);
static const TextStyle selectedCardLabelStyle = static const TextStyle selectedCardLabelStyle =
const TextStyle(color: colors.white, fontSize: 24.0, fontWeight: bold); const TextStyle(color: Colors.white, fontSize: 24.0, fontWeight: bold);
List<CardModel> cardModels; List<CardModel> cardModels;
MixedViewportLayoutState layoutState = new MixedViewportLayoutState(); MixedViewportLayoutState layoutState = new MixedViewportLayoutState();
...@@ -33,7 +33,7 @@ class EnsureVisibleApp extends App { ...@@ -33,7 +33,7 @@ class EnsureVisibleApp extends App {
48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0 48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0
]; ];
cardModels = new List.generate(cardHeights.length, (i) { cardModels = new List.generate(cardHeights.length, (i) {
Color color = Color.lerp(colors.Red[300], colors.Blue[900], i / cardHeights.length); Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardHeights.length);
return new CardModel(i, cardHeights[i], color); return new CardModel(i, cardHeights[i], color);
}); });
...@@ -83,8 +83,8 @@ class EnsureVisibleApp extends App { ...@@ -83,8 +83,8 @@ class EnsureVisibleApp extends App {
child: new Theme( child: new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Blue, primarySwatch: Colors.blue,
accentColor: colors.RedAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title( child: new Title(
title: 'Cards', title: 'Cards',
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class CardModel { class CardModel {
...@@ -67,7 +67,7 @@ class Marker extends Component { ...@@ -67,7 +67,7 @@ class Marker extends Component {
class OverlayGeometryApp extends App { class OverlayGeometryApp extends App {
static const TextStyle cardLabelStyle = static const TextStyle cardLabelStyle =
const TextStyle(color: colors.white, fontSize: 18.0, fontWeight: bold); const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: bold);
List<CardModel> cardModels; List<CardModel> cardModels;
MixedViewportLayoutState layoutState = new MixedViewportLayoutState(); MixedViewportLayoutState layoutState = new MixedViewportLayoutState();
...@@ -82,7 +82,7 @@ class OverlayGeometryApp extends App { ...@@ -82,7 +82,7 @@ class OverlayGeometryApp extends App {
48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0 48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0
]; ];
cardModels = new List.generate(cardHeights.length, (i) { cardModels = new List.generate(cardHeights.length, (i) {
Color color = Color.lerp(colors.Red[300], colors.Blue[900], i / cardHeights.length); Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardHeights.length);
return new CardModel(i, cardHeights[i], color); return new CardModel(i, cardHeights[i], color);
}); });
super.initState(); super.initState();
...@@ -163,8 +163,8 @@ class OverlayGeometryApp extends App { ...@@ -163,8 +163,8 @@ class OverlayGeometryApp extends App {
child: new Theme( child: new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Blue, primarySwatch: Colors.blue,
accentColor: colors.RedAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title(title: 'Cards', child: new Stack(layers)) child: new Title(title: 'Cards', child: new Stack(layers))
) )
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class CardModel { class CardModel {
...@@ -18,7 +18,7 @@ class CardModel { ...@@ -18,7 +18,7 @@ class CardModel {
class PageableListApp extends App { class PageableListApp extends App {
static const TextStyle cardLabelStyle = static const TextStyle cardLabelStyle =
const TextStyle(color: white, fontSize: 18.0, fontWeight: bold); const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: bold);
List<CardModel> cardModels; List<CardModel> cardModels;
Size pageSize = new Size(200.0, 200.0); Size pageSize = new Size(200.0, 200.0);
...@@ -33,7 +33,7 @@ class PageableListApp extends App { ...@@ -33,7 +33,7 @@ class PageableListApp extends App {
.toList(); .toList();
cardModels = new List.generate(cardSizes.length, (i) { cardModels = new List.generate(cardSizes.length, (i) {
Color color = Color.lerp(Red[300], Blue[900], i / cardSizes.length); Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardSizes.length);
return new CardModel(i, cardSizes[i], color); return new CardModel(i, cardSizes[i], color);
}); });
...@@ -167,8 +167,8 @@ class PageableListApp extends App { ...@@ -167,8 +167,8 @@ class PageableListApp extends App {
child: new Theme( child: new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: Blue, primarySwatch: Colors.blue,
accentColor: RedAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title( child: new Title(
title: 'PageableList', title: 'PageableList',
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
import 'package:mojo/mojo/url_response.mojom.dart'; import 'package:mojo/mojo/url_response.mojom.dart';
import 'package:sky_services/media/media.mojom.dart'; import 'package:sky_services/media/media.mojom.dart';
import 'package:sky/services.dart'; import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/services.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
// All of these sounds are marked as public domain at soundbible. // All of these sounds are marked as public domain at soundbible.
...@@ -42,12 +42,12 @@ class Key { ...@@ -42,12 +42,12 @@ class Key {
class PianoApp extends App { class PianoApp extends App {
final List<Key> keys = [ final List<Key> keys = [
new Key(colors.Red[500], chimes), new Key(Colors.red[500], chimes),
new Key(colors.Orange[500], chainsaw), new Key(Colors.orange[500], chainsaw),
new Key(colors.Yellow[500], stag), new Key(Colors.yellow[500], stag),
new Key(colors.Green[500], frogs), new Key(Colors.green[500], frogs),
new Key(colors.Blue[500], rattle), new Key(Colors.blue[500], rattle),
new Key(colors.Purple[500], iLoveYou), new Key(Colors.purple[500], iLoveYou),
]; ];
PianoApp() { PianoApp() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class ProgressIndicatorApp extends App { class ProgressIndicatorApp extends App {
...@@ -90,8 +90,8 @@ class ProgressIndicatorApp extends App { ...@@ -90,8 +90,8 @@ class ProgressIndicatorApp extends App {
child: new Theme( child: new Theme(
data: new ThemeData( data: new ThemeData(
brightness: ThemeBrightness.light, brightness: ThemeBrightness.light,
primarySwatch: colors.Blue, primarySwatch: Colors.blue,
accentColor: colors.RedAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title( child: new Title(
title: 'Cards', title: 'Cards',
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class ScaleApp extends App { class ScaleApp extends App {
...@@ -41,7 +41,7 @@ class ScaleApp extends App { ...@@ -41,7 +41,7 @@ class ScaleApp extends App {
double radius = size.width / 2.0 * _zoom; double radius = size.width / 2.0 * _zoom;
Gradient gradient = new RadialGradient( Gradient gradient = new RadialGradient(
center: center, radius: radius, center: center, radius: radius,
colors: [colors.Blue[200], colors.Blue[800]] colors: [Colors.blue[200], Colors.blue[800]]
); );
Paint paint = new Paint() Paint paint = new Paint()
..shader = gradient.createShader(); ..shader = gradient.createShader();
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class StyledTextApp extends App { class StyledTextApp extends App {
...@@ -32,8 +32,8 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -32,8 +32,8 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
// [["Dave", "Open the pod bay..."] ...] // [["Dave", "Open the pod bay..."] ...]
List<List<String>> nameLines; List<List<String>> nameLines;
final TextStyle daveStyle = new TextStyle(color: colors.Indigo[400], height: 1.8); final TextStyle daveStyle = new TextStyle(color: Colors.indigo[400], height: 1.8);
final TextStyle halStyle = new TextStyle(color: colors.Red[400], fontFamily: "monospace"); final TextStyle halStyle = new TextStyle(color: Colors.red[400], fontFamily: "monospace");
final TextStyle boldStyle = const TextStyle(fontWeight: bold); final TextStyle boldStyle = const TextStyle(fontWeight: bold);
final TextStyle underlineStyle = const TextStyle( final TextStyle underlineStyle = const TextStyle(
decoration: underline, decoration: underline,
...@@ -100,7 +100,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -100,7 +100,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
data: new ThemeData.light(), data: new ThemeData.light(),
child: new Scaffold( child: new Scaffold(
body: new Material( body: new Material(
color: colors.Grey[50], color: Colors.grey[50],
child: interactiveBody child: interactiveBody
), ),
toolbar: new ToolBar( toolbar: new ToolBar(
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
class TabbedNavigatorApp extends App { class TabbedNavigatorApp extends App {
...@@ -122,7 +122,7 @@ class TabbedNavigatorApp extends App { ...@@ -122,7 +122,7 @@ class TabbedNavigatorApp extends App {
assert(selectedIndices.length == 5); assert(selectedIndices.length == 5);
ToolBar toolbar = new ToolBar( ToolBar toolbar = new ToolBar(
center: new Text('Tabbed Navigator', style: typography.white.title) center: new Text('Tabbed Navigator', style: Typography.white.title)
); );
return new Scaffold( return new Scaffold(
......
// 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.
/// Widgets implementing Material Design
///
/// See https://www.google.com/design/spec/material-design/introduction.html
library material;
export 'src/material/colors.dart';
export 'src/material/edges.dart';
export 'src/material/shadows.dart';
export 'src/material/theme_data.dart';
export 'src/material/typography.dart';
export 'src/material/constants.dart';
...@@ -2,5 +2,5 @@ This directory provides constants for Material Design. ...@@ -2,5 +2,5 @@ This directory provides constants for Material Design.
http://www.google.com/design/spec/material-design/ http://www.google.com/design/spec/material-design/
Files in this directory only depend on [painting.dart](../painting.dart) and Files in this directory only depend on [painting.dart](../../painting.dart) and
`sky:dart`. `sky:dart`.
This diff is collapsed.
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
import 'dart:sky'; import 'dart:sky';
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/src/material/typography.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/src/material/colors.dart';
enum ThemeBrightness { dark, light } enum ThemeBrightness { dark, light }
...@@ -16,12 +16,12 @@ class ThemeData { ...@@ -16,12 +16,12 @@ class ThemeData {
Map<int, Color> primarySwatch, Map<int, Color> primarySwatch,
Color accentColor, Color accentColor,
this.accentColorBrightness: ThemeBrightness.dark, this.accentColorBrightness: ThemeBrightness.dark,
typography.TextTheme text TextTheme text
}): this.brightness = brightness, }): this.brightness = brightness,
this.primarySwatch = primarySwatch, this.primarySwatch = primarySwatch,
primaryColorBrightness = primarySwatch == null ? brightness : ThemeBrightness.dark, primaryColorBrightness = primarySwatch == null ? brightness : ThemeBrightness.dark,
canvasColor = brightness == ThemeBrightness.dark ? colors.Grey[850] : colors.Grey[50], canvasColor = brightness == ThemeBrightness.dark ? Colors.grey[850] : Colors.grey[50],
cardColor = brightness == ThemeBrightness.dark ? colors.Grey[800] : colors.white, cardColor = brightness == ThemeBrightness.dark ? Colors.grey[800] : Colors.white,
dividerColor = brightness == ThemeBrightness.dark ? const Color(0x1FFFFFFF) : const Color(0x1F000000), dividerColor = brightness == ThemeBrightness.dark ? const Color(0x1FFFFFFF) : const Color(0x1F000000),
// Some users want the pre-multiplied color, others just want the opacity. // Some users want the pre-multiplied color, others just want the opacity.
hintColor = brightness == ThemeBrightness.dark ? const Color(0x42FFFFFF) : const Color(0x4C000000), hintColor = brightness == ThemeBrightness.dark ? const Color(0x42FFFFFF) : const Color(0x4C000000),
...@@ -35,27 +35,27 @@ class ThemeData { ...@@ -35,27 +35,27 @@ class ThemeData {
// revert when you cancel the tap. // revert when you cancel the tap.
highlightColor = const Color(0x33999999), highlightColor = const Color(0x33999999),
selectedColor = const Color(0x66999999), selectedColor = const Color(0x66999999),
text = brightness == ThemeBrightness.dark ? typography.white : typography.black { text = brightness == ThemeBrightness.dark ? Typography.white : Typography.black {
assert(brightness != null); assert(brightness != null);
if (primarySwatch == null) { if (primarySwatch == null) {
if (brightness == ThemeBrightness.dark) { if (brightness == ThemeBrightness.dark) {
_primaryColor = colors.Grey[900]; _primaryColor = Colors.grey[900];
} else { } else {
_primaryColor = colors.Grey[100]; _primaryColor = Colors.grey[100];
} }
} else { } else {
_primaryColor = primarySwatch[500]; _primaryColor = primarySwatch[500];
} }
if (accentColor == null) { if (accentColor == null) {
_accentColor = primarySwatch == null ? colors.Blue[500] : primarySwatch[500]; _accentColor = primarySwatch == null ? Colors.blue[500] : primarySwatch[500];
} else { } else {
_accentColor = accentColor; _accentColor = accentColor;
} }
} }
factory ThemeData.light() => new ThemeData(primarySwatch: colors.Blue, brightness: ThemeBrightness.light); factory ThemeData.light() => new ThemeData(primarySwatch: Colors.blue, brightness: ThemeBrightness.light);
factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark); factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark);
factory ThemeData.fallback() => new ThemeData.light(); factory ThemeData.fallback() => new ThemeData.light();
...@@ -68,7 +68,7 @@ class ThemeData { ...@@ -68,7 +68,7 @@ class ThemeData {
final Color highlightColor; final Color highlightColor;
final Color selectedColor; final Color selectedColor;
final double hintOpacity; final double hintOpacity;
final typography.TextTheme text; final TextTheme text;
Color _primaryColor; Color _primaryColor;
Color get primaryColor => _primaryColor; Color get primaryColor => _primaryColor;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import 'dart:sky' show Color; import 'dart:sky' show Color;
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/src/material/colors.dart';
// TODO(eseidel): Font weights are supposed to be language relative! // TODO(eseidel): Font weights are supposed to be language relative!
// TODO(jackson): Baseline should be language relative! // TODO(jackson): Baseline should be language relative!
...@@ -15,30 +15,30 @@ import 'package:sky/theme/colors.dart' as colors; ...@@ -15,30 +15,30 @@ import 'package:sky/theme/colors.dart' as colors;
class TextTheme { class TextTheme {
const TextTheme._black() const TextTheme._black()
: display4 = const TextStyle(fontSize: 112.0, fontWeight: FontWeight.w100, color: colors.black54, textBaseline: TextBaseline.alphabetic), : display4 = const TextStyle(fontSize: 112.0, fontWeight: FontWeight.w100, color: Colors.black54, textBaseline: TextBaseline.alphabetic),
display3 = const TextStyle(fontSize: 56.0, fontWeight: FontWeight.w400, color: colors.black54, textBaseline: TextBaseline.alphabetic), display3 = const TextStyle(fontSize: 56.0, fontWeight: FontWeight.w400, color: Colors.black54, textBaseline: TextBaseline.alphabetic),
display2 = const TextStyle(fontSize: 45.0, fontWeight: FontWeight.w400, color: colors.black54, height: 48.0 / 45.0, textBaseline: TextBaseline.alphabetic), display2 = const TextStyle(fontSize: 45.0, fontWeight: FontWeight.w400, color: Colors.black54, height: 48.0 / 45.0, textBaseline: TextBaseline.alphabetic),
display1 = const TextStyle(fontSize: 34.0, fontWeight: FontWeight.w400, color: colors.black54, height: 40.0 / 34.0, textBaseline: TextBaseline.alphabetic), display1 = const TextStyle(fontSize: 34.0, fontWeight: FontWeight.w400, color: Colors.black54, height: 40.0 / 34.0, textBaseline: TextBaseline.alphabetic),
headline = const TextStyle(fontSize: 24.0, fontWeight: FontWeight.w400, color: colors.black87, height: 32.0 / 24.0, textBaseline: TextBaseline.alphabetic), headline = const TextStyle(fontSize: 24.0, fontWeight: FontWeight.w400, color: Colors.black87, height: 32.0 / 24.0, textBaseline: TextBaseline.alphabetic),
title = const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500, color: colors.black87, height: 28.0 / 20.0, textBaseline: TextBaseline.alphabetic), title = const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500, color: Colors.black87, height: 28.0 / 20.0, textBaseline: TextBaseline.alphabetic),
subhead = const TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: colors.black87, height: 24.0 / 16.0, textBaseline: TextBaseline.alphabetic), subhead = const TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: Colors.black87, height: 24.0 / 16.0, textBaseline: TextBaseline.alphabetic),
body2 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: colors.black87, height: 24.0 / 14.0, textBaseline: TextBaseline.alphabetic), body2 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.black87, height: 24.0 / 14.0, textBaseline: TextBaseline.alphabetic),
body1 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w400, color: colors.black87, height: 20.0 / 14.0, textBaseline: TextBaseline.alphabetic), body1 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w400, color: Colors.black87, height: 20.0 / 14.0, textBaseline: TextBaseline.alphabetic),
caption = const TextStyle(fontSize: 12.0, fontWeight: FontWeight.w400, color: colors.black54, textBaseline: TextBaseline.alphabetic), caption = const TextStyle(fontSize: 12.0, fontWeight: FontWeight.w400, color: Colors.black54, textBaseline: TextBaseline.alphabetic),
button = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: colors.black87, textBaseline: TextBaseline.alphabetic); button = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.black87, textBaseline: TextBaseline.alphabetic);
const TextTheme._white() const TextTheme._white()
: display4 = const TextStyle(fontSize: 112.0, fontWeight: FontWeight.w100, color: colors.white54, textBaseline: TextBaseline.alphabetic), : display4 = const TextStyle(fontSize: 112.0, fontWeight: FontWeight.w100, color: Colors.white54, textBaseline: TextBaseline.alphabetic),
display3 = const TextStyle(fontSize: 56.0, fontWeight: FontWeight.w400, color: colors.white54, textBaseline: TextBaseline.alphabetic), display3 = const TextStyle(fontSize: 56.0, fontWeight: FontWeight.w400, color: Colors.white54, textBaseline: TextBaseline.alphabetic),
display2 = const TextStyle(fontSize: 45.0, fontWeight: FontWeight.w400, color: colors.white54, height: 48.0 / 45.0, textBaseline: TextBaseline.alphabetic), display2 = const TextStyle(fontSize: 45.0, fontWeight: FontWeight.w400, color: Colors.white54, height: 48.0 / 45.0, textBaseline: TextBaseline.alphabetic),
display1 = const TextStyle(fontSize: 34.0, fontWeight: FontWeight.w400, color: colors.white54, height: 40.0 / 34.0, textBaseline: TextBaseline.alphabetic), display1 = const TextStyle(fontSize: 34.0, fontWeight: FontWeight.w400, color: Colors.white54, height: 40.0 / 34.0, textBaseline: TextBaseline.alphabetic),
headline = const TextStyle(fontSize: 24.0, fontWeight: FontWeight.w400, color: colors.white87, height: 32.0 / 24.0, textBaseline: TextBaseline.alphabetic), headline = const TextStyle(fontSize: 24.0, fontWeight: FontWeight.w400, color: Colors.white87, height: 32.0 / 24.0, textBaseline: TextBaseline.alphabetic),
title = const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500, color: colors.white87, height: 28.0 / 20.0, textBaseline: TextBaseline.alphabetic), title = const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500, color: Colors.white87, height: 28.0 / 20.0, textBaseline: TextBaseline.alphabetic),
subhead = const TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: colors.white87, height: 24.0 / 16.0, textBaseline: TextBaseline.alphabetic), subhead = const TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: Colors.white87, height: 24.0 / 16.0, textBaseline: TextBaseline.alphabetic),
body2 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: colors.white87, height: 24.0 / 14.0, textBaseline: TextBaseline.alphabetic), body2 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.white87, height: 24.0 / 14.0, textBaseline: TextBaseline.alphabetic),
body1 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w400, color: colors.white87, height: 20.0 / 14.0, textBaseline: TextBaseline.alphabetic), body1 = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w400, color: Colors.white87, height: 20.0 / 14.0, textBaseline: TextBaseline.alphabetic),
caption = const TextStyle(fontSize: 12.0, fontWeight: FontWeight.w400, color: colors.white54, textBaseline: TextBaseline.alphabetic), caption = const TextStyle(fontSize: 12.0, fontWeight: FontWeight.w400, color: Colors.white54, textBaseline: TextBaseline.alphabetic),
button = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: colors.white87, textBaseline: TextBaseline.alphabetic); button = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.white87, textBaseline: TextBaseline.alphabetic);
final TextStyle display4; final TextStyle display4;
final TextStyle display3; final TextStyle display3;
...@@ -54,20 +54,23 @@ class TextTheme { ...@@ -54,20 +54,23 @@ class TextTheme {
} }
class Typography {
Typography._();
const TextTheme black = const TextTheme._black(); static const TextTheme black = const TextTheme._black();
const TextTheme white = const TextTheme._white(); static const TextTheme white = const TextTheme._white();
// TODO(abarth): Maybe this should be hard-coded in Scaffold? // TODO(abarth): Maybe this should be hard-coded in Scaffold?
const String typeface = 'font-family: sans-serif'; static const String typeface = 'font-family: sans-serif';
const TextStyle error = const TextStyle( static const TextStyle error = const TextStyle(
color: const Color(0xD0FF0000), color: const Color(0xD0FF0000),
fontFamily: 'monospace', fontFamily: 'monospace',
fontSize: 48.0, fontSize: 48.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
textAlign: TextAlign.right, textAlign: TextAlign.right,
decoration: underline, decoration: underline,
decorationColor: const Color(0xFFFF00), decorationColor: const Color(0xFFFF00),
decorationStyle: TextDecorationStyle.double decorationStyle: TextDecorationStyle.double
); );
}
...@@ -6,9 +6,8 @@ import 'dart:async'; ...@@ -6,9 +6,8 @@ import 'dart:async';
import 'package:intl/date_symbols.dart'; import 'package:intl/date_symbols.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:sky/material.dart';
import 'package:sky/services.dart'; import 'package:sky/services.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/gesture_detector.dart'; import 'package:sky/src/widgets/gesture_detector.dart';
...@@ -129,19 +128,19 @@ class DatePickerHeader extends Component { ...@@ -129,19 +128,19 @@ class DatePickerHeader extends Component {
Widget build() { Widget build() {
ThemeData theme = Theme.of(this); ThemeData theme = Theme.of(this);
typography.TextTheme headerTheme; TextTheme headerTheme;
Color dayColor; Color dayColor;
Color yearColor; Color yearColor;
switch(theme.primaryColorBrightness) { switch(theme.primaryColorBrightness) {
case ThemeBrightness.light: case ThemeBrightness.light:
headerTheme = typography.black; headerTheme = Typography.black;
dayColor = mode == DatePickerMode.day ? colors.black87 : colors.black54; dayColor = mode == DatePickerMode.day ? Colors.black87 : Colors.black54;
yearColor = mode == DatePickerMode.year ? colors.black87 : colors.black54; yearColor = mode == DatePickerMode.year ? Colors.black87 : Colors.black54;
break; break;
case ThemeBrightness.dark: case ThemeBrightness.dark:
headerTheme = typography.white; headerTheme = Typography.white;
dayColor = mode == DatePickerMode.day ? colors.white87 : colors.white54; dayColor = mode == DatePickerMode.day ? Colors.white87 : Colors.white54;
yearColor = mode == DatePickerMode.year ? colors.white87 : colors.white54; yearColor = mode == DatePickerMode.year ? Colors.white87 : Colors.white54;
break; break;
} }
TextStyle dayStyle = headerTheme.display3.copyWith(color: dayColor, height: 1.0, fontSize: 100.0); TextStyle dayStyle = headerTheme.display3.copyWith(color: dayColor, height: 1.0, fontSize: 100.0);
...@@ -383,7 +382,7 @@ class YearPicker extends ScrollableWidgetList { ...@@ -383,7 +382,7 @@ class YearPicker extends ScrollableWidgetList {
int get itemCount => lastDate.year - firstDate.year + 1; int get itemCount => lastDate.year - firstDate.year + 1;
List<Widget> buildItems(int start, int count) { List<Widget> buildItems(int start, int count) {
TextStyle style = Theme.of(this).text.body1.copyWith(color: colors.black54); TextStyle style = Theme.of(this).text.body1.copyWith(color: Colors.black54);
List<Widget> items = new List<Widget>(); List<Widget> items = new List<Widget>();
for(int i = start; i < start + count; i++) { for(int i = start; i < start + count; i++) {
int year = firstDate.year + i; int year = firstDate.year + i;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/focus.dart'; import 'package:sky/src/widgets/focus.dart';
...@@ -58,9 +58,9 @@ class Dialog extends Component { ...@@ -58,9 +58,9 @@ class Dialog extends Component {
Color get _color { Color get _color {
switch (Theme.of(this).brightness) { switch (Theme.of(this).brightness) {
case ThemeBrightness.light: case ThemeBrightness.light:
return colors.white; return Colors.white;
case ThemeBrightness.dark: case ThemeBrightness.dark:
return colors.Grey[800]; return Colors.grey[800];
} }
} }
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/src/widgets/animated_container.dart'; import 'package:sky/src/widgets/animated_container.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
...@@ -85,7 +84,7 @@ class Drawer extends StatefulComponent { ...@@ -85,7 +84,7 @@ class Drawer extends StatefulComponent {
child: new ColorTransition( child: new ColorTransition(
performance: _performance, performance: _performance,
direction: showing ? Direction.forward : Direction.reverse, direction: showing ? Direction.forward : Direction.reverse,
color: new AnimatedColorValue(colors.transparent, end: const Color(0x7F000000)), color: new AnimatedColorValue(Colors.transparent, end: const Color(0x7F000000)),
child: new Container() child: new Container()
), ),
onTap: () { onTap: () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/view_configuration.dart'; import 'package:sky/material.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/button_base.dart'; import 'package:sky/src/widgets/button_base.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
...@@ -46,7 +46,7 @@ class DrawerItem extends ButtonBase { ...@@ -46,7 +46,7 @@ class DrawerItem extends ButtonBase {
return themeData.highlightColor; return themeData.highlightColor;
if (selected) if (selected)
return themeData.selectedColor; return themeData.selectedColor;
return colors.transparent; return Colors.transparent;
} }
sky.ColorFilter _getColorFilter(ThemeData themeData) { sky.ColorFilter _getColorFilter(ThemeData themeData) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart'; import 'package:sky/material.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/material_button.dart'; import 'package:sky/src/widgets/material_button.dart';
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
...@@ -23,9 +23,9 @@ class FlatButton extends MaterialButton { ...@@ -23,9 +23,9 @@ class FlatButton extends MaterialButton {
return null; return null;
switch (Theme.of(this).brightness) { switch (Theme.of(this).brightness) {
case ThemeBrightness.light: case ThemeBrightness.light:
return Grey[400]; return Colors.grey[400];
case ThemeBrightness.dark: case ThemeBrightness.dark:
return Grey[200]; return Colors.grey[200];
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/shadows.dart'; import 'package:sky/material.dart';
import 'package:sky/src/widgets/animated_container.dart'; import 'package:sky/src/widgets/animated_container.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
......
...@@ -6,8 +6,7 @@ import 'dart:sky' as sky; ...@@ -6,8 +6,7 @@ import 'dart:sky' as sky;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart'; import 'package:sky/material.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/navigator.dart'; import 'package:sky/src/widgets/navigator.dart';
...@@ -78,7 +77,7 @@ class PopupMenu extends StatefulComponent { ...@@ -78,7 +77,7 @@ class PopupMenu extends StatefulComponent {
void _updateBoxPainter() { void _updateBoxPainter() {
_painter = new BoxPainter(new BoxDecoration( _painter = new BoxPainter(new BoxDecoration(
backgroundColor: Grey[50], backgroundColor: Colors.grey[50],
borderRadius: 2.0, borderRadius: 2.0,
boxShadow: shadows[level])); boxShadow: shadows[level]));
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/material_button.dart'; import 'package:sky/src/widgets/material_button.dart';
...@@ -25,9 +25,9 @@ class RaisedButton extends MaterialButton { ...@@ -25,9 +25,9 @@ class RaisedButton extends MaterialButton {
switch (Theme.of(this).brightness) { switch (Theme.of(this).brightness) {
case ThemeBrightness.light: case ThemeBrightness.light:
if (highlight) if (highlight)
return colors.Grey[350]; return Colors.grey[350];
else else
return colors.Grey[300]; return Colors.grey[300];
break; break;
case ThemeBrightness.dark: case ThemeBrightness.dark:
if (highlight) if (highlight)
...@@ -37,7 +37,7 @@ class RaisedButton extends MaterialButton { ...@@ -37,7 +37,7 @@ class RaisedButton extends MaterialButton {
break; break;
} }
} else { } else {
return colors.Grey[350]; return Colors.grey[350];
} }
} }
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/src/rendering/box.dart'; import 'package:sky/material.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/view_configuration.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
// Slots are painted in this order and hit tested in reverse of this order // Slots are painted in this order and hit tested in reverse of this order
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/material.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
...@@ -63,7 +63,7 @@ class SnackBar extends Component { ...@@ -63,7 +63,7 @@ class SnackBar extends Component {
child: new Container( child: new Container(
margin: const EdgeDims.symmetric(vertical: 14.0), margin: const EdgeDims.symmetric(vertical: 14.0),
child: new DefaultTextStyle( child: new DefaultTextStyle(
style: typography.white.subhead, style: Typography.white.subhead,
child: content child: content
) )
) )
......
...@@ -5,10 +5,9 @@ ...@@ -5,10 +5,9 @@
import 'dart:async'; import 'dart:async';
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/rendering.dart';
import 'package:sky/src/rendering/object.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -9,8 +9,7 @@ import 'package:newton/newton.dart'; ...@@ -9,8 +9,7 @@ import 'package:newton/newton.dart';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
...@@ -512,18 +511,18 @@ class TabBar extends Scrollable { ...@@ -512,18 +511,18 @@ class TabBar extends Scrollable {
Color backgroundColor = themeData.primaryColor; Color backgroundColor = themeData.primaryColor;
Color indicatorColor = themeData.accentColor; Color indicatorColor = themeData.accentColor;
if (indicatorColor == backgroundColor) { if (indicatorColor == backgroundColor) {
indicatorColor = colors.white; indicatorColor = Colors.white;
} }
TextStyle textStyle; TextStyle textStyle;
IconThemeColor iconThemeColor; IconThemeColor iconThemeColor;
switch (themeData.primaryColorBrightness) { switch (themeData.primaryColorBrightness) {
case ThemeBrightness.light: case ThemeBrightness.light:
textStyle = typography.black.body1; textStyle = Typography.black.body1;
iconThemeColor = IconThemeColor.black; iconThemeColor = IconThemeColor.black;
break; break;
case ThemeBrightness.dark: case ThemeBrightness.dark:
textStyle = typography.white.body1; textStyle = Typography.white.body1;
iconThemeColor = IconThemeColor.white; iconThemeColor = IconThemeColor.white;
break; break;
} }
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/theme_data.dart'; import 'package:sky/material.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
export 'package:sky/theme/theme_data.dart' show ThemeData, ThemeBrightness; export 'package:sky/material.dart' show ThemeData, ThemeBrightness;
class Theme extends Inherited { class Theme extends Inherited {
......
...@@ -4,15 +4,13 @@ ...@@ -4,15 +4,13 @@
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
import 'package:sky/material.dart';
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/flex.dart'; import 'package:sky/src/rendering/flex.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/icon.dart'; import 'package:sky/src/widgets/icon.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/theme/view_configuration.dart';
class ToolBar extends Component { class ToolBar extends Component {
...@@ -32,14 +30,14 @@ class ToolBar extends Component { ...@@ -32,14 +30,14 @@ class ToolBar extends Component {
Widget build() { Widget build() {
Color toolbarColor = backgroundColor; Color toolbarColor = backgroundColor;
IconThemeData iconThemeData; IconThemeData iconThemeData;
TextStyle centerStyle = typography.white.title; TextStyle centerStyle = Typography.white.title;
TextStyle sideStyle = typography.white.body1; TextStyle sideStyle = Typography.white.body1;
if (toolbarColor == null) { if (toolbarColor == null) {
ThemeData themeData = Theme.of(this); ThemeData themeData = Theme.of(this);
toolbarColor = themeData.primaryColor; toolbarColor = themeData.primaryColor;
if (themeData.primaryColorBrightness == ThemeBrightness.light) { if (themeData.primaryColorBrightness == ThemeBrightness.light) {
centerStyle = typography.black.title; centerStyle = Typography.black.title;
sideStyle = typography.black.body2; sideStyle = Typography.black.body2;
iconThemeData = const IconThemeData(color: IconThemeColor.black); iconThemeData = const IconThemeData(color: IconThemeColor.black);
} else { } else {
iconThemeData = const IconThemeData(color: IconThemeColor.white); iconThemeData = const IconThemeData(color: IconThemeColor.white);
......
This diff is collapsed.
import 'package:sky/material.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/shadows.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'rendering_tester.dart'; import 'rendering_tester.dart';
...@@ -12,7 +11,7 @@ void main() { ...@@ -12,7 +11,7 @@ void main() {
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
gradient: new RadialGradient( gradient: new RadialGradient(
center: Point.origin, radius: 500.0, center: Point.origin, radius: 500.0,
colors: [colors.Yellow[500], colors.Blue[500]]), colors: [Colors.yellow[500], Colors.blue[500]]),
boxShadow: shadows[3]) boxShadow: shadows[3])
); );
layout(root); layout(root);
......
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/material.dart';
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
shape: Shape.circle, shape: Shape.circle,
border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)), border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)),
backgroundColor: colors.Teal[600] backgroundColor: Colors.teal[600]
) )
); );
}); });
......
...@@ -41,7 +41,8 @@ void main() { ...@@ -41,7 +41,8 @@ void main() {
test('duplicate key smoke test', () { test('duplicate key smoke test', () {
WidgetTester tester = new WidgetTester(); WidgetTester tester = new WidgetTester();
tester.pumpFrame(builder); tester.pumpFrame(builder);
tester.findWidget((widget) => widget is StatefulLeaf).test(); StatefulLeaf leaf = tester.findWidget((widget) => widget is StatefulLeaf);
leaf.test();
tester.pumpFrameWithoutChange(); tester.pumpFrameWithoutChange();
Item lastItem = items[1]; Item lastItem = items[1];
items.remove(lastItem); items.remove(lastItem);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:developer';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment