Skip to content

Commit

Permalink
Make the development and share URL an entry in the dynamic data tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjtappe committed Dec 25, 2024
1 parent d128928 commit ff6a2bc
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 19 deletions.
18 changes: 14 additions & 4 deletions lib/data/model/home_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ class HomeData extends ModelItem {
final String details;
final String? nowPageUrl;
final String? votingPageUrl;
final String? appShareUrl;
final String? devShareUrl;

HomeData._({
required this.imageUrl,
required this.name,
required this.details,
this.nowPageUrl,
this.votingPageUrl,
this.appShareUrl,
this.devShareUrl,
});

factory HomeData.fromItemData(Map<String, dynamic> itemData) {
Expand All @@ -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'] ?? '',
);
}

Expand All @@ -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'] ?? '',
);
}

Expand All @@ -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(),
};
}
}
6 changes: 5 additions & 1 deletion lib/data/testData/test_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 21 additions & 0 deletions lib/pages/about_page.dart
Original file line number Diff line number Diff line change
@@ -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});
Expand Down Expand Up @@ -41,6 +44,24 @@ class AboutPage extends StatelessWidget {
textAlign: TextAlign.justify, // Center align text
),
SizedBox(height: 32),
Consumer<HomeProvider>(
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,
Expand Down
45 changes: 31 additions & 14 deletions lib/pages/base_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -123,21 +124,37 @@ class _BasePageState extends State<BasePage> {
],
),
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<HomeProvider>(
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();
},
),
],
Expand Down

0 comments on commit ff6a2bc

Please sign in to comment.