To position a widget in the middle of the body using tabBarView()
, you can wrap the widget in a Center
widget and place it as a child of the TabBarView
.
Here's an example code snippet:
Scaffold(
appBar: AppBar(
title: Text('Example'),
),
body: TabBarView(
children: [
// First Tab
Center(
child: Text('This is the first tab'),
),
// Second Tab
Center(
child: Text('This is the second tab'),
),
// Third Tab
Center(
child: Text('This is the third tab'),
),
],
),
);
By wrapping the Text
widgets in a Center
widget, they will be horizontally and vertically centered in the TabBarView
.
Asked: 2021-11-21 11:00:00 +0000
Seen: 17 times
Last updated: Dec 01 '22