netglade / sliver_app_bar_builder

A truly customizable sliver for app bars with the benefit of using builders.
https://pub.dev/packages/sliver_app_bar_builder
MIT License
18 stars 1 forks source link

Is there a way to overflow text widgets inside contentBuilder? #3

Closed samuel-s-marques closed 1 year ago

samuel-s-marques commented 1 year ago

I'm currently using this package in my app and I'm wondering if there's a way to overflow a text widget inside the contentBuilder. Here are the screenshots of storybook demo using iPhone 12 Mini layout, for example:

  1. A long appbar text title: image

  2. The Text widget when shrunken: image

It would be great to add an ellipsis at the end.

tenhobi commented 1 year ago

Hi @samuel-s-marques, yea, it's possible. We are doing that in our app -- multi-line on start, one line with an ellipsis when shrunken. I will tell you how ASAP when I am on my computer.

I should probably add some storybooks to show examples like this.

samuel-s-marques commented 1 year ago

@tenhobi, thank you. I appreciate your prompt response and willingness to assist.

tenhobi commented 1 year ago

@samuel-s-marques fixed the default story so the text is wrapped correctly. Previously I used Matrix4 which "moves" already rendered widget and so the text didn't wrap correctly as seen on your screenshot.

image

For the second story "Multiline to one line" I implemented an example of how to handle the case when you start to shrink the app bar to switch to one line. You can modify the threshold and play with it. 👍

The example uses TextPainter, so I can work with text height etc. If somebody has a better idea, please fill out a PR. :)

samuel-s-marques commented 1 year ago

I just tested and it looks great! Thank you!