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