Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

flutter title automatically go to next line

the code below is in wrapped in a row. i need help in getting the text to automatically go to the next line when there’s not enough space. ive been trying to wrap in expanded and stuff but it is not working and throwing me the wrong use of parent widget error. tia

enter image description here

Expanded(
            child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children:  [
            Text(
              Helpers.getChannelName(channel, context.currentUser!),
              overflow: TextOverflow.visible,
              style: GoogleFonts.lato(
                fontSize: 21,
                
              ),
              maxLines: null,
            ),
            const SizedBox(height: 2),
          ],
        )),

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

AppBar has limited height, you can have some(2/3) lines like

Text(
  Helpers.getChannelName(channel, context.currentUser!),
  style: GoogleFonts.lato(
    fontSize: 21,
  ),
  maxLines: 3,
  softWrap: true,
),

Also, you can try changing text size by wrapping Text widget with FittedBox or using auto_size_text

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading