Skip to content

TabBar.tabAlignment property does't work when dividerColor is transparent #150316

@aap17

Description

@aap17

Steps to reproduce

I what tabs to be align at start and dividerColor is to be transparent.

TabBar(
            dividerColor: Colors.transparent,
            tabAlignment: TabAlignment.start,
            isScrollable: true,
            tabs: [Tab(text: "a"), Tab(text: "b")])

But tabs are always at center, the property tabAlignment does't work

Expected results

I want tabs to be at start. It works when dividerColor is not set or set to any value but transparent

TabBar(
           dividerColor: Colors.red,
           tabAlignment: TabAlignment.start,
           isScrollable: true,
           tabs: [Tab(text: "a"), Tab(text: "b")])

bug2

Actual results

you can see tabAlignment is set, but it does't work

 TabBar(
            dividerColor: Colors.transparent,
            tabAlignment: TabAlignment.start,
            isScrollable: true,
            tabs: [Tab(text: "a"), Tab(text: "b")])

bug1

Code sample

Full code sample.
class Sample extends StatefulWidget {
  @override
  _State createState() => _State();
}

class _State extends State<Sample> with TickerProviderStateMixin {

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 2,
        child: Scaffold(
            appBar: AppBar(
                bottom: TabBar(
                    dividerColor: Colors.transparent,
                    tabAlignment: TabAlignment.start,
                    isScrollable: true,
                    tabs: [Tab(text: "a"), Tab(text: "b")])),
            body: TabBarView(children: [
              Container(color: Colors.green),
              Container(color: Colors.blue)
            ])));
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.19045.4529], locale ru-RU)
    • Flutter version 3.22.1 on channel stable at C:\flutter
    ! The flutter binary is not on your path. Consider adding C:\flutter\bin to
      your path.
    ! The dart binary is not on your path. Consider adding C:\flutter\bin to your
      path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (4 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly
      to perform update checks and upgrades.

Metadata

Metadata

Assignees

Labels

f: material designflutter/packages/flutter/material repository.found in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions