From 572fbb386303d7d8f5cf8ad01d0a449b538aad85 Mon Sep 17 00:00:00 2001
From: Maximilian Betz <Maximilian.Betz@awi.de>
Date: Fri, 14 Jan 2022 15:14:41 +0100
Subject: [PATCH] dropdown menu not yet working

---
 lib/data_model.dart | 16 ++++----
 lib/main.dart       | 92 ++++++++++++++++++++++++++++++++-------------
 2 files changed, 73 insertions(+), 35 deletions(-)

diff --git a/lib/data_model.dart b/lib/data_model.dart
index 9d7d211..47d11a5 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 4b08806..f4401a0 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,
+                      ),
+                    ),
+                  ],
+                ),
             ],
           ),
         ),
-- 
GitLab