diff --git a/lib/data_model.dart b/lib/data_model.dart index c690bf1dbb36ed91041f81b2546555b8950394db..5c914b7cb93b50b3d1012875fe02af00bab04732 100644 --- a/lib/data_model.dart +++ b/lib/data_model.dart @@ -35,13 +35,13 @@ class Event{ abstract class EventStoreBase{ List<Event> store = []; - void setStore(List<Event> st){ - store = st; - } + //void setStore(List<Event> st){ + // store = st; + //} - void reset(){ - store = []; - } + //void reset(){ + // store = []; + //} } class EventType{ diff --git a/lib/main.dart b/lib/main.dart index 754cbd5e4b56dd1e352fbcfbf929ce6941adcb80..82b6fa3c9eff6e5fe0dad5614fe9e91574decfc1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,29 +2,53 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'data_model.dart'; - -class EventStoreInstance extends EventStoreBase{ +class EventStoreInstance extends EventStoreBase { static final EventStoreInstance _instance = EventStoreInstance._internal(); - factory EventStoreInstance(){ + factory EventStoreInstance() { return _instance; } - EventStoreInstance._internal(){ + EventStoreInstance._internal() { store = []; } - } void main() { - //Add some dummy events to eventstore EventStoreInstance events = EventStoreInstance(); - events.store.add(Event.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1', 'label':'SML_KO21_SC01', 'type':'Deployment', 'description':'Remi tool Tag1 1 Traverse', 'status':'PENDING' })); - events.store.add(Event.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1', 'label':'SML_KO21_SC01', 'type':'Deployment', 'description':'Remi tool Tag1 1 Traverse', 'status':'PENDING' })); - events.store.add(Event.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1', 'label':'SML_KO21_SC01', 'type':'Deployment', 'description':'Remi tool Tag1 1 Traverse', 'status':'PENDING' })); - events.store.add(Event.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1', 'label':'SML_KO21_SC01', 'type':'Deployment', 'description':'Remi tool Tag1 1 Traverse', 'status':'PENDING' })); - + events.store.add(Event.fromJson({ + 'id': 8311, + 'urn': 'station:neumayer_iii:awi_snow_sampler_1', + 'label': 'SML_KO21_SC01', + 'type': 'Deployment', + 'description': 'Remi tool Tag1 1 Traverse', + 'status': 'PENDING' + })); + events.store.add(Event.fromJson({ + 'id': 8311, + 'urn': 'station:neumayer_iii:awi_snow_sampler_1', + 'label': 'SML_KO21_SC01', + 'type': 'Deployment', + 'description': 'Remi tool Tag1 1 Traverse', + 'status': 'PENDING' + })); + events.store.add(Event.fromJson({ + 'id': 8311, + 'urn': 'station:neumayer_iii:awi_snow_sampler_1', + 'label': 'SML_KO21_SC01', + 'type': 'Deployment', + 'description': 'Remi tool Tag1 1 Traverse', + 'status': 'PENDING' + })); + events.store.add(Event.fromJson({ + 'id': 8311, + 'urn': 'station:neumayer_iii:awi_snow_sampler_1', + 'label': 'SML_KO21_SC01', + 'type': 'Deployment', + 'description': 'Remi tool Tag1 1 Traverse', + 'status': 'PENDING' + })); runApp(MaterialApp( title: 'Mobile Event Log', @@ -78,17 +102,73 @@ class AddEvent extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text("Add Event"), - ), - body: Center( - child: ElevatedButton( - onPressed: () { - Navigator.pop(context); - }, - child: const Text('Back!'), - ), - ), + appBar: AppBar(title: const Text("Add Event")), + body: + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: <Widget>[ + TextFormField( + decoration: InputDecoration( + labelText: 'Label' + ), + ), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'Event Type', + ), + items: [ + DropdownMenuItem( + child: Text('Calibration'), + value: 'Calibration', + ), + DropdownMenuItem( + child: Text('Information'), + value: 'Information', + ) + ], + onChanged: (value) { + + } + ), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'URN', + ), + items: [ + DropdownMenuItem( + child: Text('ADCP'), + value: 'ADCP', + ), + DropdownMenuItem( + child: Text('EM712'), + value: 'EM712', + ) + ], + onChanged: (value) { + + } + ), + TextFormField( + decoration: InputDecoration( + labelText: 'Description' + ), + ), + TextFormField( + decoration: InputDecoration( + labelText: 'Latitude' + ), + ), + TextFormField( + decoration: InputDecoration( + labelText: 'Longitude' + ), + ), + TextFormField( + decoration: InputDecoration( + labelText: 'Elevation' + ), + ) + ]), bottomNavigationBar: Row( mainAxisAlignment: MainAxisAlignment.end, children: const [ @@ -105,7 +185,6 @@ class AddEvent extends StatelessWidget { } class ViewEvents extends StatelessWidget { - @override Widget build(BuildContext context) { // Get singleton to access locally stored events: