@@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
55import 'package:flutter/material.dart' ;
66import 'package:flutter/services.dart' ;
77
8+ import '../flet_backend.dart' ;
89import '../models/control.dart' ;
910import '../utils/transforms.dart' ;
1011import 'alignment.dart' ;
@@ -159,7 +160,7 @@ ThemeData parseTheme(
159160 checkboxTheme: parseCheckboxTheme (value? ["checkbox_theme" ], theme),
160161 radioTheme: parseRadioTheme (value? ["radio_theme" ], theme),
161162 badgeTheme: parseBadgeTheme (value? ["badge_theme" ], theme),
162- switchTheme: parseSwitchTheme (value? ["switch_theme" ], theme),
163+ switchTheme: parseSwitchTheme (value? ["switch_theme" ], theme, context ),
163164 dividerTheme: parseDividerTheme (value? ["divider_theme" ], theme),
164165 snackBarTheme: parseSnackBarTheme (value? ["snackbar_theme" ], theme),
165166 bannerTheme: parseBannerTheme (value? ["banner_theme" ], theme),
@@ -192,8 +193,8 @@ ThemeData parseTheme(
192193 filledButtonTheme:
193194 parseFilledButtonTheme (value? ["filled_button_theme" ], theme),
194195 iconButtonTheme: parseIconButtonTheme (value? ["icon_button_theme" ], theme),
195- segmentedButtonTheme:
196- parseSegmentedButtonTheme ( value? ["segmented_button_theme" ], theme),
196+ segmentedButtonTheme: parseSegmentedButtonTheme (
197+ value? ["segmented_button_theme" ], theme, context ),
197198 iconTheme: parseIconTheme (value? ["icon_theme" ], theme),
198199 timePickerTheme: parseTimePickerTheme (value? ["time_picker_theme" ], theme),
199200 );
@@ -659,7 +660,8 @@ BadgeThemeData? parseBadgeTheme(Map<dynamic, dynamic>? value, ThemeData theme,
659660 );
660661}
661662
662- SwitchThemeData ? parseSwitchTheme (Map <dynamic , dynamic >? value, ThemeData theme,
663+ SwitchThemeData ? parseSwitchTheme (
664+ Map <dynamic , dynamic >? value, ThemeData theme, BuildContext context,
663665 [SwitchThemeData ? defaultValue]) {
664666 if (value == null ) return defaultValue;
665667
@@ -668,7 +670,8 @@ SwitchThemeData? parseSwitchTheme(Map<dynamic, dynamic>? value, ThemeData theme,
668670 trackColor: parseWidgetStateColor (value["track_color" ], theme),
669671 overlayColor: parseWidgetStateColor (value["overlay_color" ], theme),
670672 splashRadius: parseDouble (value["splash_radius" ]),
671- thumbIcon: parseWidgetStateIcon (value["thumb_icon" ], theme),
673+ thumbIcon: parseWidgetStateIcon (
674+ value["thumb_icon" ], FletBackend .of (context), theme),
672675 trackOutlineColor:
673676 parseWidgetStateColor (value["track_outline_color" ], theme),
674677 trackOutlineWidth: parseWidgetStateDouble (value["track_outline_width" ]),
@@ -1087,10 +1090,11 @@ NavigationBarThemeData? parseNavigationBarTheme(
10871090}
10881091
10891092SegmentedButtonThemeData ? parseSegmentedButtonTheme (
1090- Map <dynamic , dynamic >? value, ThemeData theme,
1093+ Map <dynamic , dynamic >? value, ThemeData theme, BuildContext context,
10911094 [SegmentedButtonThemeData ? defaultValue]) {
10921095 if (value == null ) return defaultValue;
1093- var selectedIcon = parseIconData (value["selected_icon" ]);
1096+ var selectedIcon =
1097+ parseIconData (value["selected_icon" ], FletBackend .of (context));
10941098
10951099 return theme.segmentedButtonTheme.copyWith (
10961100 selectedIcon: selectedIcon != null ? Icon (selectedIcon) : null ,
@@ -1388,9 +1392,10 @@ extension ThemeParsers on Control {
13881392 return parseBadgeTheme (get (propertyName), theme, defaultValue);
13891393 }
13901394
1391- SwitchThemeData ? getSwitchTheme (String propertyName, ThemeData theme,
1395+ SwitchThemeData ? getSwitchTheme (
1396+ String propertyName, ThemeData theme, BuildContext context,
13921397 [SwitchThemeData ? defaultValue]) {
1393- return parseSwitchTheme (get (propertyName), theme, defaultValue);
1398+ return parseSwitchTheme (get (propertyName), theme, context, defaultValue);
13941399 }
13951400
13961401 DividerThemeData ? getDividerTheme (String propertyName, ThemeData theme,
@@ -1479,9 +1484,10 @@ extension ThemeParsers on Control {
14791484 }
14801485
14811486 SegmentedButtonThemeData ? getSegmentedButtonTheme (
1482- String propertyName, ThemeData theme,
1487+ String propertyName, ThemeData theme, BuildContext context,
14831488 [SegmentedButtonThemeData ? defaultValue]) {
1484- return parseSegmentedButtonTheme (get (propertyName), theme, defaultValue);
1489+ return parseSegmentedButtonTheme (
1490+ get (propertyName), theme, context, defaultValue);
14851491 }
14861492
14871493 IconThemeData ? getIconTheme (String propertyName, ThemeData theme,
0 commit comments