Setting improvements

This commit is contained in:
Anton Tananaev 2025-06-13 15:40:47 -07:00
parent e6ac282afd
commit 20898a78e5
2 changed files with 13 additions and 2 deletions

View file

@ -8,6 +8,7 @@
"statusButton": "Show status",
"settingsButton": "Change settings",
"invalidValue": "Invalid value",
"disabledValue": "Disabled",
"idLabel": "Device identifier",
"urlLabel": "Server URL",
"accuracyLabel": "Location accuracy",
@ -17,7 +18,7 @@
"intervalLabel": "Interval (seconds)",
"fastestIntervalLabel": "Fastest interval (seconds)",
"distanceLabel": "Distance (meters)",
"heartbeatLabel": "Heartbeat (seconds)",
"heartbeatLabel": "Stationary heartbeat (seconds)",
"bufferLabel": "Offline buffering",
"disableElasticityLabel": "Disable elasticity",
"stopDetectionLabel": "Stop detection",

View file

@ -96,7 +96,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
Widget _buildListTile(String title, String key, bool isInt) {
final value = isInt ? Preferences.instance.getInt(key)?.toString() : Preferences.instance.getString(key);
String? value;
if (isInt) {
final intValue = Preferences.instance.getInt(key);
if (intValue != null && intValue > 0) {
value = intValue.toString();
} else {
value = AppLocalizations.of(context)!.disabledValue;
}
} else {
value = Preferences.instance.getString(key);
}
return ListTile(
title: Text(title),
subtitle: Text(value ?? ''),