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;
|
||||
if (newState) {
|
||||
success = await LocationBridge.startTracking(config: {
|
||||
'serverUrl': Preferences.serverUrl,
|
||||
'deviceId': Preferences.deviceId,
|
||||
'password': Preferences.password,
|
||||
'accuracy': Preferences.accuracy,
|
||||
'distanceFilter': Preferences.distanceFilter,
|
||||
'interval': Preferences.interval,
|
||||
'heartbeat': Preferences.heartbeat,
|
||||
'offlineBuffer': Preferences.offlineBuffer,
|
||||
'stopDetection': Preferences.stopDetection,
|
||||
});
|
||||
success = await LocationBridge.startTracking(
|
||||
config: {
|
||||
'serverUrl': Preferences.serverUrl,
|
||||
'deviceId': Preferences.deviceId,
|
||||
'password': Preferences.password,
|
||||
'accuracy': Preferences.accuracy,
|
||||
'distanceFilter': Preferences.distanceFilter,
|
||||
'interval': Preferences.interval,
|
||||
'heartbeat': Preferences.heartbeat,
|
||||
'offlineBuffer': Preferences.offlineBuffer,
|
||||
'stopDetection': Preferences.stopDetection,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
success = await LocationBridge.stopTracking();
|
||||
}
|
||||
|
|
@ -112,7 +114,11 @@ class _MainScreenState extends State<MainScreen> {
|
|||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
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();
|
||||
_serverUrlController = TextEditingController(text: Preferences.serverUrl);
|
||||
_deviceIdController = TextEditingController(text: Preferences.deviceId);
|
||||
_distanceFilterController = TextEditingController(text: Preferences.distanceFilter.toString());
|
||||
_intervalController = TextEditingController(text: Preferences.interval.toString());
|
||||
_heartbeatController = TextEditingController(text: Preferences.heartbeat.toString());
|
||||
_distanceFilterController = TextEditingController(
|
||||
text: Preferences.distanceFilter.toString(),
|
||||
);
|
||||
_intervalController = TextEditingController(
|
||||
text: Preferences.interval.toString(),
|
||||
);
|
||||
_heartbeatController = TextEditingController(
|
||||
text: Preferences.heartbeat.toString(),
|
||||
);
|
||||
_accuracy = Preferences.accuracy;
|
||||
_offlineBuffer = Preferences.offlineBuffer;
|
||||
_stopDetection = Preferences.stopDetection;
|
||||
|
|
@ -87,8 +93,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||
const SizedBox(height: 16),
|
||||
_buildSectionHeader('Location'),
|
||||
_buildAccuracyDropdown(),
|
||||
_buildNumberField('Distance Filter (m)', _distanceFilterController, 0, 1000),
|
||||
_buildNumberField('Update Interval (s)', _intervalController, 30, 3600),
|
||||
_buildNumberField(
|
||||
'Distance Filter (m)',
|
||||
_distanceFilterController,
|
||||
0,
|
||||
1000,
|
||||
),
|
||||
_buildNumberField(
|
||||
'Update Interval (s)',
|
||||
_intervalController,
|
||||
30,
|
||||
3600,
|
||||
),
|
||||
_buildNumberField('Heartbeat (s)', _heartbeatController, 60, 3600),
|
||||
const SizedBox(height: 16),
|
||||
_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(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue