Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Google Map widget is not displayed inside column #2

Closed
viratshukla opened this issue Aug 1, 2019 · 3 comments
Closed

Google Map widget is not displayed inside column #2

viratshukla opened this issue Aug 1, 2019 · 3 comments

Comments

@viratshukla
Copy link

I am getting following error, when I am trying to display GoogleMap inside a column widget.

Column(
children: [
GoogleMap(
mapType: MapType.normal,
initialCameraPosition: CameraPosition(target: _center, zoom: 15),
),
],
)

I/flutter ( 4678): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 4678): The following assertion was thrown during performResize():
I/flutter ( 4678): FlutterError contained multiple error summaries.
I/flutter ( 4678): All FlutterError objects should have only a single short (one line) summary description of the
I/flutter ( 4678): problem that was detected.
I/flutter ( 4678): Malformed FlutterError:
I/flutter ( 4678): RenderAndroidView object was given an infinite size during layout.
I/flutter ( 4678): This probably means that it is a render object that tries to be as big as possible, but it was put
I/flutter ( 4678): inside another render object that allows its children to pick their own size.
I/flutter ( 4678): RenderAndroidView object was given an infinite size during layout.
I/flutter ( 4678): This probably means that it is a render object that tries to be as big as possible, but it was put
I/flutter ( 4678): inside another render object that allows its children to pick their own size.
I/flutter ( 4678): The nearest ancestor providing an unbounded height constraint is: RenderFlex#7b34e relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
I/flutter ( 4678): creator: Column ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
I/flutter ( 4678): AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#2e935 ink
I/flutter ( 4678): renderer] ← NotificationListener ← PhysicalModel ←
I/flutter ( 4678): AnimatedPhysicalModel ← Material ← ⋯
I/flutter ( 4678): parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
I/flutter ( 4678): constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=592.0)
I/flutter ( 4678): size: MISSING
I/flutter ( 4678): direction: vertical
I/flutter ( 4678): mainAxisAlignment: start
I/flutter ( 4678): mainAxisSize: max
I/flutter ( 4678): crossAxisAlignment: center
I/flutter ( 4678): verticalDirection: down
I/flutter ( 4678): The constraints that applied to the RenderAndroidView were:
I/flutter ( 4678): BoxConstraints(0.0<=w<=360.0, 0.0<=h<=Infinity)
I/flutter ( 4678): The exact size it was given was:
I/flutter ( 4678): Size(360.0, Infinity)
I/flutter ( 4678): See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.
I/flutter ( 4678):
I/flutter ( 4678): The malformed error has 2 summaries.
I/flutter ( 4678): Summary 1: RenderAndroidView object was given an infinite size during layout.
I/flutter ( 4678): Summary 2: RenderAndroidView object was given an infinite size during layout.
I/flutter ( 4678):
I/flutter ( 4678): This error should still help you solve your problem, however please also report this malformed error
I/flutter ( 4678): in the framework by filing a bug on GitHub:
I/flutter ( 4678): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter ( 4678):
I/flutter ( 4678): When the exception was thrown, this was the stack:
I/flutter ( 4678): #0 new FlutterError.fromParts. (package:flutter/src/foundation/assertions.dart:540:9)
I/flutter ( 4678): #1 new FlutterError.fromParts (package:flutter/src/foundation/assertions.dart:543:6)
I/flutter ( 4678): #2 RenderBox.debugAssertDoesMeetConstraints. (package:flutter/src/rendering/box.dart:1966:28)
I/flutter ( 4678): #3 RenderBox.debugAssertDoesMeetConstraints (package:flutter/src/rendering/box.dart:2029:6)
I/flutter ( 4678): #4 RenderBox.size=. (package:flutter/src/rendering/box.dart:1740:7)
I/flutter ( 4678): #5 RenderBox.size= (package:flutter/src/rendering/box.dart:1742:6)
I/flutter ( 4678): #6 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:169:5)
I/flutter ( 4678): #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1604:9)
I/flutter ( 4678): #8 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:743:15)
I/flutter ( 4678): #9 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #10 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:142:11)
I/flutter ( 4678): #11 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:443:7)
I/flutter ( 4678): #12 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:212:7)
I/flutter ( 4678): #13 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:356:14)
I/flutter ( 4678): #14 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #15 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #18 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1214:11)
I/flutter ( 4678): #19 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #20 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:206:11)
I/flutter ( 4678): #21 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #23 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #24 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #25 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #26 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #27 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #28 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #30 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #36 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #37 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3076:13)
I/flutter ( 4678): #38 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #39 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
I/flutter ( 4678): #40 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #41 __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #42 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #43 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #44 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #45 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #47 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #48 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #49 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4678): #50 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
I/flutter ( 4678): #51 RenderView.performLayout (package:flutter/src/rendering/view.dart:151:13)
I/flutter ( 4678): #52 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1496:7)
I/flutter ( 4678): #53 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
I/flutter ( 4678): #54 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:346:19)
I/flutter ( 4678): #55 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
I/flutter ( 4678): #56 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
I/flutter ( 4678): #57 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
I/flutter ( 4678): #58 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
I/flutter ( 4678): #59 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:784:7)
I/flutter ( 4678): #61 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
I/flutter ( 4678): #62 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
I/flutter ( 4678): #63 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
I/flutter ( 4678): (elided one frame from package dart:async-patch)
I/flutter ( 4678):
I/flutter ( 4678): The following RenderObject was being processed when the exception was fired: RenderAndroidView#bde04 NEEDS-LAYOUT NEEDS-PAINT:
I/flutter ( 4678): needs compositing
I/flutter ( 4678): creator: _AndroidPlatformView ← _FocusMarker ← Focus ← AndroidView ← GoogleMap ← Column ← MediaQuery
I/flutter ( 4678): ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ←
I/flutter ( 4678): AnimatedDefaultTextStyle ← ⋯
I/flutter ( 4678): parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
I/flutter ( 4678): constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=Infinity)
I/flutter ( 4678): semantic boundary
I/flutter ( 4678): size: Size(360.0, Infinity)
I/flutter ( 4678): This RenderObject has no descendants.
I/flutter ( 4678): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 4678): Another exception was thrown: FlutterError contained multiple error summaries.
I/flutter ( 4678): Another exception was thrown: A RenderFlex overflowed by Infinity pixels on the bottom.
Reloaded 8 of 901 libraries in 1,394ms.

@viratshukla
Copy link
Author

I fixed it like this -

Column(
children: [
SizedBox(
width: MediaQuery.of(context).size.width, // or use fixed size like 200
height: MediaQuery.of(context).size.height,
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: CameraPosition(target: _center, zoom: 15),
))
])

But now new issues is there by placing google map in a column -
If placed in column, only zoom in map is working, that is also on double tap. No zooming out, no sliding in map to other location. Its like a static image of map.

@5hanth
Copy link

5hanth commented Oct 9, 2019

try wrapping googlemaps inside a Expanded widget that will autofill remaining space of Column or Row.

@vpaul9678
Copy link

This will solve your problem:
flutter/flutter#39582

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants