diff --git a/lib/data_model.dart b/lib/data_model.dart index 9d7d211be989f282d2510d27a6e314537a77d6c4..47d11a52bd78e136802b9b3ce1ea34ff40b60d32 100644 --- a/lib/data_model.dart +++ b/lib/data_model.dart @@ -1,12 +1,12 @@ class Event{ - final int id; - final String urn; - final String label; - final String type; - final String description; - final String status; + int id; + String urn; + String label; + String type; + String description; + String status; Event({ required this.id, @@ -19,8 +19,8 @@ class Event{ } class EventType{ - final String name; - final int id; + String name; + int id; EventType({ required this.name, diff --git a/lib/main.dart b/lib/main.dart index 4b08806c0a149d29cd3a1bb54cc2c4184d88148b..f4401a032e84df5f4a412cbd4059e3cc9a3f92dc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -82,26 +82,34 @@ class AddEvent extends StatelessWidget { } class ViewEvents extends StatelessWidget { + // Add some dummy events: List<Event> events = [] - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ..add(Event(id: 8311, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')) - ; + ..add(Event( + id: 8311, + urn: 'station:neumayer_iii:awi_snow_sampler_1', + label: 'SML_KO21_SC01', + type: 'Deployment', + description: 'Remi tool Tag1 1 Traverse', + status: 'PENDING')) + ..add(Event( + id: 8311, + urn: 'station:neumayer_iii:awi_snow_sampler_1', + label: 'SML_KO21_SC01', + type: 'Deployment', + description: 'Remi tool Tag1 1 Traverse', + status: 'PENDING')) + ..add(Event( + id: 8311, + urn: 'station:neumayer_iii:awi_snow_sampler_1', + label: 'SML_KO21_SC01', + type: 'Deployment', + description: 'Remi tool Tag1 1 Traverse', + status: 'PENDING')); + //for (var i = 0; i<100; i++){ + // events.add(Event(id: i, urn: 'station:neumayer_iii:awi_snow_sampler_1', label: 'SML_KO21_SC01', type: 'Deployment', description: 'Remi tool Tag1 1 Traverse', status: 'PENDING')); + //} - - String testString ='blabalala'; - @override Widget build(BuildContext context) { return Scaffold( @@ -152,16 +160,46 @@ class ViewEvents extends StatelessWidget { ), ], rows: <DataRow>[ - for (var event in events) DataRow( - cells: <DataCell>[ - DataCell(Text(event.id.toString())), - DataCell(Text(event.urn)), - DataCell(Text(event.label)), - DataCell(Text(event.type)), - DataCell(Text(event.description)), - DataCell(Text(event.status)), - ], - ), + for (var event in events) + DataRow( + cells: <DataCell>[ + DataCell(Text(event.id.toString())), + DataCell(Text(event.urn)), + DataCell( + TextFormField( + initialValue: event.label, + onFieldSubmitted: (val) { + event.label = val; //Update Database + }, + ), + ), + DataCell(Text(event.type)), + DataCell( + TextFormField( + initialValue: event.description, + onFieldSubmitted: (val) { + event.description = val; //Update Database + }, + ), + ), + DataCell( + DropdownButtonFormField( + //value: Text('abe'), + items: <DropdownMenuItem>[ + DropdownMenuItem( + child: Text('abs'), + value: Text('1'), + ), + DropdownMenuItem( + child: Text('abc'), + value: Text('1'), + ), + ], + onChanged: null, + ), + ), + ], + ), ], ), ),