mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-29 07:34:13 +01:00
feat(theme): Material slider theme and readable Mornye onSecondary
Material sliders use primary on a secondary container track. Mornye picks black or white text on the accent by its luminance, as onPrimary already does. The player artwork theme scopes its slider and navigation colors.
This commit is contained in:
1 parent
5fadb285d9
commit
afccca6d50
3 files changed
+30
-1
No files matched your search
@@ -50,6 +50,7 @@ class AppTheme {
|
||||
navigationBarTheme: _navigationBarTheme(scheme),
|
||||
snackBarTheme: _snackBarTheme(scheme, family),
|
||||
progressIndicatorTheme: _progressIndicatorTheme(scheme),
|
||||
sliderTheme: _sliderTheme(scheme),
|
||||
switchTheme: _switchTheme(scheme),
|
||||
chipTheme: _chipTheme(scheme),
|
||||
popupMenuTheme: _popupMenuTheme(scheme),
|
||||
@@ -102,6 +103,7 @@ class AppTheme {
|
||||
navigationBarTheme: _navigationBarTheme(scheme, isAmoled: isAmoled),
|
||||
snackBarTheme: _snackBarTheme(scheme, family),
|
||||
progressIndicatorTheme: _progressIndicatorTheme(scheme),
|
||||
sliderTheme: _sliderTheme(scheme),
|
||||
switchTheme: _switchTheme(scheme),
|
||||
chipTheme: _chipTheme(scheme),
|
||||
popupMenuTheme: _popupMenuTheme(scheme),
|
||||
@@ -321,6 +323,12 @@ class AppTheme {
|
||||
circularTrackColor: scheme.surfaceContainerHighest,
|
||||
);
|
||||
|
||||
static SliderThemeData _sliderTheme(ColorScheme scheme) => SliderThemeData(
|
||||
activeTrackColor: scheme.primary,
|
||||
inactiveTrackColor: scheme.secondaryContainer,
|
||||
thumbColor: scheme.primary,
|
||||
);
|
||||
|
||||
static SwitchThemeData _switchTheme(ColorScheme scheme) => SwitchThemeData(
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
|
||||
@@ -267,7 +267,9 @@ class MornyeTheme extends ThemeExtension<MornyeTheme> {
|
||||
primaryContainer: grouped,
|
||||
onPrimaryContainer: accent,
|
||||
secondary: accent,
|
||||
onSecondary: Colors.white,
|
||||
onSecondary: accent.computeLuminance() < 0.179
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
secondaryContainer: grouped,
|
||||
onSecondaryContainer: foreground,
|
||||
surface: surface,
|
||||
|
||||
@@ -207,6 +207,8 @@ class _PlayerArtworkThemeState extends State<PlayerArtworkTheme>
|
||||
static ThemeData _scopedTheme(ThemeData base, ColorScheme scheme) {
|
||||
final appBar = base.appBarTheme;
|
||||
final progress = base.progressIndicatorTheme;
|
||||
final navBar = base.navigationBarTheme;
|
||||
final slider = base.sliderTheme;
|
||||
return base.copyWith(
|
||||
colorScheme: scheme,
|
||||
canvasColor: scheme.surface,
|
||||
@@ -220,6 +222,23 @@ class _PlayerArtworkThemeState extends State<PlayerArtworkTheme>
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
navigationBarTheme: navBar.copyWith(
|
||||
backgroundColor: navBar.backgroundColor == null
|
||||
? null
|
||||
: scheme.surfaceContainer,
|
||||
indicatorColor: navBar.indicatorColor == null
|
||||
? null
|
||||
: scheme.secondaryContainer,
|
||||
),
|
||||
sliderTheme: slider.copyWith(
|
||||
activeTrackColor: slider.activeTrackColor == null
|
||||
? null
|
||||
: scheme.primary,
|
||||
inactiveTrackColor: slider.inactiveTrackColor == null
|
||||
? null
|
||||
: scheme.secondaryContainer,
|
||||
thumbColor: slider.thumbColor == null ? null : scheme.primary,
|
||||
),
|
||||
progressIndicatorTheme: progress.copyWith(
|
||||
color: progress.color == null ? null : scheme.primary,
|
||||
linearTrackColor: progress.linearTrackColor == null
|
||||
|
||||
Reference in new issue
Block a user