package update 0.0.8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
library map_camera_flutter;
|
||||
library;
|
||||
|
||||
export 'package:flutter/material.dart';
|
||||
export 'dart:async';
|
||||
@@ -13,5 +13,6 @@ export 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
export 'package:geocoding/geocoding.dart';
|
||||
export 'package:path_provider/path_provider.dart';
|
||||
export 'package:map_camera_flutter/src/image_and_location_data.dart';
|
||||
export 'src/components/location_details_widget.dart';
|
||||
|
||||
export 'src/map_camera.dart';
|
||||
|
||||
79
lib/src/components/location_details_widget.dart
Normal file
79
lib/src/components/location_details_widget.dart
Normal file
@@ -0,0 +1,79 @@
|
||||
import 'package:map_camera_flutter/map_camera_flutter.dart';
|
||||
|
||||
class LocationDetailsWidget extends StatelessWidget {
|
||||
const LocationDetailsWidget({
|
||||
super.key,
|
||||
required this.locationData,
|
||||
required this.dateTime,
|
||||
});
|
||||
|
||||
final LocationData? locationData;
|
||||
final String? dateTime;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.black.withOpacity(0.5)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
locationData?.locationName ?? "Loading...",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
locationData?.subLocation ?? "Loading ..",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"Lat ${locationData?.latitude ?? "Loading.."}",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"Long ${locationData?.longitude ?? "Loading.."}",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
dateTime ?? "Loading...",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -210,9 +210,8 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
||||
initialCenter:
|
||||
const lat.LatLng(0, 0),
|
||||
initialZoom: 13.0,
|
||||
onPositionChanged:
|
||||
(MapPosition position,
|
||||
bool hasGesture) {
|
||||
onPositionChanged: (position,
|
||||
bool hasGesture) {
|
||||
if (hasGesture) {
|
||||
setState(
|
||||
() =>
|
||||
@@ -245,82 +244,9 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.black.withOpacity(0.5)),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
locationData?.locationName ??
|
||||
"Loading...",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
locationData?.subLocation ??
|
||||
"Loading ..",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"Lat ${locationData?.latitude ?? "Loading.."}",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"Long ${locationData?.longitude ?? "Loading.."}",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
dateTime ?? "Loading...",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: LocationDetailsWidget(
|
||||
locationData: locationData,
|
||||
dateTime: dateTime),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
@@ -489,8 +415,6 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
||||
}
|
||||
|
||||
// Get the current position
|
||||
return await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.best,
|
||||
);
|
||||
return await Geolocator.getCurrentPosition();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user