chore: format code

This commit is contained in:
fiatcode 2026-04-30 15:39:19 +07:00
parent bbd51d1c35
commit d673f01a2d
No known key found for this signature in database
2 changed files with 45 additions and 18 deletions

View file

@ -91,7 +91,8 @@ class _MainScreenState extends State<MainScreen> {
bool success; bool success;
if (newState) { if (newState) {
success = await LocationBridge.startTracking(config: { success = await LocationBridge.startTracking(
config: {
'serverUrl': Preferences.serverUrl, 'serverUrl': Preferences.serverUrl,
'deviceId': Preferences.deviceId, 'deviceId': Preferences.deviceId,
'password': Preferences.password, 'password': Preferences.password,
@ -101,7 +102,8 @@ class _MainScreenState extends State<MainScreen> {
'heartbeat': Preferences.heartbeat, 'heartbeat': Preferences.heartbeat,
'offlineBuffer': Preferences.offlineBuffer, 'offlineBuffer': Preferences.offlineBuffer,
'stopDetection': Preferences.stopDetection, 'stopDetection': Preferences.stopDetection,
}); },
);
} else { } else {
success = await LocationBridge.stopTracking(); success = await LocationBridge.stopTracking();
} }
@ -112,7 +114,11 @@ class _MainScreenState extends State<MainScreen> {
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(previousState ? 'Failed to stop tracking' : 'Failed to start tracking'), content: Text(
previousState
? 'Failed to stop tracking'
: 'Failed to start tracking',
),
), ),
); );
} }

View file

@ -24,9 +24,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
super.initState(); super.initState();
_serverUrlController = TextEditingController(text: Preferences.serverUrl); _serverUrlController = TextEditingController(text: Preferences.serverUrl);
_deviceIdController = TextEditingController(text: Preferences.deviceId); _deviceIdController = TextEditingController(text: Preferences.deviceId);
_distanceFilterController = TextEditingController(text: Preferences.distanceFilter.toString()); _distanceFilterController = TextEditingController(
_intervalController = TextEditingController(text: Preferences.interval.toString()); text: Preferences.distanceFilter.toString(),
_heartbeatController = TextEditingController(text: Preferences.heartbeat.toString()); );
_intervalController = TextEditingController(
text: Preferences.interval.toString(),
);
_heartbeatController = TextEditingController(
text: Preferences.heartbeat.toString(),
);
_accuracy = Preferences.accuracy; _accuracy = Preferences.accuracy;
_offlineBuffer = Preferences.offlineBuffer; _offlineBuffer = Preferences.offlineBuffer;
_stopDetection = Preferences.stopDetection; _stopDetection = Preferences.stopDetection;
@ -87,8 +93,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 16), const SizedBox(height: 16),
_buildSectionHeader('Location'), _buildSectionHeader('Location'),
_buildAccuracyDropdown(), _buildAccuracyDropdown(),
_buildNumberField('Distance Filter (m)', _distanceFilterController, 0, 1000), _buildNumberField(
_buildNumberField('Update Interval (s)', _intervalController, 30, 3600), 'Distance Filter (m)',
_distanceFilterController,
0,
1000,
),
_buildNumberField(
'Update Interval (s)',
_intervalController,
30,
3600,
),
_buildNumberField('Heartbeat (s)', _heartbeatController, 60, 3600), _buildNumberField('Heartbeat (s)', _heartbeatController, 60, 3600),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildSectionHeader('Advanced'), _buildSectionHeader('Advanced'),
@ -153,7 +169,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
); );
} }
Widget _buildNumberField(String label, TextEditingController controller, int min, int max) { Widget _buildNumberField(
String label,
TextEditingController controller,
int min,
int max,
) {
return TextField( return TextField(
controller: controller, controller: controller,
decoration: InputDecoration(labelText: label), decoration: InputDecoration(labelText: label),