Newer
Older
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'datamodel.dart';
import 'addevent.dart';
import 'viewevents.dart';
import 'overview.dart';
import 'configuration.dart';
EventStoreInstance events = EventStoreInstance();
EventTypeStoreInstance eventTypes = EventTypeStoreInstance();
EventCurrentInstance currentEvent = EventCurrentInstance();
DeviceStoreInstance availableDevices = DeviceStoreInstance();
//Reset old data
events.reset();
eventTypes.reset();
currentEvent.reset();
availableDevices.reset();
// TODO: load from shared preferences.
// TODO: this shall be requested from sensor.awi.de after selecting a collection in configuration.
availableDevices.store.add(Device.fromJson({'id': 8311, 'urn':'station:neumayer_iii:awi_snow_sampler_1'}));
availableDevices.store.add(Device.fromJson({'id': 4086, 'urn':'acoustic_backscatter_sensor:test'}));
availableDevices.store.add(Device.fromJson({'id': 1393, 'urn':'vessel:polarstern:hydrosweep_ds3'}));
// Fill the textboxes in addevent with some usefull data.
// TODO: store this in shared preferences so that last entered data reappears when restarting the app.
currentEvent.store.urn = 'acoustic_backscatter_sensor:test';
currentEvent.store.description = 'blabla';
currentEvent.store.label = 'PS129_ABC';
currentEvent.store.type = 'Deployment';
//Add some dummy events to eventstore. Just development purpose. TODO: Remove after development.
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'
}));
//Add some dummy eventtypes.
// TODO: loard from shared preferences.
// TODO: request from https://sensor.awi.de/rest/sensors/events/getAllEventTypes in configuration widget.
eventTypes.store.add(EventType.fromJson({'id': 317, 'name':'Configuration'}));
eventTypes.store.add(EventType.fromJson({'id': 216, 'name':'Decommissioned'}));
eventTypes.store.add(EventType.fromJson({'id': 187, 'name':'Deployment'}));
eventTypes.store.add(EventType.fromJson({'id': 50, 'name':'Information'}));
eventTypes.store.add(EventType.fromJson({'id': 16, 'name':'Maintenance'}));
runApp(MaterialApp(
title: 'Mobile Event Log',
theme: ThemeData(
primarySwatch: Colors.blue,
),
initialRoute: '/',
routes: {
'/': (context) => Overview(),
'/second': (context) => AddEvent(),
'/third': (context) => ViewEvents(),
'/forth': (context) => Configuration(),
},
));
}