Skip to content

Commit 4e6fc52

Browse files
authored
fix(theme): color switch track (#2912)
1 parent d986000 commit 4e6fc52

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

app_theme/lib/src/dark/theme_global_dark.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,24 @@ ThemeData get themeGlobalDark {
197197
fontWeight: FontWeight.w700,
198198
),
199199
),
200+
switchTheme: SwitchThemeData(
201+
trackColor: WidgetStateProperty.resolveWith<Color?>(
202+
(Set<WidgetState> states) {
203+
if (states.contains(WidgetState.selected)) {
204+
return colorScheme.primary.withOpacity(0.5);
205+
}
206+
return const Color(0xFF444444);
207+
},
208+
),
209+
thumbColor: WidgetStateProperty.resolveWith<Color?>(
210+
(Set<WidgetState> states) {
211+
if (states.contains(WidgetState.selected)) {
212+
return colorScheme.primary;
213+
}
214+
return Colors.white;
215+
},
216+
),
217+
),
200218
extensions: [customTheme],
201219
);
202220

app_theme/lib/src/light/theme_global_light.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ ThemeData get themeGlobalLight {
162162
fontWeight: FontWeight.w700,
163163
),
164164
),
165+
switchTheme: SwitchThemeData(
166+
trackColor: WidgetStateProperty.resolveWith<Color?>(
167+
(Set<WidgetState> states) {
168+
if (states.contains(WidgetState.selected)) {
169+
return colorScheme.primary.withOpacity(0.5);
170+
}
171+
return const Color(0xFFD1D1D1);
172+
},
173+
),
174+
thumbColor: WidgetStateProperty.resolveWith<Color?>(
175+
(Set<WidgetState> states) {
176+
if (states.contains(WidgetState.selected)) {
177+
return colorScheme.primary;
178+
}
179+
return Colors.white;
180+
},
181+
),
182+
),
165183
segmentedButtonTheme: SegmentedButtonThemeData(
166184
style: SegmentedButton.styleFrom(
167185
backgroundColor: const Color.fromRGBO(243, 245, 246, 1),

0 commit comments

Comments
 (0)