EnriqueSanVic / magic_text

Auto-responsive text widget that supports a multitude of parameters to control text rendering behaviour.
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

[feature] Empty breakWordCharacter #1

Open iosephmagno opened 9 months ago

iosephmagno commented 9 months ago

Hello @EnriqueSanVic. My compliments for this beautiful plugin.

This is not an issue, but just noticed some people complained about using '-' as break word character.

Indeed, inside a chat application's bubble, words are usually broken without adding a breaking char between them (ie. Whatsapp). Below code would do the job and also won't break copy/paste, coz text will be copied inside clipboard without the breaking char.

return MagicText(
        $text,
        breakWordCharacter: '\u202F',
       ...

Was thinking that for the sake of a cleaner code, this solution could be used as default one if user doesn't assign any specific breakWordCharacter.

EnriqueSanVic commented 9 months ago

Hi @iosephmagno, that's a good idea. I will implement it as a future feature.

Thank you very much for your contribution!

iosephmagno commented 9 months ago

My pleasure. I'd need MagicText to be a text.rich. Is that possible? Something like:

return MagicText(
        overflow: overflow,
        softWrap: true,
        TextSpan(
          text : $text,
          style: _textStyle,
          overflow: overflow,
          maxLines: maxLines,
        ),
      );
iosephmagno commented 9 months ago

Tried a quick test and that breaks the word-break feature

EnriqueSanVic commented 9 months ago

Hi @iosephmagno, Soon I will implement the word-break feature, I will study the implementation of the text rich. greetings.