I am in the process of programming an app using a ModalBottomSheet. I put the core of this in another widget, because a ModalBottomSheet is not stateful, but the widget has to be stateful. This has already worked with one slider, but now I need a horizontal GridView. As soon as I put it in, it only shows me the background of the ModalBottomSheet, nothing more.
Does anyone know how to fix this?
Here is my code:
class _MyStatefulWidget extends State<NormalSecondStep> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Text(
'Only a text',
),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
GridView(
scrollDirection: Axis.horizontal,
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
childAspectRatio: 3 / 2,
crossAxisSpacing: 20,
mainAxisSpacing: 20),
children: [
// Some widgets
],
),
],
);
}
}
Please confirm, Do you want gridview in model bottom sheet in the horizontal direction right?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.