Skip to content

Commit 2ca9b7e

Browse files
committed
[google_maps_flutter_web] Wrap map div in CSS reset (flutter/flutter#115216)
Wraps the map `div` in a `div` with `style.all = "initial"` to prevent red text due to a style set on `body` by Flutter.
1 parent 050f8a9 commit 2ca9b7e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ class GoogleMapController {
4343

4444
ui.platformViewRegistry.registerViewFactory(
4545
_getViewType(mapId),
46-
(int viewId) => _div,
46+
(int viewId) => DivElement()
47+
// Wrap the map div in a CSS reset for consistent styling.
48+
// Having this on the map div itself seems to make it fail to render.
49+
..style.setProperty('all', 'initial')
50+
// However, we do still need to set these to keep Flutter from logging a
51+
// complaint.
52+
..style.width = '100%'
53+
..style.height = '100%'
54+
..children = <Element>[_div],
4755
);
4856
}
4957

0 commit comments

Comments
 (0)