Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: sky/sdk/lib/widgets/theme.dart

Issue 1204523002: Material light and dark themes for Sky widgets (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix analyzer warning properly Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/switch.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/theme/theme_data.dart'; 5 import 'package:sky/theme/theme_data.dart';
6 import 'basic.dart'; 6 import 'basic.dart';
7 import 'widget.dart'; 7 import 'widget.dart';
8 8
9 class Theme extends Inherited { 9 class Theme extends Inherited {
10 10
11 Theme({ 11 Theme({
12 String key, 12 String key,
13 this.data, 13 this.data,
14 Widget child 14 Widget child
15 }) : super(key: key, child: child) { 15 }) : super(key: key, child: child) {
16 assert(child != null); 16 assert(child != null);
17 assert(data != null); 17 assert(data != null);
18 } 18 }
19 19
20 final ThemeData data; 20 final ThemeData data;
21 21
22 static ThemeData _kFallbackTheme = new ThemeData.fallback();
abarth-chromium 2015/06/23 02:11:36 final
jackson 2015/06/23 17:14:09 Fixed in https://codereview.chromium.org/119277300
23
22 static ThemeData of(Component component) { 24 static ThemeData of(Component component) {
23 Theme theme = component.inheritedOfType(Theme); 25 Theme theme = component.inheritedOfType(Theme);
24 // If you hit this assert, you need to wrap your Component in a Theme 26 return theme == null ? _kFallbackTheme : theme.data;
25 assert(theme != null);
26 return theme.data;
27 } 27 }
28 } 28 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/switch.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698