diff --git a/lib/pages/setting/models/video_settings.dart b/lib/pages/setting/models/video_settings.dart index 62f42f354..01b712ad6 100644 --- a/lib/pages/setting/models/video_settings.dart +++ b/lib/pages/setting/models/video_settings.dart @@ -44,14 +44,6 @@ List get videoSettings => [ alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.lock_outline_rounded); - } - return null; - }), value: true, onChanged: (_) {}, ), diff --git a/lib/pages/setting/widgets/switch_item.dart b/lib/pages/setting/widgets/switch_item.dart index 1568b41eb..a15a4fc5d 100644 --- a/lib/pages/setting/widgets/switch_item.dart +++ b/lib/pages/setting/widgets/switch_item.dart @@ -143,14 +143,6 @@ class _SetSwitchItemState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: val, onChanged: (value) => switchChange(theme, value), ), diff --git a/lib/pages/space_setting/view.dart b/lib/pages/space_setting/view.dart index cafac3a5c..81ede14e7 100644 --- a/lib/pages/space_setting/view.dart +++ b/lib/pages/space_setting/view.dart @@ -123,14 +123,6 @@ class _SpaceSettingPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: item.boolVal, onChanged: onChanged, ), diff --git a/lib/pages/sponsor_block/view.dart b/lib/pages/sponsor_block/view.dart index 19f515b4b..4eee7e80d 100644 --- a/lib/pages/sponsor_block/view.dart +++ b/lib/pages/sponsor_block/view.dart @@ -227,12 +227,6 @@ class _SponsorBlockPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith((states) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: _blockToast, onChanged: (val) => update(), ), @@ -268,12 +262,6 @@ class _SponsorBlockPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith((states) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: _blockTrack, onChanged: (val) => update(), ), diff --git a/lib/pages/video/view_point/view.dart b/lib/pages/video/view_point/view.dart index 2aa8381e1..c2f29f0fb 100644 --- a/lib/pages/video/view_point/view.dart +++ b/lib/pages/video/view_point/view.dart @@ -52,13 +52,6 @@ class _ViewPointsPageState extends State alignment: Alignment.centerLeft, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith((states) { - if (states.isNotEmpty && - states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: videoDetailController.showVP.value, onChanged: (value) => videoDetailController.showVP.value = value, diff --git a/lib/pages/whisper_link_setting/view.dart b/lib/pages/whisper_link_setting/view.dart index dacfb6245..02484ade5 100644 --- a/lib/pages/whisper_link_setting/view.dart +++ b/lib/pages/whisper_link_setting/view.dart @@ -92,14 +92,6 @@ class _WhisperLinkSettingPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: isBlocked, onChanged: (value) => _controller.setBlock(isBlocked), ), @@ -202,15 +194,6 @@ class _WhisperLinkSettingPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && - states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: response.pushSetting == 0, onChanged: (value) => _controller.setPush(response.pushSetting == 0), @@ -227,15 +210,6 @@ class _WhisperLinkSettingPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && - states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: _controller.isPinned.value, onChanged: (value) => _controller.setPin(), ), @@ -266,15 +240,6 @@ class _WhisperLinkSettingPageState extends State { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && - states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: response!.first.setting == 1, onChanged: (value) => _controller.setMute(response.first.setting == 1), diff --git a/lib/pages/whisper_settings/widgets/item.dart b/lib/pages/whisper_settings/widgets/item.dart index 84b2d7843..293059051 100644 --- a/lib/pages/whisper_settings/widgets/item.dart +++ b/lib/pages/whisper_settings/widgets/item.dart @@ -53,12 +53,6 @@ class ImSettingsItem extends StatelessWidget { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: WidgetStateProperty.resolveWith((states) { - if (states.isNotEmpty && states.first == WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: item.switch_1.switchOn, onChanged: (value) => onChanged(), ), diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index d990a6aea..0f9d1b8df 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -227,17 +227,6 @@ abstract class PageUtils { alignment: Alignment.centerRight, scale: 0.8, child: Switch( - thumbIcon: - WidgetStateProperty.resolveWith(( - Set states, - ) { - if (states.isNotEmpty && - states.first == - WidgetState.selected) { - return const Icon(Icons.done); - } - return null; - }), value: shutdownTimerService .waitForPlayingCompleted, onChanged: (value) { diff --git a/lib/utils/theme_utils.dart b/lib/utils/theme_utils.dart index b41a604bc..0bd32d627 100644 --- a/lib/utils/theme_utils.dart +++ b/lib/utils/theme_utils.dart @@ -115,6 +115,14 @@ abstract class ThemeUtils { cupertinoOverrideTheme: CupertinoThemeData( selectionHandleColor: colorScheme.primary, ), + switchTheme: const SwitchThemeData( + thumbIcon: WidgetStateProperty.fromMap( + { + WidgetState.selected: Icon(Icons.done), + WidgetState.any: null, + }, + ), + ), ); if (isDark) { if (Pref.isPureBlackTheme) {