Remove motion switch
This commit is contained in:
parent
1b46a4e8b8
commit
7102d19311
2 changed files with 1 additions and 19 deletions
|
|
@ -26,7 +26,6 @@
|
||||||
"wakelockLabel": "Wake lock",
|
"wakelockLabel": "Wake lock",
|
||||||
"stopDetectionLabel": "Stop detection",
|
"stopDetectionLabel": "Stop detection",
|
||||||
"trackingLabel": "Continuous tracking",
|
"trackingLabel": "Continuous tracking",
|
||||||
"motionLabel": "Active movement",
|
|
||||||
"advancedLabel": "Advanced settings",
|
"advancedLabel": "Advanced settings",
|
||||||
"passwordLabel": "Password",
|
"passwordLabel": "Password",
|
||||||
"optimizationMessage": "To ensure reliable tracking, please disable battery optimization for this app.",
|
"optimizationMessage": "To ensure reliable tracking, please disable battery optimization for this app.",
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ class MainScreen extends StatefulWidget {
|
||||||
|
|
||||||
class _MainScreenState extends State<MainScreen> {
|
class _MainScreenState extends State<MainScreen> {
|
||||||
bool trackingEnabled = false;
|
bool trackingEnabled = false;
|
||||||
bool? stopDetection;
|
|
||||||
bool? isMoving;
|
bool? isMoving;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -31,7 +30,6 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
final state = await bg.BackgroundGeolocation.state;
|
final state = await bg.BackgroundGeolocation.state;
|
||||||
setState(() {
|
setState(() {
|
||||||
trackingEnabled = state.enabled;
|
trackingEnabled = state.enabled;
|
||||||
stopDetection = Preferences.instance.getBool(Preferences.stopDetection);
|
|
||||||
isMoving = state.isMoving;
|
isMoving = state.isMoving;
|
||||||
});
|
});
|
||||||
bg.BackgroundGeolocation.onEnabledChange((bool enabled) {
|
bg.BackgroundGeolocation.onEnabledChange((bool enabled) {
|
||||||
|
|
@ -94,6 +92,7 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text(AppLocalizations.of(context)!.trackingLabel),
|
title: Text(AppLocalizations.of(context)!.trackingLabel),
|
||||||
value: trackingEnabled,
|
value: trackingEnabled,
|
||||||
|
activeTrackColor: isMoving == false ? Theme.of(context).colorScheme.error : null,
|
||||||
onChanged: (bool value) async {
|
onChanged: (bool value) async {
|
||||||
if (await PasswordService.authenticate(context) && mounted) {
|
if (await PasswordService.authenticate(context) && mounted) {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -111,19 +110,6 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (stopDetection == false)
|
|
||||||
SwitchListTile(
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
title: Text(AppLocalizations.of(context)!.motionLabel),
|
|
||||||
value: isMoving == true,
|
|
||||||
onChanged: (bool value) {
|
|
||||||
if (value) {
|
|
||||||
bg.BackgroundGeolocation.changePace(true);
|
|
||||||
} else {
|
|
||||||
bg.BackgroundGeolocation.changePace(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
OverflowBar(
|
OverflowBar(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
|
|
@ -177,9 +163,6 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (await PasswordService.authenticate(context) && mounted) {
|
if (await PasswordService.authenticate(context) && mounted) {
|
||||||
await Navigator.push(context, MaterialPageRoute(builder: (_) => const SettingsScreen()));
|
await Navigator.push(context, MaterialPageRoute(builder: (_) => const SettingsScreen()));
|
||||||
setState(() {
|
|
||||||
stopDetection = Preferences.instance.getBool(Preferences.stopDetection);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.settingsButton),
|
child: Text(AppLocalizations.of(context)!.settingsButton),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue