I am trying to place an ExpansionTile with a horizontal GridView child in a container. See below for code. I get the error message 'Horizontal viewport was given unbounded height.'
I don't want to specify the height of ExpansionTile or GridView explicitly, but rather have it calculated from the Expanded widget and the children of GridView.
I've tried setting 'shrinkWrap: true' in GridView as suggested here with no success. I also tried wrapping GridView in Flexible based on this answer which gives me the error 'RenderFlex children have non-zero flex but incoming height constraints are unbounded.'
I think the problem is with how I'm using GridView, but I'm new to Flutter and not really sure. Here is my code:
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text("Title")),
body: Column(
children: <Widget>[
Expanded(
flex: 3,
child: ExpansionTile(
title: Text("Expandable"),
children: <Widget>[
GridView.count(
scrollDirection: Axis.horizontal,
crossAxisCount: 2,
children: <Widget>[
RawChip(label: Text("Hello")),
RawChip(label: Text("World")),
],
),
],
),
),
Expanded(
flex: 7,
child: Container(
color: Colors.blue
),
),
],
),
),
),
);