Skip to content

Commit

Permalink
Slight fixes to home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
invpt committed Apr 14, 2024
1 parent c9a204a commit 329f40e
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 139 deletions.
2 changes: 1 addition & 1 deletion app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Future<void> 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,
),
Expand Down
281 changes: 143 additions & 138 deletions lib/src/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>(
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<bool>(
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)),
),
],
),
),
),
],
),
));
],
),
)),
);
}
}

0 comments on commit 329f40e

Please sign in to comment.