diff --git a/roadtrips/android/app/src/main/AndroidManifest.xml b/roadtrips/android/app/src/main/AndroidManifest.xml
index 02293c8..12e1485 100644
--- a/roadtrips/android/app/src/main/AndroidManifest.xml
+++ b/roadtrips/android/app/src/main/AndroidManifest.xml
@@ -30,4 +30,15 @@
android:name="flutterEmbedding"
android:value="2" />
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roadtrips/lib/main.dart b/roadtrips/lib/main.dart
index 1320fcb..1d76a52 100644
--- a/roadtrips/lib/main.dart
+++ b/roadtrips/lib/main.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
+import 'package:roadtrips/screens/destination_details.dart';
import 'package:roadtrips/screens/home.dart';
import 'package:roadtrips/screens/search.dart';
import 'package:roadtrips/screens/suggestions.dart';
@@ -23,6 +24,7 @@ class MyApp extends StatelessWidget {
HomeScreen.route,
SearchScreen.route,
SuggestionsScreen.route,
+ DestinationDetailsScreen.route,
];
@override
diff --git a/roadtrips/lib/screens/destination_details.dart b/roadtrips/lib/screens/destination_details.dart
new file mode 100644
index 0000000..ce9f82a
--- /dev/null
+++ b/roadtrips/lib/screens/destination_details.dart
@@ -0,0 +1,132 @@
+import 'package:flutter/material.dart';
+import 'package:roadtrips/screens/suggestions.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+class DestinationDetailsScreen extends StatefulWidget {
+ static (String, Widget Function(BuildContext)) route =
+ ('/destination/details', (context) => const DestinationDetailsScreen());
+
+ const DestinationDetailsScreen({super.key});
+
+ @override
+ State createState() => _DestinationDetailsState();
+}
+
+class _DestinationDetailsState extends State {
+ bool showBottomSheet = false;
+
+ @override
+ Widget build(BuildContext context) {
+ final destination =
+ ModalRoute.of(context)!.settings.arguments as Destination;
+
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('Destination Details'),
+ actions: [
+ IconButton(
+ icon: const Icon(Icons.more_vert),
+ onPressed: () {
+ showModalBottomSheet(
+ context: context,
+ builder: (context) {
+ return Container(
+ height: 80,
+ decoration: BoxDecoration(
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(25),
+ topRight: Radius.circular(25),
+ ),
+ gradient: LinearGradient(
+ colors: [Colors.grey[300]!, Colors.grey[200]!],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ stops: const [.35, 0],
+ ),
+ ),
+ child: Column(
+ children: [
+ Container(
+ margin: const EdgeInsets.only(top: 12.5),
+ height: 3,
+ width: 30,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(5)),
+ ),
+ GestureDetector(
+ onTap: () {
+ var uri = Uri.parse(destination.wazeDeepLink);
+ launchUrl(uri,
+ mode:
+ LaunchMode.externalNonBrowserApplication);
+ },
+ child: Container(
+ margin: const EdgeInsets.only(top: 9.5),
+ child: Container(
+ margin: const EdgeInsets.only(
+ top: 17.5, left: 17.5),
+ alignment: Alignment.centerLeft,
+ child: const Text(
+ 'Open in Waze',
+ textScaleFactor: 1.15,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ });
+ },
+ ),
+ ],
+ ),
+ body: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Text(
+ destination.name,
+ style: const TextStyle(
+ fontSize: 24,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Column(
+ children: [
+ Text(
+ 'Latitude',
+ style: TextStyle(
+ color: Colors.grey[700]!,
+ ),
+ ),
+ Text(
+ destination.latitude.toString(),
+ style: const TextStyle(fontWeight: FontWeight.w500),
+ ),
+ ],
+ ),
+ Column(
+ children: [
+ Text(
+ 'Longitude',
+ style: TextStyle(
+ color: Colors.grey[700]!,
+ ),
+ ),
+ Text(
+ destination.longitude.toString(),
+ style: const TextStyle(fontWeight: FontWeight.w500),
+ ),
+ ],
+ )
+ ],
+ )
+ ],
+ ),
+ );
+ }
+}
diff --git a/roadtrips/lib/screens/suggestions.dart b/roadtrips/lib/screens/suggestions.dart
index 58e97cd..b2bf947 100644
--- a/roadtrips/lib/screens/suggestions.dart
+++ b/roadtrips/lib/screens/suggestions.dart
@@ -8,6 +8,7 @@ const String suggestionsQuery = """
latitude
longitude
name
+ wazeDeeplink
}
}""";
@@ -15,8 +16,10 @@ class Destination {
final double latitude;
final double longitude;
final String name;
+ final String wazeDeepLink;
- const Destination(this.latitude, this.longitude, this.name);
+ const Destination(
+ this.latitude, this.longitude, this.name, this.wazeDeepLink);
}
class SuggestionsScreen extends StatelessWidget {
@@ -68,8 +71,18 @@ class SuggestionsScreen extends StatelessWidget {
return ListView(
children: destinations
+ .map((destination) => Destination(
+ destination['latitude'],
+ destination['longitude'],
+ destination['name'],
+ destination['wazeDeeplink'],
+ ))
.map((destination) => ListTile(
- title: Text(destination['name']),
+ title: Text(destination.name),
+ onTap: () {
+ Navigator.pushNamed(context, '/destination/details',
+ arguments: destination);
+ },
))
.toList(),
);
diff --git a/roadtrips/pubspec.lock b/roadtrips/pubspec.lock
index c2a5bb7..99462e3 100644
--- a/roadtrips/pubspec.lock
+++ b/roadtrips/pubspec.lock
@@ -453,6 +453,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
+ url_launcher:
+ dependency: "direct main"
+ description:
+ name: url_launcher
+ sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.1.11"
+ url_launcher_android:
+ dependency: transitive
+ description:
+ name: url_launcher_android
+ sha256: "15f5acbf0dce90146a0f5a2c4a002b1814a6303c4c5c075aa2623b2d16156f03"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.0.36"
+ url_launcher_ios:
+ dependency: transitive
+ description:
+ name: url_launcher_ios
+ sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.1.4"
+ url_launcher_linux:
+ dependency: transitive
+ description:
+ name: url_launcher_linux
+ sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.5"
+ url_launcher_macos:
+ dependency: transitive
+ description:
+ name: url_launcher_macos
+ sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.5"
+ url_launcher_platform_interface:
+ dependency: transitive
+ description:
+ name: url_launcher_platform_interface
+ sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.3"
+ url_launcher_web:
+ dependency: transitive
+ description:
+ name: url_launcher_web
+ sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.17"
+ url_launcher_windows:
+ dependency: transitive
+ description:
+ name: url_launcher_windows
+ sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.6"
uuid:
dependency: transitive
description:
diff --git a/roadtrips/pubspec.yaml b/roadtrips/pubspec.yaml
index 5da219d..c6b5063 100644
--- a/roadtrips/pubspec.yaml
+++ b/roadtrips/pubspec.yaml
@@ -36,6 +36,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
graphql_flutter: ^5.1.2
+ url_launcher: ^6.1.11
dev_dependencies:
flutter_test: