Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start with 1 line and move to 2? #23

Closed
warriorCoder opened this issue Jun 28, 2019 · 2 comments
Closed

Start with 1 line and move to 2? #23

warriorCoder opened this issue Jun 28, 2019 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@warriorCoder
Copy link

warriorCoder commented Jun 28, 2019

Question
Is it possible to fit the text to one line at a specified font size and only if the text doesn't fix at a predetermined size is the font increased and the number of lines increased to two?

Code sample

AutoSizeText(
            Utility.capitalize(product.name),
            style: Theme.of(context).textTheme.title,
            maxFontSize: 18.0,
            minFontSize: 10.0,
            minLines: 1,
            maxLines: 2,
          ),

Version

  • Flutter version: 1.5.4
  • auto_size_text version: 1.2.1
@warriorCoder warriorCoder added the question Further information is requested label Jun 28, 2019
@simc
Copy link
Owner

simc commented Jun 28, 2019

This should work:

AutoSizeText(
  myText,
  style: TextStyle(fontSize: 20),
  minFontSize: 14,
  maxLines: 1,
  overflowReplacement: AutoSizeText(
    myText,
    style: TextStyle(fontSize: 24),
    minFontSize: 16
    maxLines: 2,
  ),
)

@simc simc added the needs info Additional info is needed label Jun 28, 2019
@warriorCoder
Copy link
Author

Works great!! Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants