I build a Card and put on it some tabs. The three tabs worked fine at first, but as I added data I got the error:
if (!constraints.hasBoundedHeight) {
throw FlutterError(
'Horizontal viewport was given unbounded height.\n'
'Viewports expand in the cross axis to fill their container and '
'constrain their children to match their extent in the cross axis. '
'In this case, a horizontal viewport was given an unlimited amount of '
'vertical space in which to expand.',
);
}
break;
In the debugger.
The easy fix was to wrap the tabbarview() with Expanded()
child: Column(
children: [
const SizedBox(height: 60),
const TabBar(
// controller: _tabController,
labelColor: Colors.black,
tabs: [
Tab(
child: Text('Pray'),
),
Tab(
child: Text('Comments'),
),
Tab(
child: Text('Settings'),
),
],
),
Expanded(
child: TabBarView(
controller: _tabController,
children: const [
Text('Put Pray data here'),
Text('Put comments herer'),
Text('THESE ARE THE SETTINGS'),
],
),
),
],
),