class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
children: [
Card(
child: DefaultTabController(
length: 2,
child: Column(
children: const [
TabBar(
tabs: [
Tab(icon: Icon(Icons.cloud_outlined)),
Tab(icon: Icon(Icons.beach_access_sharp)),
],
),
SizedBox(
height: 300, // delete this.
child: TabBarView(
children: [
//ListView(shrinkWrap: true) ← and adjust the TabBarView to the height of this.
Text(''),
],
),
),
],
),
),
),
],
);
}
}
I'm working on a card that allows you to switch the content with the TabBar.I would like to make the height of the TabBarView match the height of the children's ListView, but I get an error when I remove the SizedBox or use Expanded. Can you please advise me on the option of using other widgets as well?