| 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 'package:sky/theme/typography.dart' as typography; | 7 import 'package:sky/theme/typography.dart' as typography; |
| 8 import 'package:sky/theme/colors.dart' as colors; | 8 import 'package:sky/theme/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 this.accentColorBrightness: ThemeBrightness.dark, | 18 this.accentColorBrightness: ThemeBrightness.dark, |
| 19 typography.TextTheme text }) | 19 typography.TextTheme text }) |
| 20 : this.brightness = brightness, | 20 : this.brightness = brightness, |
| 21 this.primarySwatch = primarySwatch, | 21 this.primarySwatch = primarySwatch, |
| 22 primaryColorBrightness = primarySwatch == null ? brightness : ThemeBrightn
ess.dark, | 22 primaryColorBrightness = primarySwatch == null ? brightness : ThemeBrightn
ess.dark, |
| 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 dividerColor = brightness == ThemeBrightness.dark ? const Color(0x1FFFFFFF
) : const Color(0x1F000000), |
| 26 // Some users want the pre-multiplied color, others just want the opacity. | 26 // Some users want the pre-multiplied color, others just want the opacity. |
| 27 hintColor = brightness == ThemeBrightness.dark ? const Color(0x42FFFFFF) :
const Color(0x4C000000), | 27 hintColor = brightness == ThemeBrightness.dark ? const Color(0x42FFFFFF) :
const Color(0x4C000000), |
| 28 hintOpacity = brightness == ThemeBrightness.dark ? 0.26 : 0.30, | 28 hintOpacity = brightness == ThemeBrightness.dark ? 0.26 : 0.30, |
| 29 highlightColor = const Color(0x66999999), |
| 30 selectedColor = const Color(0x33999999), |
| 29 text = brightness == ThemeBrightness.dark ? typography.white : typography.
black { | 31 text = brightness == ThemeBrightness.dark ? typography.white : typography.
black { |
| 30 assert(brightness != null); | 32 assert(brightness != null); |
| 31 | 33 |
| 32 if (primarySwatch == null) { | 34 if (primarySwatch == null) { |
| 33 if (brightness == ThemeBrightness.dark) { | 35 if (brightness == ThemeBrightness.dark) { |
| 34 _primaryColor = colors.Grey[900]; | 36 _primaryColor = colors.Grey[900]; |
| 35 } else { | 37 } else { |
| 36 _primaryColor = colors.Grey[100]; | 38 _primaryColor = colors.Grey[100]; |
| 37 } | 39 } |
| 38 } else { | 40 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 factory ThemeData.light() => new ThemeData(primarySwatch: colors.Blue, brightn
ess: ThemeBrightness.light); | 51 factory ThemeData.light() => new ThemeData(primarySwatch: colors.Blue, brightn
ess: ThemeBrightness.light); |
| 50 factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark); | 52 factory ThemeData.dark() => new ThemeData(brightness: ThemeBrightness.dark); |
| 51 factory ThemeData.fallback() => new ThemeData.light(); | 53 factory ThemeData.fallback() => new ThemeData.light(); |
| 52 | 54 |
| 53 final ThemeBrightness brightness; | 55 final ThemeBrightness brightness; |
| 54 final Map<int, Color> primarySwatch; | 56 final Map<int, Color> primarySwatch; |
| 55 final Color canvasColor; | 57 final Color canvasColor; |
| 56 final Color cardColor; | 58 final Color cardColor; |
| 57 final Color dividerColor; | 59 final Color dividerColor; |
| 58 final Color hintColor; | 60 final Color hintColor; |
| 61 final Color highlightColor; |
| 62 final Color selectedColor; |
| 59 final double hintOpacity; | 63 final double hintOpacity; |
| 60 final typography.TextTheme text; | 64 final typography.TextTheme text; |
| 61 | 65 |
| 62 Color _primaryColor; | 66 Color _primaryColor; |
| 63 Color get primaryColor => _primaryColor; | 67 Color get primaryColor => _primaryColor; |
| 64 | 68 |
| 65 final ThemeBrightness primaryColorBrightness; | 69 final ThemeBrightness primaryColorBrightness; |
| 66 | 70 |
| 67 Color _accentColor; | 71 Color _accentColor; |
| 68 Color get accentColor => _accentColor; | 72 Color get accentColor => _accentColor; |
| 69 | 73 |
| 70 final ThemeBrightness accentColorBrightness; | 74 final ThemeBrightness accentColorBrightness; |
| 71 } | 75 } |
| OLD | NEW |