Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.