Skip to content

Is there a way to balance text across multiple lines? #153

@orkun1675

Description

@orkun1675

Question
Balance text across multiple lines; evenly wrapping it so that each line has similar width.

Similar to CSS: text-wrap: balance;

Is there a way to achieve this?

For example, instead of:

Turn on notifications to avoid missing out on
               pop-up quizzes.

It would be visually better to have:

Turn on notifications to avoid 
missing out on pop-up quizzes.

Code sample

 Row(
    children: [
      Expanded(
        child: AutoSizeText(
          'Turn on notifications to avoid missing out on pop-up quizzes.',
          style: Theme.of(context).textTheme.bodySmall,
          maxLines: 2,
          minFontSize: 8,
          textAlign: TextAlign.center,
        ),
      ),
    ],
 ),

Version

  • Flutter version: 3.32.8
  • auto_size_text version: 3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions