From 20898a78e570d7ada4765adf8d34779772ecd554 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 13 Jun 2025 15:40:47 -0700 Subject: [PATCH] Setting improvements --- lib/l10n/app_en.arb | 3 ++- lib/settings_screen.dart | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 1541685..5440fd1 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -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", diff --git a/lib/settings_screen.dart b/lib/settings_screen.dart index 6cb66c0..f95a8fc 100644 --- a/lib/settings_screen.dart +++ b/lib/settings_screen.dart @@ -96,7 +96,17 @@ class _SettingsScreenState extends State { } 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 ?? ''),