Large text in tab is not showing completely Flutter
367
Solution 1
I solved it, instead of using text
attribute I used
child: Text(
"Countdown Timer",
textAlign: TextAlign.center,
),
Adding textAlign
to it solved my problem
Solution 2
Add labelPadding
or make the tabs scrollable using isScrollable
TabBar(
isScrollable: true,
labelPadding: EdgeInsets.symmetric(horizontal: 10.0),
tabs: [
Tab(
text: "Clock",
icon: Icon(Icons.access_time),
),
Tab(
text: "Alarm",
icon: Icon(Icons.access_alarm),
),
Tab(
text: "Stopwatch",
icon: Icon(Icons.av_timer),
),
Tab(
text: "Countdown Timer",
icon: Icon(Icons.timer_rounded),
)
],),
Solution 3
put Tab Text into Expanded widget
child:Expaned(
child : Text(
"Countdown Timer",
textAlign: TextAlign.center,
)),
Author by
Junaid Khalid
I am a CS graduate and passionate about learning
Updated on December 30, 2022Comments
-
Junaid Khalid over 1 year
I am working on a Flutter project that requires tabs, but one of the tab name is large, the name is not showing completely, as demonstrated in picture, How can I resolve this issue, I want the
TabBar
text to bemultiline
, I am new to Flutter so any help will be appreciated.Here is the code
TabBar( tabs: [ Tab( text: "Clock", icon: Icon(Icons.access_time), ), Tab( text: "Alarm", icon: Icon(Icons.access_alarm), ), Tab( text: "Stopwatch", icon: Icon(Icons.av_timer), ), Tab( text: "Countdown Timer", icon: Icon(Icons.timer_rounded), ) ], ),
-
Mahi over 2 yearsshow the code a little bit. you can use \n for next line.
-
Mahi over 2 yearsText( maxlines:2
-
Rohith Nambiar over 2 yearsAs only one letter is hidden, you can decrease the font size
-
Junaid Khalid over 2 years@Mahi I am not using Text widget, secondly after
\n
the text allignment does not remain centered -
Mahi over 2 yearsokay. whatever it is.. you have solved it. good.
-
Junaid Khalid over 2 yearsThank You very much, Your comment did gave me the Idea
-
-
Shahriar Siraj Snigdho almost 2 yearsThis should be voted as the correct answer. Thanks mate!