diff --git a/lib/data/model/home_data.dart b/lib/data/model/home_data.dart index f4f4b3a..8918680 100644 --- a/lib/data/model/home_data.dart +++ b/lib/data/model/home_data.dart @@ -10,6 +10,8 @@ class HomeData extends ModelItem { final String details; final String? nowPageUrl; final String? votingPageUrl; + final String? appShareUrl; + final String? devShareUrl; HomeData._({ required this.imageUrl, @@ -17,6 +19,8 @@ class HomeData extends ModelItem { required this.details, this.nowPageUrl, this.votingPageUrl, + this.appShareUrl, + this.devShareUrl, }); factory HomeData.fromItemData(Map itemData) { @@ -26,6 +30,8 @@ class HomeData extends ModelItem { details: itemData['Description'] ?? '', nowPageUrl: itemData['Now Page Link'] ?? '', votingPageUrl: itemData['Survey Link'] ?? '', + appShareUrl: itemData['App Share Link'] ?? '', + devShareUrl: itemData['App Dev Link'] ?? '', ); } @@ -34,8 +40,10 @@ class HomeData extends ModelItem { imageUrl: json['imageUrl'], name: json['name'] as String? ?? '', details: json['details'] as String? ?? '', - nowPageUrl: json['nowPageUrl'], - votingPageUrl: json['votingPageUrl'], + nowPageUrl: json['nowPageUrl'] ?? '', + votingPageUrl: json['votingPageUrl'] ?? '', + appShareUrl: json['appShareUrl'] ?? '', + devShareUrl: json['devShareUrl'] ?? '', ); } @@ -44,8 +52,10 @@ class HomeData extends ModelItem { 'imageUrl': imageUrl, 'name': name.toString(), 'details': details.toString(), - 'nowPageUrl': nowPageUrl, - 'votingPageUrl': votingPageUrl, + 'nowPageUrl': nowPageUrl.toString(), + 'votingPageUrl': votingPageUrl.toString(), + 'appShareUrl': appShareUrl.toString(), + 'devShareUrl': devShareUrl.toString(), }; } } diff --git a/lib/data/testData/test_data.dart b/lib/data/testData/test_data.dart index 386dea0..424f739 100644 --- a/lib/data/testData/test_data.dart +++ b/lib/data/testData/test_data.dart @@ -118,10 +118,14 @@ class TestData { } else { speaker = null; } + String namePrefix = "Event"; + if (startTime.second == 0) { + namePrefix = "Notify"; + } items.add(EventData( start: startTime, end: endTime, - name: 'Event $eventCount', + name: '$namePrefix $eventCount', details: 'Details', track: track.name, speaker: speaker?.name, diff --git a/lib/pages/about_page.dart b/lib/pages/about_page.dart index cc5e521..fe2b4a6 100644 --- a/lib/pages/about_page.dart +++ b/lib/pages/about_page.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:iccm_eu_app/components/url_button.dart'; +import 'package:iccm_eu_app/data/dataProviders/home_provider.dart'; +import 'package:provider/provider.dart'; class AboutPage extends StatelessWidget { const AboutPage({super.key}); @@ -41,6 +44,24 @@ class AboutPage extends StatelessWidget { textAlign: TextAlign.justify, // Center align text ), SizedBox(height: 32), + Consumer( + builder: (context, itemProvider, child) { + final itemList = itemProvider.items(); + if (itemList.isEmpty) { + return const Center( + child: Text('Loading dynamic content...'), + ); + } + final item = itemList.first; // Use the first item + String shareUrl = item.appShareUrl ?? ''; + return (shareUrl.startsWith('https://')) ? + UrlButton( + title: 'Development URL', + url: shareUrl, + ) : SizedBox.shrink(); + }, + ), + SizedBox(height: 32), Text( 'Copyright © 2024 ICCM Europe', style: Theme.of(context).textTheme.bodyLarge, diff --git a/lib/pages/base_page.dart b/lib/pages/base_page.dart index 29545c7..52fc919 100644 --- a/lib/pages/base_page.dart +++ b/lib/pages/base_page.dart @@ -6,6 +6,7 @@ import 'package:iccm_eu_app/controls/nav_bar.dart'; import 'package:iccm_eu_app/data/appProviders/page_index_provider.dart'; import 'package:iccm_eu_app/data/appProviders/error_provider.dart'; import 'package:iccm_eu_app/data/dataProviders/gsheets_provider.dart'; +import 'package:iccm_eu_app/data/dataProviders/home_provider.dart'; import 'package:iccm_eu_app/pages/share_page.dart'; import 'package:iccm_eu_app/theme/dark_theme.dart'; import 'package:iccm_eu_app/theme/light_theme.dart'; @@ -123,21 +124,37 @@ class _BasePageState extends State { ], ), actions: [ - IconButton( - icon: Icon( - Icons.share, - color: Theme.of(context).colorScheme.tertiary, - ), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const SharePage( - url: 'https://github.com/ICCM-EU/iccm_eu_app', - ), - fullscreenDialog: true, // Open fullscreen + Consumer( + builder: (context, itemProvider, child) { + final itemList = itemProvider.items(); + if (itemList.isEmpty) { + return const Center( + child: Text('Loading dynamic content...'), + ); + } + final item = itemList.first; // Use the first item + String shareUrl = item.appShareUrl ?? ''; + return (shareUrl.startsWith('https://')) ? IconButton( + icon: Icon( + Icons.share, + color: Theme + .of(context) + .colorScheme + .tertiary, ), - ); + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SharePage( + url: shareUrl, + ), + fullscreenDialog: true, // Open fullscreen + ), + ); + }, + ) : SizedBox.shrink(); }, ), ],