Skip to content

TabBar.height adds a gap between the AppBar.toolbar and AppBar.bottom #156200

@benji-farquhar

Description

@benji-farquhar

Use case

If we add a smaller height to TabBar, E.G:
AppBar(
  bottom: const TabBar(
    tabs: [
      Tab(
        text: 'Profile',
        height: 30,
      ),
      Tab(
        text: 'Appearance',
        height: 30,
      ),
    ],
  ),
It adds a gap between the `AppBar` `toolbar` and the `bottom`:
Screenshot 2024-10-04 at 8 32 59 pm

And without the height specified on the Tab, it has no gap:

Screenshot 2024-10-04 at 8 31 39 pm

I don't want the gap. So i want this:

Screenshot 2024-10-04 at 8 35 25 pm

Proposal

Ideally we should be able to control the padding between them but i found just adding mainAxisSize: MainAxisSize.min, below to app_bar.dart at least removed the gap entirely which is better than mandatory gap:

if (widget.bottom != null) {
  appBar = Column(
    mainAxisSize: MainAxisSize.min,
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: <Widget>[
      Flexible(
        child: ConstrainedBox(
          constraints: BoxConstraints(maxHeight: toolbarHeight),
          child: appBar,
        ),
      ),
      if (widget.bottomOpacity == 1.0)
        widget.bottom!
      else
        Opacity(
          opacity: const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(widget.bottomOpacity),
          child: widget.bottom,
        ),
    ],
  );

Adding this between them gave the padding desired: SizedBox(height: 5), so ideally you would add bottomSpacer as a parameter to customise: SizedBox(height: bottomSpacer), or make it EdgeInsets and wrap the bottom with it.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged 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