I need a component to be inserted in a SingleChildScrollView children's list that has one or two tabs.
Here's my build()
method:
Widget build(BuildContext context) {
/// TODO: Make firmware update support for iOS asap
final isBleFirmwareUpdateSupported = Platform.isAndroid;
return DefaultTabController(
length: isBleFirmwareUpdateSupported ? 2 : 1,
child: Column(children: [
// === "Firmware BLE update"
Text(i18n_Firmware_update.i18n,
style: Theme.of(context).textTheme.headline6),
spacer,
// == Pick Wifi or BLE
TabBar(
tabs: [
Tab(icon: Icon(Icons.wifi)),
if (isBleFirmwareUpdateSupported)
Tab(icon: Icon(Icons.bluetooth)),
],
),
Center(
child: TabBarView(children: [
Center(child: Text("WiFi")),
Center(child: Text("BLE"))
]))
]));
}
}
But I get the error
FlutterError (Horizontal viewport was given unbounded height. 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.)
Of course, if I do:
Container(
height: 600,
width: double.infinity,
child: TabBarView(children: [
The error disappears.
So my question is how to transform the code so that the container compute an engloging children box by itself?