flutter_html icon indicating copy to clipboard operation
flutter_html copied to clipboard

[FEATURE] Support for CSS attribute word-break

Open julienduchow opened this issue 3 years ago • 5 comments

Nice package you created! Is the support of the word-break attribute planned or is there a workaround? I want to display a table, but it produces an overflow on the right side because I can not allow him to break lines in words.

julienduchow avatar Feb 13 '22 11:02 julienduchow

Do you have a small example html that we can use to reproduce this issue? By default content in tables should break up in lines, but not in syllables.

erickok avatar Feb 13 '22 20:02 erickok

By default content in tables should break up in lines, but not in syllables.

Yes and that is exactly my problem. I have very long words and now enough space, so I want to allow him to break lines even in the middle of words if necessary.

<table>
<tr>
<td>Thisssssssissssssaveryyyyyyylongworddddddddd</td>
<td>Thisssssssissssssaveryyyyyyylongworddddddddd</td>
</tr>
</table>

julienduchow avatar Feb 14 '22 07:02 julienduchow

Flutter is a bit notorious for not handling this well and not really supporting the text breakup you might expect or at least hope for. See also https://github.com/flutter/flutter/issues/18761 for a discussion.

Perhaps you are well off by allowing the table to scroll horizontally?

          customRender: {
            "table": (context, child) {
              return SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child:
                    (context.tree as TableLayoutElement).toWidget(context),
              );
            },
          },

erickok avatar Feb 14 '22 08:02 erickok

Ah okay I see. Well I guess scrolling is better then an overflow, but I would prefer if the user can see the whole table without scrolling. Because there is more then enough space vertically. But I guess if flutter can not handle this then you can not implement it in your libary. I guess there is also no chance to implemented the html tag <wbr> and &shy; char because of this? Anyway thanks for the info.

julienduchow avatar Feb 14 '22 08:02 julienduchow

Just testet the &shy; and noticed that it works theoretically. It allows to break the word and this also works in your flutter_html. But the "-" Symbol- to indicate that connection between the two parts of the word is missing. @erickok

julienduchow avatar Feb 14 '22 11:02 julienduchow