google_markers #14
@ -145,6 +145,18 @@
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "geocoding",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "geocoding_platform_interface",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding_platform_interface-2.0.1",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "geolocator",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1",
|
||||
@ -283,6 +295,24 @@
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.4.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "location_platform_interface",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_platform_interface-2.3.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "location_web",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_web-3.1.1",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "matcher",
|
||||
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11",
|
||||
@ -524,7 +554,7 @@
|
||||
"languageVersion": "2.16"
|
||||
}
|
||||
],
|
||||
"generated": "2022-05-11T08:59:18.372523Z",
|
||||
"generated": "2022-05-17T09:01:00.812429Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "2.16.2"
|
||||
}
|
||||
|
@ -86,6 +86,14 @@ font_awesome_flutter
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/lib/
|
||||
geocoding
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/lib/
|
||||
geocoding_platform_interface
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding_platform_interface-2.0.1/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding_platform_interface-2.0.1/lib/
|
||||
geolocator
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1/
|
||||
@ -178,6 +186,18 @@ lints
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/lints-1.0.1/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/lints-1.0.1/lib/
|
||||
location
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/lib/
|
||||
location_platform_interface
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_platform_interface-2.3.0/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_platform_interface-2.3.0/lib/
|
||||
location_web
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_web-3.1.1/
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_web-3.1.1/lib/
|
||||
matcher
|
||||
2.12
|
||||
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11/
|
||||
|
@ -1,6 +1,7 @@
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
flutter_native_splash=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-2.1.6/
|
||||
flutter_plugin_android_lifecycle=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.6/
|
||||
geocoding=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/
|
||||
geolocator=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1/
|
||||
geolocator_android=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-3.1.8/
|
||||
geolocator_apple=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_apple-2.1.3/
|
||||
@ -12,6 +13,8 @@ google_sign_in=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/goo
|
||||
google_sign_in_android=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_android-5.2.7/
|
||||
google_sign_in_ios=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_ios-5.2.7/
|
||||
google_sign_in_web=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.10.1+1/
|
||||
location=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/
|
||||
location_web=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_web-3.1.1/
|
||||
package_info_plus=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/
|
||||
package_info_plus_linux=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/
|
||||
package_info_plus_macos=/Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
#
|
||||
# For more info see: https://dart.dev/go/dot-packages-deprecation
|
||||
#
|
||||
# Generated by pub on 2022-05-11 10:59:18.356800.
|
||||
# Generated by pub on 2022-05-17 11:01:00.783208.
|
||||
archive:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.3.0/lib/
|
||||
args:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.3.0/lib/
|
||||
async:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
|
||||
@ -28,6 +28,8 @@ flutter_signin_button:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.da
|
||||
flutter_test:file:///Users/marahzeibak/flutter/packages/flutter_test/lib/
|
||||
flutter_web_plugins:file:///Users/marahzeibak/flutter/packages/flutter_web_plugins/lib/
|
||||
font_awesome_flutter:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/lib/
|
||||
geocoding:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/lib/
|
||||
geocoding_platform_interface:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geocoding_platform_interface-2.0.1/lib/
|
||||
geolocator:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1/lib/
|
||||
geolocator_android:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-3.1.8/lib/
|
||||
geolocator_apple:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_apple-2.1.3/lib/
|
||||
@ -51,6 +53,9 @@ js:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3
|
||||
json_annotation:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/json_annotation-4.5.0/lib/
|
||||
lint:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/lint-1.8.2/lib/
|
||||
lints:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/lints-1.0.1/lib/
|
||||
location:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/lib/
|
||||
location_platform_interface:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_platform_interface-2.3.0/lib/
|
||||
location_web:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/location_web-3.1.1/lib/
|
||||
matcher:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11/lib/
|
||||
material_color_utilities:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/material_color_utilities-0.1.3/lib/
|
||||
meta:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/
|
||||
|
@ -1,5 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.flutter_applicationdemo">
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<application
|
||||
android:label="flutter_applicationdemo"
|
||||
android:name="${applicationName}"
|
||||
|
@ -43,5 +43,9 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Please allow location access.</string>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
</dict>
|
||||
</plist>
|
||||
|
60
lib/Map.dart
60
lib/Map.dart
@ -4,9 +4,12 @@ import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:flutter_google_places/flutter_google_places.dart';
|
||||
import 'package:google_maps_webservice/places.dart';
|
||||
//import 'package:google_maps_webservice/places.dart';
|
||||
import 'package:google_api_headers/google_api_headers.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:location/location.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -81,6 +84,8 @@ class MapState extends State<Map> {
|
||||
|
||||
final Completer<GoogleMapController> _controller = Completer();
|
||||
|
||||
LocationData? _currentPosition;
|
||||
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
|
||||
static const CameraPosition _kGooglePlex = CameraPosition(
|
||||
@ -93,17 +98,19 @@ class MapState extends State<Map> {
|
||||
@override
|
||||
void initState() {
|
||||
intilize();
|
||||
_getUserLocation();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
intilize() {
|
||||
Marker marker_1;
|
||||
//for(var marker in markers) {
|
||||
marker_1 = const Marker(
|
||||
marker_1 = Marker(
|
||||
markerId: MarkerId('id_1'),
|
||||
position: LatLng(59.320671571444514, 18.055854162299937),
|
||||
infoWindow: InfoWindow(
|
||||
title: 'Münchenbryggeriet Beer Garden',
|
||||
onTap: () => setState(() {}),
|
||||
snippet: 'Uteservering',
|
||||
)
|
||||
);
|
||||
@ -223,6 +230,40 @@ class MapState extends State<Map> {
|
||||
}
|
||||
|
||||
|
||||
Future<LocationData> _getLocationPermission() async {
|
||||
Location location = Location();
|
||||
|
||||
bool _serviceEnabled;
|
||||
PermissionStatus _permissionGranted;
|
||||
LocationData _locationData;
|
||||
|
||||
_serviceEnabled = await location.serviceEnabled();
|
||||
if (!_serviceEnabled) {
|
||||
_serviceEnabled = await location.requestService();
|
||||
if (!_serviceEnabled) {
|
||||
return Future.error('Service not enable');
|
||||
}
|
||||
}
|
||||
|
||||
_permissionGranted = await location.hasPermission();
|
||||
if (_permissionGranted == PermissionStatus.denied) {
|
||||
_permissionGranted = await location.requestPermission();
|
||||
if (_permissionGranted != PermissionStatus.granted) {
|
||||
return Future.error('Permission Denied');
|
||||
}
|
||||
}
|
||||
|
||||
_locationData = await location.getLocation();
|
||||
|
||||
return _locationData;
|
||||
}
|
||||
|
||||
_getUserLocation() async {
|
||||
_currentPosition = await _getLocationPermission();
|
||||
_goToCurrentPosition(
|
||||
LatLng(_currentPosition!.latitude!, _currentPosition!.longitude!));
|
||||
}
|
||||
|
||||
late GoogleMapController googleMapController;
|
||||
|
||||
final Mode _mode = Mode.fullscreen;
|
||||
@ -261,14 +302,23 @@ class MapState extends State<Map> {
|
||||
_controller.complete(controller);
|
||||
},
|
||||
),
|
||||
ElevatedButton(onPressed: _handelPressButton
|
||||
ElevatedButton(onPressed: () {} //_handelPressButton
|
||||
,child: const Text("Search Placses"))
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _handelPressButton() async {
|
||||
Future<void> _goToCurrentPosition(LatLng latlng) async {
|
||||
final GoogleMapController controller = await _controller.future;
|
||||
controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
|
||||
bearing: 192.8334901395799,
|
||||
target: LatLng(latlng.latitude, latlng.longitude),
|
||||
//tilt: 59.440717697143555,
|
||||
zoom: 14.4746)));
|
||||
}
|
||||
|
||||
/* Future<void> _handelPressButton() async {
|
||||
|
||||
Prediction? p = await PlacesAutocomplete.show(
|
||||
context: context,
|
||||
@ -305,7 +355,7 @@ class MapState extends State<Map> {
|
||||
setState(() {});
|
||||
|
||||
googleMapController.animateCamera(CameraUpdate.newLatLngZoom(LatLng(lat,lng), 14.0));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
class _Marker {
|
||||
|
@ -8,6 +8,7 @@
|
||||
import 'package:flutter_native_splash/flutter_native_splash_web.dart';
|
||||
import 'package:geolocator_web/geolocator_web.dart';
|
||||
import 'package:google_sign_in_web/google_sign_in_web.dart';
|
||||
import 'package:location_web/location_web.dart';
|
||||
import 'package:package_info_plus_web/package_info_plus_web.dart';
|
||||
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
@ -17,6 +18,7 @@ void registerPlugins(Registrar registrar) {
|
||||
FlutterNativeSplashWeb.registerWith(registrar);
|
||||
GeolocatorPlugin.registerWith(registrar);
|
||||
GoogleSignInPlugin.registerWith(registrar);
|
||||
LocationWebPlugin.registerWith(registrar);
|
||||
PackageInfoPlugin.registerWith(registrar);
|
||||
registrar.registerMessageHandler();
|
||||
}
|
||||
|
35
pubspec.lock
35
pubspec.lock
@ -163,6 +163,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "9.2.0"
|
||||
geocoding:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: geocoding
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
geocoding_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geocoding_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
geolocator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -324,6 +338,27 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
location:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: location
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.4.0"
|
||||
location_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: location_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
location_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: location_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -40,6 +40,8 @@ dependencies:
|
||||
google_maps_flutter: ^2.1.3
|
||||
flutter_google_places: ^0.3.0
|
||||
geolocator: ^8.0.1
|
||||
geocoding: ^2.0.4
|
||||
location: ^4.3.0
|
||||
flutter_native_splash: ^2.1.6
|
||||
settings_ui: ^2.0.2
|
||||
google_fonts: ^2.3.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user