From 25feab92aa64cc018f1eff424e55ea1e2cc989c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Wed, 25 Dec 2024 16:51:01 +0100 Subject: [PATCH] Embed forceNotify events into the test schedule. --- lib/components/event_list_tile.dart | 2 +- lib/data/dataProviders/events_provider.dart | 2 +- lib/data/model/event_data.dart | 10 +++++----- lib/data/testData/test_data.dart | 5 ++++- lib/pages/event_details_page.dart | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/components/event_list_tile.dart b/lib/components/event_list_tile.dart index 02b7c27..0e77574 100644 --- a/lib/components/event_list_tile.dart +++ b/lib/components/event_list_tile.dart @@ -99,7 +99,7 @@ class EventListTile extends StatelessWidget { .of(context) .style, children: [ - if (item.notifyAfterBreak == true) TextSpan( + if (item.forceNotify == true) TextSpan( text: '📢 ', style: Theme .of(context) diff --git a/lib/data/dataProviders/events_provider.dart b/lib/data/dataProviders/events_provider.dart index 77cfe47..388dd82 100644 --- a/lib/data/dataProviders/events_provider.dart +++ b/lib/data/dataProviders/events_provider.dart @@ -119,7 +119,7 @@ class EventsProvider with ChangeNotifier { for (EventData item in _items.where( (item) => - (item.notifyAfterBreak ?? false)).toList() + (item.forceNotify ?? false)).toList() ) { itemIDs.add(item.id ?? 0); LocalNotificationService.scheduleNotification( diff --git a/lib/data/model/event_data.dart b/lib/data/model/event_data.dart index 16d830f..10fe2e9 100644 --- a/lib/data/model/event_data.dart +++ b/lib/data/model/event_data.dart @@ -15,7 +15,7 @@ class EventData extends FlutterWeekViewEvent { final String details; String? surveyUrl; String? parallelSessions; - bool? notifyAfterBreak = false; + bool? forceNotify = false; int? id = -1; @@ -34,7 +34,7 @@ class EventData extends FlutterWeekViewEvent { this.facilitator, this.surveyUrl, this.parallelSessions, - this.notifyAfterBreak, + this.forceNotify, this.id, // optional inherited parameters @@ -75,7 +75,7 @@ class EventData extends FlutterWeekViewEvent { facilitator: itemData['Facilitator'], surveyUrl: itemData['Survey URL'], parallelSessions: itemData['Parallel'], - notifyAfterBreak: itemData['Notify-after-Break'] == 'true', + forceNotify: itemData['Notify-after-Break'] == 'true', backgroundColor: Colors.red, padding: EdgeInsets.all(0), ); @@ -94,7 +94,7 @@ class EventData extends FlutterWeekViewEvent { facilitator: json['facilitator'], surveyUrl: json['surveyUrl'], parallelSessions: json['parallelSessions'], - notifyAfterBreak: bool.tryParse(json['notifyAfterBreak']), + forceNotify: bool.tryParse(json['forceNotify']), id: int.tryParse(json['id'] ?? '-1'), ); } @@ -112,7 +112,7 @@ class EventData extends FlutterWeekViewEvent { 'facilitator': facilitator?.toString(), 'surveyUrl': surveyUrl.toString(), 'parallelSessions': parallelSessions.toString(), - 'notifyAfterBreak': notifyAfterBreak.toString(), + 'forceNotify': forceNotify.toString(), 'id': id.toString(), }; } diff --git a/lib/data/testData/test_data.dart b/lib/data/testData/test_data.dart index 424f739..8a2d0f8 100644 --- a/lib/data/testData/test_data.dart +++ b/lib/data/testData/test_data.dart @@ -119,8 +119,10 @@ class TestData { speaker = null; } String namePrefix = "Event"; - if (startTime.second == 0) { + bool forceNotify = false; + if (startTime.second % 30 == 0) { namePrefix = "Notify"; + forceNotify = true; } items.add(EventData( start: startTime, @@ -130,6 +132,7 @@ class TestData { track: track.name, speaker: speaker?.name, room: room.name, + forceNotify: forceNotify, )); eventCount ++; } diff --git a/lib/pages/event_details_page.dart b/lib/pages/event_details_page.dart index dc0a990..9298776 100644 --- a/lib/pages/event_details_page.dart +++ b/lib/pages/event_details_page.dart @@ -122,7 +122,7 @@ class EventDetailsPage extends StatelessWidget { .textTheme .titleMedium, children: [ - if (item.notifyAfterBreak == true) TextSpan( + if (item.forceNotify == true) TextSpan( text: '📢 ', style: Theme .of(context)