Merge pull request #22 from traccar/codex/add-option-to-hide-settings-under-advanced
Add advanced settings toggle
This commit is contained in:
commit
3a5b90e3b9
2 changed files with 37 additions and 20 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
"preventSuspendLabel": "Prevent suspend",
|
"preventSuspendLabel": "Prevent suspend",
|
||||||
"disableElasticityLabel": "Disable elasticity",
|
"disableElasticityLabel": "Disable elasticity",
|
||||||
"stopDetectionLabel": "Stop detection",
|
"stopDetectionLabel": "Stop detection",
|
||||||
|
"advancedLabel": "Show advanced settings",
|
||||||
"trackingLabel": "Continuous tracking",
|
"trackingLabel": "Continuous tracking",
|
||||||
"startAction": "Start service",
|
"startAction": "Start service",
|
||||||
"stopAction": "Stop service",
|
"stopAction": "Stop service",
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
bool preventSuspend = false;
|
bool preventSuspend = false;
|
||||||
bool disableElasticity = false;
|
bool disableElasticity = false;
|
||||||
bool stopDetection = false;
|
bool stopDetection = false;
|
||||||
|
bool advanced = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -132,7 +133,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
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(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
_buildListTile(AppLocalizations.of(context)!.idLabel, Preferences.id, false),
|
_buildListTile(AppLocalizations.of(context)!.idLabel, Preferences.id, false),
|
||||||
|
|
@ -151,25 +165,27 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
setState(() => buffering = value);
|
setState(() => buffering = value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
if (advanced)
|
||||||
title: Text(AppLocalizations.of(context)!.disableElasticityLabel),
|
SwitchListTile(
|
||||||
value: disableElasticity,
|
title: Text(AppLocalizations.of(context)!.disableElasticityLabel),
|
||||||
onChanged: (value) async {
|
value: disableElasticity,
|
||||||
await Preferences.instance.setBool(Preferences.disableElasticity, value);
|
onChanged: (value) async {
|
||||||
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
await Preferences.instance.setBool(Preferences.disableElasticity, value);
|
||||||
setState(() => disableElasticity = value);
|
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
||||||
},
|
setState(() => disableElasticity = value);
|
||||||
),
|
},
|
||||||
SwitchListTile(
|
),
|
||||||
title: Text(AppLocalizations.of(context)!.stopDetectionLabel),
|
if (advanced)
|
||||||
value: stopDetection,
|
SwitchListTile(
|
||||||
onChanged: (value) async {
|
title: Text(AppLocalizations.of(context)!.stopDetectionLabel),
|
||||||
await Preferences.instance.setBool(Preferences.stopDetection, value);
|
value: stopDetection,
|
||||||
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
onChanged: (value) async {
|
||||||
setState(() => stopDetection = value);
|
await Preferences.instance.setBool(Preferences.stopDetection, value);
|
||||||
},
|
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
||||||
),
|
setState(() => stopDetection = value);
|
||||||
if (Platform.isIOS)
|
},
|
||||||
|
),
|
||||||
|
if (advanced && Platform.isIOS)
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.preventSuspendLabel),
|
title: Text(AppLocalizations.of(context)!.preventSuspendLabel),
|
||||||
value: preventSuspend,
|
value: preventSuspend,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue