0

My code like this :

TabBar(
                          controller: _tabController,
                          isScrollable: false,
                          dividerColor: Colors.transparent,
                          indicator: const UnderlineTabIndicator(
                            borderSide: BorderSide(color: Colors.green, width: 4.0),
                            borderRadius: BorderRadius.all(Radius.circular(25)),
                            insets: EdgeInsets.symmetric(horizontal: 70.0, vertical: 17),
                          ),
                          indicatorSize: TabBarIndicatorSize.tab,
                          labelColor: Colors.black,
                          unselectedLabelColor: Colors.grey,
                          tabs: [
                            Tab(child: _buildTab(text: 'Phone', isSelected: _selectedIndex == 0)),
                            Tab(child: _buildTab(text: 'Email', isSelected: _selectedIndex == 1)),
                          ],
                        ),

and for _buildTab widget like this :


  Widget _buildTab({required String text, required bool isSelected}) {
    return Container(
      alignment: Alignment.center,
      width: double.infinity,
      decoration: const BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(25),
          topRight: Radius.circular(25),
        ),
      ),
      child: Text(
        text,
        style: TextStyle(
          fontSize: 18,
          color: isSelected ? Colors.black : Colors.black,
        ),
      ),
    );
  }

how to create TabBar like radius in middle tab-bar, honestly i'm stuck for custom this one. please help

1
  • 2
    Share image that you want to create. Commented Jul 29, 2024 at 5:04

1 Answer 1

0

You can user flutter_custom_tab_bar package to have a rounded indicator.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.