chore: format code
This commit is contained in:
parent
bbd51d1c35
commit
d673f01a2d
2 changed files with 45 additions and 18 deletions
|
|
@ -91,17 +91,19 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
if (newState) {
|
if (newState) {
|
||||||
success = await LocationBridge.startTracking(config: {
|
success = await LocationBridge.startTracking(
|
||||||
'serverUrl': Preferences.serverUrl,
|
config: {
|
||||||
'deviceId': Preferences.deviceId,
|
'serverUrl': Preferences.serverUrl,
|
||||||
'password': Preferences.password,
|
'deviceId': Preferences.deviceId,
|
||||||
'accuracy': Preferences.accuracy,
|
'password': Preferences.password,
|
||||||
'distanceFilter': Preferences.distanceFilter,
|
'accuracy': Preferences.accuracy,
|
||||||
'interval': Preferences.interval,
|
'distanceFilter': Preferences.distanceFilter,
|
||||||
'heartbeat': Preferences.heartbeat,
|
'interval': Preferences.interval,
|
||||||
'offlineBuffer': Preferences.offlineBuffer,
|
'heartbeat': Preferences.heartbeat,
|
||||||
'stopDetection': Preferences.stopDetection,
|
'offlineBuffer': Preferences.offlineBuffer,
|
||||||
});
|
'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',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue