I’m getting a bottom underline in the TabBar. How to remove it?

I’m getting a bottom underline in the TabBar. I tried to remove it. but its not removing.

(https://i.sstatic.net/CbDf57Nr.png)

Widget build(BuildContext context) {
    TabController tabController = TabController(length: 2, vsync: this);
  return Scaffold(
      backgroundColor: Palette.white,
      body:  Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              decoration: BoxDecoration(color: const Color(0x1E767680), borderRadius: BorderRadius.circular(7)),
              height: 36,
              child: TabBar(
                indicatorSize: TabBarIndicatorSize.tab,
                indicatorPadding: const EdgeInsets.all(2),
                indicator: BoxDecoration(
                  borderRadius: BorderRadius.circular(7),
                  color: Colors.deepPurple,
                ),
                controller: tabController,
                labelStyle: const TextStyle(color: Colors.white, fontSize: 13, fontWeight: FontWeight.w500),
                unselectedLabelStyle: const TextStyle(color: Color(0xFF5B5B5B), fontSize: 13, fontWeight: FontWeight.w400),
                indicatorWeight: 0,
                indicatorColor: Colors.transparent,
                tabs: const [
                  Tab(text: 'Page 1'),
                  Tab(text: 'Page 2'),
                ],
              ),
            ),

            const SizedBox(height: 16),
            //TabBarView
            Expanded(
              child: TabBarView(
                controller: tabController,
                children: [
                  _buildAttendanceView(),
                  Tab2(),
                ],
              ),
            )
          ],
        ), );

I tried,
border: Border.all(color: Colors.transparent) to remove any visible border.
indicatorWeight: 0:
indicatorColor: Colors.transparent:
Wrap the TabBar widget inside a Material widget and set borderOnForeground to false.
but didnt work.

New contributor

Star Shadow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

It sounds like you’re dealing with an unwanted underline or border at the bottom of the TabBar. You’ve already tried some approaches like setting indicatorWeight to 0, indicatorColor to transparent, and wrapping the TabBar in a Material widget, but the underline persists.

To remove the underline, try the following adjustments:

1. Set the indicator to null:

If you don’t want any underline or indicator at all, you can set the indicator property of the TabBar to null.

2. Remove the indicatorWeight:

Ensure that the indicatorWeight is completely removed since setting it to 0 might still cause issues.

Here’s how your code could look with these adjustments:

Widget build(BuildContext context) {
  TabController tabController = TabController(length: 2, vsync: this);
  return Scaffold(
    backgroundColor: Palette.white,
    body: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          decoration: BoxDecoration(
            color: const Color(0x1E767680), 
            borderRadius: BorderRadius.circular(7)
          ),
          height: 36,
          child: TabBar(
            controller: tabController,
            indicator: BoxDecoration(
              borderRadius: BorderRadius.circular(7),
              color: Colors.deepPurple,
            ),
            labelStyle: const TextStyle(
              color: Colors.white, 
              fontSize: 13, 
              fontWeight: FontWeight.w500
            ),
            unselectedLabelStyle: const TextStyle(
              color: Color(0xFF5B5B5B), 
              fontSize: 13, 
              fontWeight: FontWeight.w400
            ),
            tabs: const [
              Tab(text: 'Page 1'),
              Tab(text: 'Page 2'),
            ],
          ),
        ),
        const SizedBox(height: 16),
        // TabBarView
        Expanded(
          child: TabBarView(
            controller: tabController,
            children: [
              _buildAttendanceView(),
              Tab2(),
            ],
          ),
        ),
      ],
    ),
  );
}

3. Ensure the TabBar is not inside a Material widget with a borderOnForeground setting:

If you have wrapped the TabBar inside a Material widget elsewhere, ensure that borderOnForeground is not interfering.

4. Check for Other Widgets:

If none of the above works, double-check other widgets wrapping the TabBar, like Container or any parent Material widget, to ensure they aren’t causing any unintended styling issues.

This should resolve the unwanted underline in the TabBar. If the issue persists, please let me know, and we can explore further adjustments.

New contributor

SUMIT KUMAR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật