google_markers #14

Merged
maze6343 merged 14 commits from google_markers into master 2022-05-18 13:49:01 +02:00
11 changed files with 160 additions and 8 deletions
Showing only changes of commit 8044ca4ca5 - Show all commits

View File

@ -145,6 +145,18 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "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", "name": "geolocator",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1", "rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1",
@ -283,6 +295,24 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "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", "name": "matcher",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11", "rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11",
@ -524,7 +554,7 @@
"languageVersion": "2.16" "languageVersion": "2.16"
} }
], ],
"generated": "2022-05-11T08:59:18.372523Z", "generated": "2022-05-17T09:01:00.812429Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.16.2" "generatorVersion": "2.16.2"
} }

View File

@ -86,6 +86,14 @@ font_awesome_flutter
2.12 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/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/lib/ 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 geolocator
2.12 2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1/ file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-8.2.1/
@ -178,6 +186,18 @@ lints
2.12 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/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/lints-1.0.1/lib/ 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 matcher
2.12 2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11/ file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11/

View File

@ -1,6 +1,7 @@
# This is a generated file; do not edit or check into version control. # 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_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/ 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=/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_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/ 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_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_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/ 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=/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_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/ 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

View File

@ -3,7 +3,7 @@
# #
# For more info see: https://dart.dev/go/dot-packages-deprecation # 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/ 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/ 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/ 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_test:file:///Users/marahzeibak/flutter/packages/flutter_test/lib/
flutter_web_plugins:file:///Users/marahzeibak/flutter/packages/flutter_web_plugins/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/ 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: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_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/ 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/ 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/ 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/ 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/ 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/ 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/ meta:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/

View File

@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_applicationdemo"> package="com.example.flutter_applicationdemo">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application <application
android:label="flutter_applicationdemo" android:label="flutter_applicationdemo"
android:name="${applicationName}" android:name="${applicationName}"

View File

@ -43,5 +43,9 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Please allow location access.</string>
<key>NSLocationAlwaysUsageDescription</key>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
</dict> </dict>
</plist> </plist>

View File

@ -4,9 +4,12 @@ import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_google_places/flutter_google_places.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:google_api_headers/google_api_headers.dart';
import 'package:http/http.dart' as http; 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(); final Completer<GoogleMapController> _controller = Completer();
LocationData? _currentPosition;
final TextEditingController _searchController = TextEditingController(); final TextEditingController _searchController = TextEditingController();
static const CameraPosition _kGooglePlex = CameraPosition( static const CameraPosition _kGooglePlex = CameraPosition(
@ -93,17 +98,19 @@ class MapState extends State<Map> {
@override @override
void initState() { void initState() {
intilize(); intilize();
_getUserLocation();
super.initState(); super.initState();
} }
intilize() { intilize() {
Marker marker_1; Marker marker_1;
//for(var marker in markers) { //for(var marker in markers) {
marker_1 = const Marker( marker_1 = Marker(
markerId: MarkerId('id_1'), markerId: MarkerId('id_1'),
position: LatLng(59.320671571444514, 18.055854162299937), position: LatLng(59.320671571444514, 18.055854162299937),
infoWindow: InfoWindow( infoWindow: InfoWindow(
title: 'Münchenbryggeriet Beer Garden', title: 'Münchenbryggeriet Beer Garden',
onTap: () => setState(() {}),
snippet: 'Uteservering', 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; late GoogleMapController googleMapController;
final Mode _mode = Mode.fullscreen; final Mode _mode = Mode.fullscreen;
@ -261,14 +302,23 @@ class MapState extends State<Map> {
_controller.complete(controller); _controller.complete(controller);
}, },
), ),
ElevatedButton(onPressed: _handelPressButton ElevatedButton(onPressed: () {} //_handelPressButton
,child: const Text("Search Placses")) ,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( Prediction? p = await PlacesAutocomplete.show(
context: context, context: context,
@ -305,7 +355,7 @@ class MapState extends State<Map> {
setState(() {}); setState(() {});
googleMapController.animateCamera(CameraUpdate.newLatLngZoom(LatLng(lat,lng), 14.0)); googleMapController.animateCamera(CameraUpdate.newLatLngZoom(LatLng(lat,lng), 14.0));
} }*/
} }
class _Marker { class _Marker {

View File

@ -8,6 +8,7 @@
import 'package:flutter_native_splash/flutter_native_splash_web.dart'; import 'package:flutter_native_splash/flutter_native_splash_web.dart';
import 'package:geolocator_web/geolocator_web.dart'; import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_sign_in_web/google_sign_in_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:package_info_plus_web/package_info_plus_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart';
@ -17,6 +18,7 @@ void registerPlugins(Registrar registrar) {
FlutterNativeSplashWeb.registerWith(registrar); FlutterNativeSplashWeb.registerWith(registrar);
GeolocatorPlugin.registerWith(registrar); GeolocatorPlugin.registerWith(registrar);
GoogleSignInPlugin.registerWith(registrar); GoogleSignInPlugin.registerWith(registrar);
LocationWebPlugin.registerWith(registrar);
PackageInfoPlugin.registerWith(registrar); PackageInfoPlugin.registerWith(registrar);
registrar.registerMessageHandler(); registrar.registerMessageHandler();
} }

View File

@ -163,6 +163,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "9.2.0" 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: geolocator:
dependency: "direct main" dependency: "direct main"
description: description:
@ -324,6 +338,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" 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: matcher:
dependency: transitive dependency: transitive
description: description:

View File

@ -40,6 +40,8 @@ dependencies:
google_maps_flutter: ^2.1.3 google_maps_flutter: ^2.1.3
flutter_google_places: ^0.3.0 flutter_google_places: ^0.3.0
geolocator: ^8.0.1 geolocator: ^8.0.1
geocoding: ^2.0.4
location: ^4.3.0
flutter_native_splash: ^2.1.6 flutter_native_splash: ^2.1.6
settings_ui: ^2.0.2 settings_ui: ^2.0.2
google_fonts: ^2.3.2 google_fonts: ^2.3.2