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

added overlay popup as feedback for added event

parent 37ceb0a7
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,8 @@ A cross plattform project for android and ios to log events offline everywhere a
- Compile an Apple iOS version.
- Only show time down to seconds. Hide microseconds, to save space on view & sync.
- On older Android 6 Devices the following error is shown" OS Error CERTIFICATE_VERIFY_FAILED: certificate has expired". Fix or require at least Android x?
- Show version information and build date
- Implement switch to select sandbox or productive version.
## UI Feedback
- Colors
......@@ -61,7 +62,7 @@ Text: #57827E
# Add Event
- Show \* next to lable for required fields.
- NOW button Equal distance to edge and textfield. Same hight as textfield.
- GNSS Switch above 'Label' field or in TopMenuBar?
- GNSS Switch above 'Label' field or in TopMenuBar? The current position is suboptimal as sometimes clicked when adding a event is desired.
- Precision, No-Fix, GNSS-deactivated : alligned left
- Event Type /URN Item separation and hightlighting chosen type as in configuration.
- Is a field for end time required here?
......@@ -76,4 +77,5 @@ Text: #57827E
# Overview
- Add Icon to Add, View and Configuration button. Then use uppercase Text.
\ No newline at end of file
- Add Icon to Add, View and Configuration button. Then use uppercase Text.
......@@ -169,15 +169,68 @@ class _AddEventPageState extends State<AddEvent> {
return false;
}
Future<void> _storeCurrentEvent() async {
void _showAddSuccessOverlay(BuildContext context) async {
// Declaring and Initializing OverlayState
// and OverlayEntry objects
OverlayState? overlayState = Overlay.of(context);
OverlayEntry overlayEntry;
overlayEntry = OverlayEntry(builder: (context) {
// You can return any widget you like
// here to be displayed on the Overlay
return Positioned(
top: MediaQuery.of(context).padding.top,
right: MediaQuery.of(context).padding.right,
child: Material(
color: Colors.transparent,
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: const EdgeInsets.all(3.0), //a view pixel space to top and right
child: Container(
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0)
)
),
child: const Padding(
padding: EdgeInsets.all(10.0),
child: Text(
'Created Event!',
//style: TextStyle(
// color: Colors.black, fontWeight: FontWeight.bold),
),
),
),
),
),
),
);
});
// Inserting the OverlayEntry into the Overlay
overlayState?.insert(overlayEntry);
// Awaiting for 3 seconds
await Future.delayed(const Duration(seconds: 3));
// Removing the OverlayEntry from the Overlay
overlayEntry.remove();
}
Future<void> _storeCurrentEvent(BuildContext context) async {
final EventStoreInstance event = EventStoreInstance();
final ConfigurationStoreInstance configuration = ConfigurationStoreInstance();
event.currentEvent.typeId = configuration.getEventIdFromName(event.currentEvent.type);
event.currentEvent.status = "PENDING";
await database.addEvent(event.currentEvent); //TODO: display feedback after this async function
await database.addEvent(event.currentEvent);
HapticFeedback.vibrate(); //Feedback that adding event succeeded
_addButtonEnabled = true; //Activate button for add more events
setState(() {});
_showAddSuccessOverlay(context); //Show pop up to indicated adding event succeeded.
//Update timestamp in UI
var date = DateTime.now().toUtc();
......@@ -482,7 +535,7 @@ class _AddEventPageState extends State<AddEvent> {
onPressed: () {
if (_validateInput()) {
_addButtonEnabled = false; //Disable button until event is stored
_storeCurrentEvent();
_storeCurrentEvent(context);
}
setState(() {});
......@@ -528,4 +581,5 @@ class _AddEventPageState extends State<AddEvent> {
}
//TODO: show an allert dialog to notify the user that the event has been added.
//TODO: The app shall prefill the label with a configurable prefix and optionally a running number. E.g. prefix: (PS122.3-4_) running number: 1 label = PS122.3-4_1
\ No newline at end of file
//TODO: The app shall prefill the label with a configurable prefix and optionally a running number. E.g. prefix: (PS122.3-4_) running number: 1 label = PS122.3-4_1
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