Skip to content
Snippets Groups Projects
Commit 5cc95545 authored by Maximilian Betz's avatar Maximilian Betz
Browse files

minor updated

parent 3726e09e
No related branches found
No related tags found
No related merge requests found
......@@ -12,12 +12,15 @@ class ViewEvents extends StatefulWidget {
}
class _ViewEvents extends State<ViewEvents> {
int _synccounter = 0; //For displaying progress during event upload
// Get singleton to access locally stored events:
EventStoreInstance events = EventStoreInstance();
//TODO: add exception handling and display exceptions to user.
Future<bool> syncEvents() async {
final EventStoreInstance events = EventStoreInstance();
//final EventStoreInstance events = EventStoreInstance();
final ConfigurationStoreInstance configuration = ConfigurationStoreInstance();
SensorConnector connection = SensorConnector();
int _synccounter = 0; //For displaying progress during event upload
String? token = await connection.getAuthToken(configuration.loginInformation.mail,
configuration.loginInformation.password);
......@@ -37,8 +40,8 @@ class _ViewEvents extends State<ViewEvents> {
_synccounter--;
debugPrint('put success, remaining events: ' + _synccounter.toString());
event.status = 'EXPORTED'; //Update event status so that it is only exported once.
setState(() {});
}
setState(() {});
}
}
return true;
......@@ -48,17 +51,20 @@ class _ViewEvents extends State<ViewEvents> {
@override
Widget build(BuildContext context) {
// Get singleton to access locally stored events:
final EventStoreInstance events = EventStoreInstance();
return Scaffold(
appBar: AppBar(
title: const Text("View Added Events"),
),
body: SingleChildScrollView(
body: Container(
margin: const EdgeInsets.symmetric(horizontal: 5.0),
child:
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: DataTable(
columns: const <DataColumn>[
DataColumn(
label: Text(
......@@ -184,7 +190,9 @@ class _ViewEvents extends State<ViewEvents> {
DataCell(
TextFormField(
readOnly: true,
initialValue: event.status,
controller: TextEditingController( //Required to update field here
text: event.status,
),
onFieldSubmitted: (val) {
event.status = val; //Update Database
},
......@@ -196,9 +204,11 @@ class _ViewEvents extends State<ViewEvents> {
),
),
),
),
bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Remaining events to sync: ' + events.getPendingEventCount().toString()),
FloatingActionButton.extended(
heroTag: null,
tooltip: 'Upload Events',
......@@ -231,7 +241,7 @@ class _ViewEvents extends State<ViewEvents> {
//Text("Progress"),
const CircularProgressIndicator(),
const SizedBox(height: 10),
Text('Remaining events to sync: ' + _synccounter.toString()),
Text('Remaining events to sync'),
],
),
actions: <Widget>[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment