Reputation: 4987
How to add grid view and other view in same page?
I try with listview but it is showing error
I/flutter (10293): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 461 pos 12: 'child.hasSize': is not true. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The getter 'scrollOffsetCorrection' was called on null. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The method 'debugAssertIsValid' was called on null. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null
body:ListView(
children: <Widget>[
Text("checking"),
Container(
child: GridView.count(
crossAxisCount: 3,
childAspectRatio: .6,
children: _list.map((p) => ProductManagment(p)).toList(),
),
)
],
)
Another attempt
body:ListView(
children: <Widget>[
Text("checking"),
GridView.count(
crossAxisCount: 3,
childAspectRatio: .6,
children: _list.map((p) => ProductManagment(p)).toList(),
)
],
)
again error
I/flutter (10293): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#f955c relayoutBoundary=up6 NEEDS-PAINT I/flutter (10293): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#a9147 relayoutBoundary=up5 NEEDS-PAINT I/flutter (10293): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#4a4c9 relayoutBoundary=up4 NEEDS-PAINT I/flutter (10293): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 461 pos 12: 'child.hasSize': is not true. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The getter 'scrollOffsetCorrection' was called on null. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The method 'debugAssertIsValid' was called on null. I/flutter (10293): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.
Upvotes: 2
Views: 4756
Reputation: 6082
I think you should just set height of the Container
or warp it by Expanded
widget. And tell what happen?. Might be size is missing thats way error occurred.
EDITED :
body:ListView(
children: <Widget>[
Text("checking"),
Container(
height: 300.0
child: GridView.count(
crossAxisCount: 3,
childAspectRatio: .6,
children: _list.map((p) => ProductManagment(p)).toList(),
),
)
],
)
Set height: 300.0 in container. (You can set height/width as per your requirement or try with Expanded widget)
Upvotes: 6