diff --git a/app/lib/main.dart b/app/lib/main.dart index 9df52f3..6a41e8a 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -11,7 +11,7 @@ Future main() async { appName: "TourForge Baseline App", appDesc: '''TourForge Baseline App is the starter app for the TourForge Baseline library.''', - baseUrl: "http://192.168.4.248:8000/", + baseUrl: "https://fmu-tourforge-data.s3.us-east-1.amazonaws.com/FMUCampusTour", lightThemeData: lightThemeData, darkThemeData: darkThemeData, ), diff --git a/lib/src/screens/home.dart b/lib/src/screens/home.dart index d7cf95c..69bfd74 100644 --- a/lib/src/screens/home.dart +++ b/lib/src/screens/home.dart @@ -126,149 +126,154 @@ class _TourListItem extends StatefulWidget { class _TourListItemState extends State<_TourListItem> { @override Widget build(BuildContext context) { - return Material( - type: MaterialType.card, - borderRadius: const BorderRadius.all(Radius.circular(16)), - elevation: 3, - shadowColor: Colors.transparent, - child: InkWell( - onTap: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => TourDetails(widget.tour))); - }, - onLongPress: () { - showDialog( - context: context, - builder: (BuildContext context) => Dialog( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 24.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox(height: 24.0), - const Text( - "Would you like to delete the locally-downloaded content of this tour?\n\n" - "You will still be able to redownload this tour in the future if desired.", - softWrap: true, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - TextButton( - onPressed: () { - Navigator.pop(context); - }, - child: const Text('Cancel'), - ), - TextButton( - onPressed: () async { - await AssetGarbageCollector.run(ignoredTours: {widget.tour.id}); - - if (!context.mounted) return; - Navigator.pop(context); - }, - child: const Text('Delete'), - ), - ], - ), - const SizedBox(height: 8.0), - ], - ), - ), - ), - ); - }, + return Padding( + padding: const EdgeInsets.only(bottom: 16.0), + child: Material( + type: MaterialType.card, borderRadius: const BorderRadius.all(Radius.circular(16)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - SizedBox( - height: 200, - child: ClipRRect( - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(16), - topRight: Radius.circular(16), + elevation: 3, + shadowColor: Colors.transparent, + child: InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (context) => TourDetails(widget.tour))); + }, + onLongPress: () { + showDialog( + context: context, + builder: (BuildContext context) => Dialog( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 24.0), + const Text( + "Would you like to delete the locally-downloaded content of this tour?\n\n" + "You will still be able to redownload this tour in the future if desired.", + softWrap: true, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () async { + await AssetGarbageCollector.run(ignoredTours: {widget.tour.id}); + + if (!context.mounted) return; + Navigator.pop(context); + }, + child: const Text('Delete'), + ), + ], + ), + const SizedBox(height: 8.0), + ], + ), ), - child: widget.tour.gallery.isNotEmpty - ? AssetImageBuilder( - widget.tour.gallery[0], - builder: (image) { - return Image( - image: image, - fit: BoxFit.cover, - ); - }, - ) - : const SizedBox(), - ), - ), - Padding( - padding: const EdgeInsets.only( - left: 16.0, - right: 16.0, - top: 16.0, - bottom: 8.0, ), - child: Text( - widget.tour.title, - style: Theme.of(context) - .textTheme - .titleLarge! - .copyWith(fontSize: 18), - maxLines: 2, - overflow: TextOverflow.ellipsis, + ); + }, + borderRadius: const BorderRadius.all(Radius.circular(16)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + height: 200, + child: ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), + child: widget.tour.gallery.isNotEmpty + ? AssetImageBuilder( + widget.tour.gallery[0], + builder: (image) { + return Image( + image: image, + fit: BoxFit.cover, + ); + }, + ) + : const SizedBox(), + ), ), - ), - Padding( - padding: const EdgeInsets.only( - left: 16.0, - right: 16.0, - bottom: 16.0, + Padding( + padding: const EdgeInsets.only( + left: 16.0, + right: 16.0, + top: 16.0, + bottom: 8.0, + ), + child: Text( + widget.tour.title, + style: Theme.of(context) + .textTheme + .titleLarge! + .copyWith(fontSize: 18), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), ), - child: Wrap( - spacing: 4.0, - runSpacing: 8.0, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - const Icon( - Icons.download, - size: 20, - color: Color.fromARGB(255, 160, 160, 160), - ), - Text( - "Download", - style: Theme.of(context).textTheme.labelMedium!.copyWith( - color: const Color.fromARGB(255, 160, 160, 160)), - ), - const SizedBox(width: 4.0), - const Icon( - Icons.directions_car, - size: 20, - color: Color.fromARGB(255, 160, 160, 160), - ), - Text( - widget.tour.type == "driving" - ? "Driving Tour" - : "Walking Tour", - style: Theme.of(context).textTheme.labelMedium!.copyWith( - color: const Color.fromARGB(255, 160, 160, 160)), - ), - const SizedBox(width: 4.0), - const Icon( - Icons.route, - size: 20, - color: Color.fromARGB(255, 160, 160, 160), - ), - Text( - "${widget.tour.route.length} Stops", - style: Theme.of(context).textTheme.labelMedium!.copyWith( - color: const Color.fromARGB(255, 160, 160, 160)), - ), - ], + Padding( + padding: const EdgeInsets.only( + left: 16.0, + right: 16.0, + bottom: 16.0, + ), + child: Wrap( + spacing: 4.0, + runSpacing: 8.0, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + const Icon( + Icons.download, + size: 20, + color: Color.fromARGB(255, 160, 160, 160), + ), + Text( + "Download", + style: Theme.of(context).textTheme.labelMedium!.copyWith( + color: const Color.fromARGB(255, 160, 160, 160)), + ), + const SizedBox(width: 4.0), + Icon( + widget.tour.type == "driving" + ? Icons.directions_car + : Icons.directions_walk, + size: 20, + color: const Color.fromARGB(255, 160, 160, 160), + ), + Text( + widget.tour.type == "driving" + ? "Driving Tour" + : "Walking Tour", + style: Theme.of(context).textTheme.labelMedium!.copyWith( + color: const Color.fromARGB(255, 160, 160, 160)), + ), + const SizedBox(width: 4.0), + const Icon( + Icons.route, + size: 20, + color: Color.fromARGB(255, 160, 160, 160), + ), + Text( + "${widget.tour.route.length} Stops", + style: Theme.of(context).textTheme.labelMedium!.copyWith( + color: const Color.fromARGB(255, 160, 160, 160)), + ), + ], + ), ), - ), - ], - ), - )); + ], + ), + )), + ); } }