Merge pull request #22 from traccar/codex/add-option-to-hide-settings-under-advanced

Add advanced settings toggle
This commit is contained in:
Anton Tananaev 2025-06-13 09:58:19 -07:00 committed by GitHub
commit 3a5b90e3b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 20 deletions

View file

@ -21,6 +21,7 @@
"preventSuspendLabel": "Prevent suspend",
"disableElasticityLabel": "Disable elasticity",
"stopDetectionLabel": "Stop detection",
"advancedLabel": "Show advanced settings",
"trackingLabel": "Continuous tracking",
"startAction": "Start service",
"stopAction": "Stop service",

View file

@ -19,6 +19,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool preventSuspend = false;
bool disableElasticity = false;
bool stopDetection = false;
bool advanced = false;
@override
void initState() {
@ -132,7 +133,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(AppLocalizations.of(context)!.settingsTitle)),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.settingsTitle),
actions: [
Row(
children: [
Text(AppLocalizations.of(context)!.advancedLabel),
Switch(
value: advanced,
onChanged: (value) => setState(() => advanced = value),
),
],
),
],
),
body: ListView(
children: [
_buildListTile(AppLocalizations.of(context)!.idLabel, Preferences.id, false),
@ -151,6 +165,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() => buffering = value);
},
),
if (advanced)
SwitchListTile(
title: Text(AppLocalizations.of(context)!.disableElasticityLabel),
value: disableElasticity,
@ -160,6 +175,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() => disableElasticity = value);
},
),
if (advanced)
SwitchListTile(
title: Text(AppLocalizations.of(context)!.stopDetectionLabel),
value: stopDetection,
@ -169,7 +185,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() => stopDetection = value);
},
),
if (Platform.isIOS)
if (advanced && Platform.isIOS)
SwitchListTile(
title: Text(AppLocalizations.of(context)!.preventSuspendLabel),
value: preventSuspend,