Flutter - First tab of the TabBar is not positioned properly

Viewed 937

While working with Tabs in Appbar, we found that after launching the release build of the app, half of the text label of the first tab is outside the screen (only half is visible initially).

Its happening only in the release build. In debug mode its showing properly.

Not sure if we are doing something wrong or its a bug actually!

Screenshot of the release apk after app launch (not rendered properly)

build apk having issue.

Screenshot of the debug apk after app launch (rendered properly)

enter image description here

This is the code we are using...

import 'package:flutter/material.dart';

void main() {
  runApp(TabBarDemo());
}

class TabBarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(text: "Text 1",),
                Tab(text: "Text 2",),
                Tab(text: "Text 3",),
                Tab(text: "Text 4",),
                Tab(text: "Text 5",),
                Tab(text: "Text 6",),
                Tab(text: "Text 7",),
                Tab(text: "Text 8",),
                Tab(text: "Text 9",),
                Tab(text: "Text 10",),
              ],
              isScrollable: true,
            ),
            title: Text('Tabs Demo'),
          ),
          body: TabBarView(
            children: [
              Icon(Icons.directions_car),
              Icon(Icons.directions_transit),
              Icon(Icons.directions_bike),
            ],
          ),
        ),
      ),
    );
  }
}
0 Answers
Related