Open kareldebedts opened 4 years ago
Reproduces with current google_maps_flutter 0.5.28+1.
@VladyslavBondarenko Just updated to that version and tested it on iOS 13. Looks the same. Do you have any recommendations to make it less noticeable?
Issue reproduced on the latest google_maps_flutter: ^2.0.3
Android | iOS |
---|---|
Is anyone maintaining the issue seams to me that there is no progress on it since one year and the issue is still existing.
Indeed I still have the same issue. Anyone has found a workaround?
More than year passed from issue was initiated. Is there any news on this subject?
I use the following code as a work around to give the map time to load and provide a smooth transition using animatedOpacity to display it when loaded. Hope this can help you.
// Declare variables
GoogleMapController? _googleMapController;
final Future<bool> _mapFuture = Future.delayed(const Duration(milliseconds: 1000), () => true);
bool isMapVisible = false;
// Build map using FutureBuilder
FutureBuilder
(
future: _mapFuture,
builder: (context, AsyncSnapshot<bool> snapshot)
{
if(!snapshot.hasData)
{
return const Center
(
child: CircularProgressIndicator()
);
}
return AnimatedOpacity
(
curve: Curves.fastOutSlowIn,
opacity: isMapVisible ? 1.0 : 0,
duration: const Duration(milliseconds: 600),
child: GoogleMap
(
initialCameraPosition: _initialCameraPosition,
onMapCreated: (controller) async
{
_googleMapController = controller;
Future.delayed
(
const Duration(milliseconds: 550),
() => setState
(()
{
isMapVisible = true;
}
)
);
},
),
);
}
),
@atishdhu Where do you declare isMapVisible bool? When I use this, my map stays blank after CircularProgressIndicator().
Edit: Nvm, figured the issue out.
When setting initial opacity: isMapVisible ? 1.0 : 0, the '0' is causing the issue. Issue mentioned here.
Instead use: opacity: isMapVisible ? 1.0 : 0.01.
Still very relevant as of today.
Flutter 3.10.4 google_maps_flutter: ^2.3.0 google_maps_flutter_web: ^0.5.0+1
Still. Even I use AnimatedOpacity, the first frame of google map still is normal style. If you use dark style, you can obviously see the flicker between white and dark!
How to solve the problem of blank map in dark mode?
I'm using a custom map style for the Google Maps Flutter package. Implemented with this code
Current "problem" (more like an imperfection): the style is set after the map is loaded, so the user first gets a white screen, then the standard Google Maps style and after all that the custom style. This happens very fast, but there is a noticeable "flash". Especially when you're using a dark mode map style.
What I tried:
Solutions I could think of with the current possibilities: loading the google maps widget in the background on another screen, so when the user taps on the screen that has the google map widget, the map is already fully loaded.
I tried an approach to this with the cupertinotabbar and a statefull widget (with the google maps widget inside, that has keepAliveClientMixin enabled) and stack but the map kept reloading. Are there other approaches to this?
A nice feature would be:
Possibility to set a map style before the map is created
Or if the above feature is really difficult / almost impossible to implement:
Possibility to set a background color when the map isn't loaded yet (currently this color is white and has a big contrast with custom map style's that are darker).