Ny Regency
Ny Regency

Reputation: 1722

Flutter: Divider intersecting the indicator line in TabBar

I've implemented this using

return Stack(

  children: <Widget>[
    new TabBar(
    controller: _controller,
    labelColor: Colors.black,
    unselectedLabelColor: Colors.grey,
    indicatorColor: Colors.black,
    tabs: [
      new Tab(text: 'Info'),
      new Tab(text: 'Transpo'),
      new Tab(text: 'Shelter'),
      new Tab(text: 'Tips'),
      new Tab(text: 'Routes'),
    ],
  ),

  new Padding(
    padding: const EdgeInsets.only(top: 39.0),
    child: new Divider(
      color: Colors.grey,
      height: 16.0,
    ),
  ),
  ], 
);

}

But I am concerned because of the constant value in the divider's padding. What if the height of tabbar changes? Or is there a way to get the height of the tabbar then use it for the padding? Or is there another elegant way to implement this? Thanks

Upvotes: 0

Views: 2211

Answers (1)

R&#233;mi Rousselet
R&#233;mi Rousselet

Reputation: 277097

It's ok because the height of Appbar is constant. It can't change.

Upvotes: 1

Related Questions