Padding around AppBar in a DefaultTabController

Viewed 8020

I’m using a DefaultTabController with a Scaffold as the child widget. For the appBar, I’m using a TabBar. I’d like to add some padding around the TabBar but the appBar property requires a class that extends PreferredSizeWidget.

Example snippet of the tab controller I'm building:

  new DefaultTabController(
    length: tabs.length,
    child: new Scaffold(
      backgroundColor: const Color(0xFFF3EEE1),
      appBar: new TabBar(
        tabs: tabs,
      ),
      body: new TabBarView(
        children: _testPacks.map((TestPack testPack) {
          return _contentWidget(context: context, testPack: testPack);
        }).toList(),
      ),
    ),
  );

From the Scaffold class

/// An app bar to display at the top of the scaffold.
final PreferredSizeWidget appBar;
2 Answers

Now you can pass your custom padding

 TabBar(
      labelPadding: EdgeInsets.all(0),
Related