alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931475226
##########
playground/frontend/lib/config/theme.dart:
##########
@@ -174,16 +241,42 @@ final kDarkTheme = ThemeData(
);
class ThemeColors {
+ final Color? _background;
+ final Color? _dropdownButton;
+
final bool isDark;
- static ThemeColors of(BuildContext context) {
- final theme = Provider.of<ThemeProvider>(context);
- return ThemeColors(theme.isDarkMode);
+ static ThemeColors of(BuildContext context, {bool listen = true}) {
+ return Provider.of<ThemeColors>(context, listen: listen);
+ }
+
+ ThemeColors({
+ required this.isDark,
+ Color? background,
+ Color? dropdownButtonColor,
+ }) : _background = background,
+ _dropdownButton = dropdownButtonColor;
+
+ const ThemeColors.fromBrightness({
+ required this.isDark,
+ }) : _background = null,
+ _dropdownButton = null;
+
+ ThemeColors copyWith({
+ Color? background,
+ Color? dropdownButton,
+ }) {
+ return ThemeColors(
+ isDark: isDark,
+ background: background ?? this.background,
+ dropdownButtonColor: dropdownButton ?? this.dropdownButton,
+ );
}
- ThemeColors(this.isDark);
+ Color get dropdownButton =>
+ _dropdownButton ?? (isDark ? kDarkGrey : kLightGrey);
- Color get greyColor => isDark ? kDarkGrey : kLightGrey;
+ Color get divider => isDark ? kDarkGrey : kLightGrey;
Review Comment:
Theme colors should be named after usage and not after the colors. These
ones we needed to override, but it makes no sense to override... grey.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]