flutter google_maps can't zoom out any further - flutter

As the picture below, I've been searching everywhere about this issue but still cant find any solution.
About my code, i use the very default sample from google_maps_flutter, but it still doesnt let me zoom out any further from my default latitude/longitude.
(It is not about my internet connection, it remains the same)
GoogleMap(
initialCameraPosition: _kGooglePlex,
// circles: _circles,
markers: {
Marker(
markerId: MarkerId("123"),
icon: BitmapDescriptor.defaultMarker,
infoWindow: InfoWindow(title: "Carin"),
position: LatLng(-6.915601, 107.591446),
)
},
onMapCreated: (GoogleMapController controller) {
_controller = controller;
//_controller!.setMapStyle(MapStyle().dark);
},
)
I've been trying to clean, clean cache, restart the emulator, but the problem still there. And the main problem is, the map container shows blank/black screen on real device.
When i opened the page which contains google maps, the console gives me exceeded sample count in FrameTime everytime i interact with the map, such as move or zoom in/out.
I really appreciate of any of your comments that trying to help, cuz i dont usually ask question if im not feeling totally stucked from everywhere, thank you so much.

Related

How to implement fly-to current location of mapbox in flutter

I have a floating action button on the map. When I click on this button, irrespective of my exploring on the map it should fly-to my current location.
I am able to show my current location on the map, and I have created a floating action button on the map to track back to my current location. I have stored the current location on my shared prefs. Now, I am looking for a Mapbox Fly-To feature to move back my current location.
Here is my pubspec.yaml file
Here is my code:
This is my Mapbox Map Screen.
I was also facing the same issue but fixed with the help of Geolocator flutter package which give you the current location details. Based on this details you can animate the map view to the position you have passed.
Please find the example below
onPressed: () async {
var position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
mapController.animateCamera(
CameraUpdate.newLatLng(
LatLng(
position.latitude,
position.longitude,
),
),
);
},

Show directions using google map flutter package?

I have an already saved map route as an encoded string in the database. I need to show
already saved route and the direction to the user in the google map using google_maps_flutter package. Even in the google map is okey. There are options to draw the markers and poly lines using the package, but no option to enable direction(like go 300m and then turn left).
here is the code sample I tried, without direction
GoogleMap(
initialCameraPosition: _initialPosition,
myLocationEnabled: true,
trafficEnabled: true,
markers: _markers,
polylines: _polyline,
cameraTargetBounds: _cameraTargetBounds,
)
using google map app we can do that(I'm using map_launcher package to do that like below), but only parsing origin and destination and it's the direction at that time, not the already planned and saved route.
mapLauncher.MapLauncher.showDirections(
mapType: mapLauncher.MapType.google,
origin: mapLauncher.Coords(origin!.latitude, origin.longitude),
originTitle: 'Your Locations',
destinationTitle: 'Destination Location',
destination: mapLauncher.Coords(destination!.latitude, destination.longitude))
does anyone knows a way to achieve this? is it not possible?
There is no FREE way to show directions using Google maps flutter package. You either use another map package or open google maps app (if you're not looking for a FREE way ignore and go all the way down).
FREE WAY
If you would like to open Google Maps app from your app you could do something like this.
First set up your url String (what you will send to Google maps app so it knows what directions give):
String url = 'https://www.google.com/maps/dir/?api=1&origin=' +
currentLocation.latitude.toString() +
',' +
currentLocation.longitude.toString() +
' &destination=' +
lat.toString() +
',' +
lon.toString() +
'&travelmode=driving&dir_action=navigate';
_launchURL(url);
Where currentLocation means the user current location, and lat and lon means the destination.
Then just launch that url, using an urlLauncher:
void _launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
PAID WAY
If you are super decided to get directions into your app, you can use Directions API.

How do I display the flushbar notification of my app even if it is closed

I am using flushbar to display some important in-app notifications of my App to the user.
I want to be able to display the flushbar that is independent of the app open or closed.Because the flushbar notification is drawn over the current BuildContext only, as soon as the user closes the App , the flushbar notification disappears as well (because the notification widget is part of that screen's widget subtree).
Is there a way to display the flushbar notification on top of the other apps,in spite of my App being closed??
This is the Flushbar code I want to display.
In other words is there any kind of stuff where in which we can run a function or a piece of dart code irrespective of the app being closed or open?
I have been breaking my head for this for the past 5 days and I am not getting it
Flushbar(
title: "Hey",
message: "This is the important message XYZ for you.",
duration: Duration(seconds: 5),
isDismissible: true,
icon: Icon(
Icons.warning,
color: Colors.red,
),
dismissDirection: FlushbarDismissDirection
.HORIZONTAL,
mainButton: FlatButton(
onPressed: () {
flush.dismiss(true);
},
child: Text(
"CANCEL",
style: TextStyle(color: Colors.amber),
),
),
)
you can use this plugin system_alert_window
A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events.
Using that, Build your notification which will act like a floating window on top of all apps and more importantly, it runs in the background.

How do I fix values display error on Flutter Cupertino TimerPicker widget?

I'm implementing a simple Cupertino TimerPicker widget on a Flutter app and, for some reason, the values displayed on the picker for the minutes get trimmed once they go above 20:
https://www.dropbox.com/s/jqu45skpjob4it0/Screenshot%202019-11-01%2013.51.29.png
Originally I had the widget inside a showModalBottomSheet widget with some customization, but the problem persists even after trying to display the simplest implementation of the timer picker within a column widget.
When I spin the picker, I can get the correct values. For example, if I select 22 minutes, onTimerDurationChanged passes a Duration value of 22 minutes, even if the picker displays only "2" in the UI (as seen in the screenshot). So it looks like the problem is in how the widget displays the values.
Here's the code for the Timer Picker child in its containing Column widget:
Expanded(
child: Container(
height: 200,
child: CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
initialTimerDuration: Duration(minutes: 20),
onTimerDurationChanged: (Duration value) {},
),
),
),
Further details:
1) The bug is present only when setting
mode: CupertinoTimerPickerMode.hm
The issue goes away if mode is set to .ms or to .hms. Unfortunately, I need to use the .hm mode.
2) The issue appears when running the app on iOS (both in the simulator and on a physical device). Ironically, it works just fine on Android.
--
I'm not getting any kind of error in the console or within the Android Studio editor. I'm not sure where else to look for troubleshooting.

Deactivate FlatButton default Sound and animation

Developping an app with Flutter and I can't deactivate the default sound (and animation) of the FlatButton.
I can't find any doc about that sound in the official doc
https://api.flutter.dev/flutter/material/FlatButton-class.html.
I tried a MaterialButton and a RawMaterialButton but it has the same sound and animation...
Any help appreciated
I am on the same thing and found as a solution using the InkWell Widget instead like this:
child: InkWell(
enableFeedback: false, //if true, sound and vibration are enable
child: Text('Testing'),
onTap: () {
//your code
},
It worked for me.
The MatierialButton has no default animation or sound. Something else is causing it. Try it out on a fresh emulator to see.