Compare commits
8 Commits
06c5ca9910
...
v0.1.29
| Author | SHA1 | Date | |
|---|---|---|---|
| d51f3d4ba7 | |||
| b4016e6e5b | |||
| eae4a853e9 | |||
| 8eb4cadc85 | |||
| 06a76afc42 | |||
| dca8c64555 | |||
| 1aaea5f6d9 | |||
| 3a54a077f3 |
@@ -1,15 +1,9 @@
|
|||||||
// service/maps_launcher_service.dart
|
|
||||||
import 'dart:io' show Platform;
|
import 'dart:io' show Platform;
|
||||||
import 'package:android_intent_plus/android_intent.dart';
|
import 'package:android_intent_plus/android_intent.dart';
|
||||||
|
|
||||||
class MapsLauncherService {
|
class MapsLauncherService {
|
||||||
/// Opens a URL in Google Maps app
|
|
||||||
/// Falls back to browser if Maps app is not installed
|
|
||||||
static Future<bool> openInGoogleMaps(String url) async {
|
static Future<bool> openInGoogleMaps(String url) async {
|
||||||
if (!Platform.isAndroid) {
|
if (!Platform.isAndroid) return false;
|
||||||
// Handle iOS or other platforms if needed
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Try to open in Google Maps app
|
// Try to open in Google Maps app
|
||||||
@@ -28,36 +22,16 @@ class MapsLauncherService {
|
|||||||
await browserIntent.launch();
|
await browserIntent.launch();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Failed to open maps link: $e');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opens navigation to specific coordinates
|
|
||||||
static Future<bool> navigateToCoordinates(
|
|
||||||
String latitude,
|
|
||||||
String longitude,
|
|
||||||
) async {
|
|
||||||
final url = 'google.navigation:q=$latitude,$longitude';
|
|
||||||
return openInGoogleMaps(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens a search query in Google Maps
|
|
||||||
static Future<bool> searchInMaps(String query) async {
|
|
||||||
final encodedQuery = Uri.encodeComponent(query);
|
|
||||||
final url = 'geo:0,0?q=$encodedQuery';
|
|
||||||
return openInGoogleMaps(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shares a Google Maps link or location via Android share sheet
|
|
||||||
static Future<bool> shareLocation({
|
static Future<bool> shareLocation({
|
||||||
required String text,
|
required String text,
|
||||||
String? subject,
|
String? subject,
|
||||||
}) async {
|
}) async {
|
||||||
if (!Platform.isAndroid) {
|
if (!Platform.isAndroid) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final intent = AndroidIntent(
|
final intent = AndroidIntent(
|
||||||
@@ -72,7 +46,6 @@ class MapsLauncherService {
|
|||||||
await intent.launch();
|
await intent.launch();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Failed to share location: $e');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart' show TextButton, Theme;
|
import 'package:flutter/material.dart' show TextButton, Theme;
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
import '../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class EditDialogTitle extends StatelessWidget {
|
class EditDialogTitle extends StatelessWidget {
|
||||||
const EditDialogTitle({
|
const EditDialogTitle({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -15,11 +17,10 @@ class EditDialogTitle extends StatelessWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
// TODO: Localize
|
|
||||||
if (dialogType == DialogType.bookmark)
|
if (dialogType == DialogType.bookmark)
|
||||||
Text('Create Bookmark')
|
Text(AppLocalizations.of(context)!.createBookmark)
|
||||||
else
|
else
|
||||||
Text('Create Collection'),
|
Text(AppLocalizations.of(context)!.createCollection),
|
||||||
|
|
||||||
if (onDeletePressed != null)
|
if (onDeletePressed != null)
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -28,7 +29,7 @@ class EditDialogTitle extends StatelessWidget {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Delete',
|
AppLocalizations.of(context)!.delete,
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user