Additional configuration
This commit is contained in:
parent
48df696256
commit
b8e53175c9
3 changed files with 47 additions and 2 deletions
|
|
@ -16,6 +16,9 @@ class SettingsScreen extends StatefulWidget {
|
|||
|
||||
class _SettingsScreenState extends State<SettingsScreen> {
|
||||
bool buffering = true;
|
||||
bool preventSuspend = false;
|
||||
bool disableElasticity = false;
|
||||
bool stopDetection = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -26,6 +29,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||
void _initState() async {
|
||||
setState(() {
|
||||
buffering = Preferences.instance.getBool(Preferences.buffer) ?? true;
|
||||
preventSuspend = Preferences.instance.getBool(Preferences.preventSuspend) ?? false;
|
||||
disableElasticity = Preferences.instance.getBool(Preferences.disableElasticity) ?? false;
|
||||
stopDetection = Preferences.instance.getBool(Preferences.stopDetection) ?? true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +151,34 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||
setState(() => buffering = value);
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.disableElasticityLabel),
|
||||
value: disableElasticity,
|
||||
onChanged: (value) async {
|
||||
await Preferences.instance.setBool(Preferences.disableElasticity, value);
|
||||
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
||||
setState(() => disableElasticity = value);
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.stopDetectionLabel),
|
||||
value: stopDetection,
|
||||
onChanged: (value) async {
|
||||
await Preferences.instance.setBool(Preferences.stopDetection, value);
|
||||
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
||||
setState(() => stopDetection = value);
|
||||
},
|
||||
),
|
||||
if (Platform.isIOS)
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.preventSuspendLabel),
|
||||
value: preventSuspend,
|
||||
onChanged: (value) async {
|
||||
await Preferences.instance.setBool(Preferences.preventSuspend, value);
|
||||
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
|
||||
setState(() => preventSuspend = value);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue