consolidated radio groups

This commit is contained in:
Fabian Freund
2025-10-05 10:35:24 +02:00
parent f1f03b1b5c
commit ddccf4cb73
4 changed files with 117 additions and 233 deletions
@@ -49,65 +49,30 @@ class DohSettingsScreen extends HookConsumerWidget {
); );
} }
}, },
child: const RadioListTile.adaptive( child: const Column(
children: [
RadioListTile.adaptive(
value: DohSettingsMode.geckoDefault, value: DohSettingsMode.geckoDefault,
title: Text('Default Protection'), title: Text('Default Protection'),
subtitle: Text('DoH used only when default DNS fails'), subtitle: Text('DoH used only when default DNS fails'),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: dohSettings.dohSettingsMode,
onChanged: (value) async {
if (value != null) {
await ref
.read(saveEngineSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.dohSettingsMode(value),
);
}
},
child: const RadioListTile.adaptive(
value: DohSettingsMode.increased, value: DohSettingsMode.increased,
title: Text('Increased Protection'), title: Text('Increased Protection'),
subtitle: Text('DoH preferred, default DNS as fallback'), subtitle: Text('DoH preferred, default DNS as fallback'),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: dohSettings.dohSettingsMode,
onChanged: (value) async {
if (value != null) {
await ref
.read(saveEngineSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.dohSettingsMode(value),
);
}
},
child: const RadioListTile.adaptive(
value: DohSettingsMode.max, value: DohSettingsMode.max,
title: Text('Max Protection'), title: Text('Max Protection'),
subtitle: Text('DoH only, no fallback'), subtitle: Text('DoH only, no fallback'),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: dohSettings.dohSettingsMode,
onChanged: (value) async {
if (value != null) {
await ref
.read(saveEngineSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.dohSettingsMode(value),
);
}
},
child: const RadioListTile.adaptive(
value: DohSettingsMode.off, value: DohSettingsMode.off,
title: Text('Off'), title: Text('Off'),
subtitle: Text('Use your default DNS resolver'), subtitle: Text('Use your default DNS resolver'),
), ),
],
),
), ),
const ListTile( const ListTile(
leading: Icon(MdiIcons.routerNetwork), leading: Icon(MdiIcons.routerNetwork),
@@ -420,35 +420,24 @@ class GeneralSettingsScreen extends HookConsumerWidget {
); );
} }
}, },
child: const RadioListTile.adaptive( child: const Column(
children: [
RadioListTile.adaptive(
value: TabBarSwipeAction.switchLastOpened, value: TabBarSwipeAction.switchLastOpened,
title: Text('Switch to Last Used Tab'), title: Text('Switch to Last Used Tab'),
subtitle: Text( subtitle: Text(
'Swipe to toggle between current and previously opened tab', 'Swipe to toggle between current and previously opened tab',
), ),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: generalSettings.tabBarSwipeAction,
onChanged: (value) async {
if (value != null) {
await ref
.read(
saveGeneralSettingsControllerProvider.notifier,
)
.save(
(currentSettings) => currentSettings.copyWith
.tabBarSwipeAction(value),
);
}
},
child: const RadioListTile.adaptive(
value: TabBarSwipeAction.navigateOrderedTabs, value: TabBarSwipeAction.navigateOrderedTabs,
title: Text('Navigate Sequential Tabs'), title: Text('Navigate Sequential Tabs'),
subtitle: Text( subtitle: Text(
'Swipe left/right to move through tabs in order', 'Swipe left/right to move through tabs in order',
), ),
), ),
],
),
), ),
], ],
), ),
@@ -298,63 +298,35 @@ class WebEngineSettingsScreen extends HookConsumerWidget {
.trackingProtectionPolicy(value), .trackingProtectionPolicy(value),
); );
}, },
child: child: const Column(
const RadioListTile< children: [
TrackingProtectionPolicy RadioListTile<TrackingProtectionPolicy>.adaptive(
>.adaptive(
value: TrackingProtectionPolicy.none, value: TrackingProtectionPolicy.none,
title: Text('Disabled'), title: Text('Disabled'),
), ),
), RadioListTile<TrackingProtectionPolicy>.adaptive(
RadioGroup(
groupValue: engineSettings.trackingProtectionPolicy,
onChanged: (value) async {
await ref
.read(saveEngineSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.trackingProtectionPolicy(value),
);
},
child: const RadioListTile<TrackingProtectionPolicy>.adaptive(
value: TrackingProtectionPolicy.recommended, value: TrackingProtectionPolicy.recommended,
title: Text('Standard'), title: Text('Standard'),
subtitle: Text( subtitle: Text(
'Pages will load normally, but block fewer trackers.', 'Pages will load normally, but block fewer trackers.',
), ),
), ),
), RadioListTile<TrackingProtectionPolicy>.adaptive(
RadioGroup(
groupValue: engineSettings.trackingProtectionPolicy,
onChanged: (value) async {
await ref
.read(saveEngineSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.trackingProtectionPolicy(value),
);
},
child: const RadioListTile<TrackingProtectionPolicy>.adaptive(
value: TrackingProtectionPolicy.strict, value: TrackingProtectionPolicy.strict,
title: Text('Strict'), title: Text('Strict'),
subtitle: Text( subtitle: Text(
'Stronger tracking protection and faster performance, but some sites may not work properly.', 'Stronger tracking protection and faster performance, but some sites may not work properly.',
), ),
), ),
), RadioListTile<TrackingProtectionPolicy>.adaptive(
RadioGroup(
groupValue: engineSettings.trackingProtectionPolicy,
onChanged: (_) {},
child:
const RadioListTile<
TrackingProtectionPolicy
>.adaptive(
value: TrackingProtectionPolicy.custom, value: TrackingProtectionPolicy.custom,
title: Text('Custom'), title: Text('Custom'),
subtitle: Text( subtitle: Text(
'Choose which trackers and scripts to block.', 'Choose which trackers and scripts to block.',
), ),
), ),
],
),
), ),
], ],
), ),
@@ -167,38 +167,26 @@ class TorProxyScreen extends HookConsumerWidget {
); );
} }
}, },
child: const RadioListTile.adaptive( child: const Column(
children: [
RadioListTile.adaptive(
value: TorRegularTabProxyMode.container, value: TorRegularTabProxyMode.container,
title: Text('Container-Based Routing'), title: Text('Container-Based Routing'),
subtitle: Text( subtitle: Text(
'Route only tabs in Tor containers through the Tor network. Private tabs remain unaffected.', 'Route only tabs in Tor containers through the Tor network. Private tabs remain unaffected.',
), ),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: torSettings.proxyRegularTabsMode,
onChanged: (value) async {
if (value != null) {
await ref
.read(
saveTorSettingsControllerProvider
.notifier,
)
.save(
(currentSettings) => currentSettings
.copyWith
.proxyRegularTabsMode(value),
);
}
},
child: const RadioListTile.adaptive(
value: TorRegularTabProxyMode.all, value: TorRegularTabProxyMode.all,
title: Text('Global Routing'), title: Text('Global Routing'),
subtitle: Text( subtitle: Text(
'Route all regular tabs through the Tor network. Private tabs remain unaffected.', 'Route all regular tabs through the Tor network. Private tabs remain unaffected.',
), ),
), ),
],
), ),
),
SwitchListTile.adaptive( SwitchListTile.adaptive(
inactiveThumbColor: Colors.white, inactiveThumbColor: Colors.white,
activeThumbColor: const Color(0xFF68B030), activeThumbColor: const Color(0xFF68B030),
@@ -337,7 +325,9 @@ class TorProxyScreen extends HookConsumerWidget {
); );
} }
}, },
child: RadioListTile.adaptive( child: Column(
children: [
RadioListTile.adaptive(
value: TorConnectionConfig.direct, value: TorConnectionConfig.direct,
enabled: !torProxyPort.isLoading, enabled: !torProxyPort.isLoading,
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
@@ -349,24 +339,7 @@ class TorProxyScreen extends HookConsumerWidget {
'The best way to connect to Tor if Tor is not blocked', 'The best way to connect to Tor if Tor is not blocked',
), ),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: torSettings.config,
onChanged: (value) async {
if (value != null) {
await ref
.read(
saveTorSettingsControllerProvider
.notifier,
)
.save(
(currentSettings) => currentSettings
.copyWith
.config(value),
);
}
},
child: RadioListTile.adaptive(
value: TorConnectionConfig.obfs4, value: TorConnectionConfig.obfs4,
enabled: !torProxyPort.isLoading, enabled: !torProxyPort.isLoading,
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
@@ -378,24 +351,7 @@ class TorProxyScreen extends HookConsumerWidget {
'Suitable for light censorship and high bandwidth needs', 'Suitable for light censorship and high bandwidth needs',
), ),
), ),
), RadioListTile.adaptive(
RadioGroup(
groupValue: torSettings.config,
onChanged: (value) async {
if (value != null) {
await ref
.read(
saveTorSettingsControllerProvider
.notifier,
)
.save(
(currentSettings) => currentSettings
.copyWith
.config(value),
);
}
},
child: RadioListTile.adaptive(
value: TorConnectionConfig.snowflake, value: TorConnectionConfig.snowflake,
enabled: !torProxyPort.isLoading, enabled: !torProxyPort.isLoading,
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
@@ -407,6 +363,8 @@ class TorProxyScreen extends HookConsumerWidget {
'Suitable for heavy censorship', 'Suitable for heavy censorship',
), ),
), ),
],
),
), ),
CheckboxListTile.adaptive( CheckboxListTile.adaptive(
value: torSettings.fetchRemoteBridges, value: torSettings.fetchRemoteBridges,