| OLD | NEW |
| 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 'dart:sky'; | 5 import 'dart:sky'; |
| 6 | 6 |
| 7 import 'typography.dart' as typography; | 7 import 'typography.dart' as typography; |
| 8 import 'colors.dart' as colors; | 8 import 'colors.dart' as colors; |
| 9 | 9 |
| 10 enum ThemeBrightness { dark, light } | 10 enum ThemeBrightness { dark, light } |
| 11 | 11 |
| 12 class ThemeData { | 12 class ThemeData { |
| 13 | 13 |
| 14 ThemeData({ | 14 ThemeData({ |
| 15 ThemeBrightness brightness, | 15 ThemeBrightness brightness, |
| 16 Map<int, Color> primarySwatch, | 16 Map<int, Color> primarySwatch, |
| 17 Color accentColor, | 17 Color accentColor, |
| 18 Color floatingActionButtonColor, | 18 Color floatingActionButtonColor, |
| 19 typography.TextTheme text, | 19 typography.TextTheme text, |
| 20 typography.TextTheme toolbarText }) | 20 typography.TextTheme toolbarText }) |
| 21 : this.brightness = brightness, | 21 : this.brightness = brightness, |
| 22 this.primarySwatch = primarySwatch, | 22 this.primarySwatch = primarySwatch, |
| 23 canvasColor = brightness == ThemeBrightness.dark ? colors.Grey[850] : colo
rs.Grey[50], | 23 canvasColor = brightness == ThemeBrightness.dark ? colors.Grey[850] : colo
rs.Grey[50], |
| 24 cardColor = brightness == ThemeBrightness.dark ? colors.Grey[800] : colors
.White, | 24 cardColor = brightness == ThemeBrightness.dark ? colors.Grey[800] : colors
.White, |
| 25 dividerColor = brightness == ThemeBrightness.dark ? const Color(0x1FFFFFFF
) : const Color(0x1F000000), |
| 25 text = brightness == ThemeBrightness.dark ? typography.white : typography.
black { | 26 text = brightness == ThemeBrightness.dark ? typography.white : typography.
black { |
| 26 assert(brightness != null); | 27 assert(brightness != null); |
| 27 | 28 |
| 28 if (primarySwatch == null) { | 29 if (primarySwatch == null) { |
| 29 _primaryColor = brightness == ThemeBrightness.dark ? colors.Grey[900] : co
lors.Grey[100]; | 30 _primaryColor = brightness == ThemeBrightness.dark ? colors.Grey[900] : co
lors.Grey[100]; |
| 30 } else { | 31 } else { |
| 31 _primaryColor = primarySwatch[500]; | 32 _primaryColor = primarySwatch[500]; |
| 32 } | 33 } |
| 33 | 34 |
| 34 if (accentColor == null) { | 35 if (accentColor == null) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 factory ThemeData.light() => new ThemeData(primarySwatch: colors.Blue, brightn
ess: ThemeBrightness.light); | 57 factory ThemeData.light() => new ThemeData(primarySwatch: colors.Blue, brightn
ess: ThemeBrightness.light); |
| 57 factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark); | 58 factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark); |
| 58 factory ThemeData.fallback() => new ThemeData.light(); | 59 factory ThemeData.fallback() => new ThemeData.light(); |
| 59 | 60 |
| 60 final ThemeBrightness brightness; | 61 final ThemeBrightness brightness; |
| 61 final Map<int, Color> primarySwatch; | 62 final Map<int, Color> primarySwatch; |
| 62 final Color canvasColor; | 63 final Color canvasColor; |
| 63 final Color cardColor; | 64 final Color cardColor; |
| 65 final Color dividerColor; |
| 64 final typography.TextTheme text; | 66 final typography.TextTheme text; |
| 65 | 67 |
| 66 Color _primaryColor; | 68 Color _primaryColor; |
| 67 Color get primaryColor => _primaryColor; | 69 Color get primaryColor => _primaryColor; |
| 68 | 70 |
| 69 Color _accentColor; | 71 Color _accentColor; |
| 70 Color get accentColor => _accentColor; | 72 Color get accentColor => _accentColor; |
| 71 | 73 |
| 72 Color _floatingActionButtonColor; | 74 Color _floatingActionButtonColor; |
| 73 Color get floatingActionButtonColor => _floatingActionButtonColor; | 75 Color get floatingActionButtonColor => _floatingActionButtonColor; |
| 74 | 76 |
| 75 typography.TextTheme _toolbarText; | 77 typography.TextTheme _toolbarText; |
| 76 typography.TextTheme get toolbarText => _toolbarText; | 78 typography.TextTheme get toolbarText => _toolbarText; |
| 77 } | 79 } |
| OLD | NEW |