opt switch style

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-20 21:59:13 +08:00
parent c54d77f393
commit 787be7ac11
9 changed files with 8 additions and 95 deletions

View File

@@ -44,14 +44,6 @@ List<SettingsModel> get videoSettings => [
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.lock_outline_rounded);
}
return null;
}),
value: true,
onChanged: (_) {},
),

View File

@@ -143,14 +143,6 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.done);
}
return null;
}),
value: val,
onChanged: (value) => switchChange(theme, value),
),

View File

@@ -123,14 +123,6 @@ class _SpaceSettingPageState extends State<SpaceSettingPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.done);
}
return null;
}),
value: item.boolVal,
onChanged: onChanged,
),

View File

@@ -227,12 +227,6 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((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<SponsorBlockPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((states) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.done);
}
return null;
}),
value: _blockTrack,
onChanged: (val) => update(),
),

View File

@@ -52,13 +52,6 @@ class _ViewPointsPageState extends State<ViewPointsPage>
alignment: Alignment.centerLeft,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((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,

View File

@@ -92,14 +92,6 @@ class _WhisperLinkSettingPageState extends State<WhisperLinkSettingPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> 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<WhisperLinkSettingPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> 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<WhisperLinkSettingPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> 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<WhisperLinkSettingPage> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> 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),

View File

@@ -53,12 +53,6 @@ class ImSettingsItem extends StatelessWidget {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((states) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.done);
}
return null;
}),
value: item.switch_1.switchOn,
onChanged: (value) => onChanged(),
),

View File

@@ -227,17 +227,6 @@ abstract class PageUtils {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon:
WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.isNotEmpty &&
states.first ==
WidgetState.selected) {
return const Icon(Icons.done);
}
return null;
}),
value: shutdownTimerService
.waitForPlayingCompleted,
onChanged: (value) {

View File

@@ -115,6 +115,14 @@ abstract class ThemeUtils {
cupertinoOverrideTheme: CupertinoThemeData(
selectionHandleColor: colorScheme.primary,
),
switchTheme: const SwitchThemeData(
thumbIcon: WidgetStateProperty<Icon?>.fromMap(
<WidgetStatesConstraint, Icon?>{
WidgetState.selected: Icon(Icons.done),
WidgetState.any: null,
},
),
),
);
if (isDark) {
if (Pref.isPureBlackTheme) {