daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
641 stars 241 forks source link

Text Size large with isSelectable = true #687

Closed bksubhuti closed 2 years ago

bksubhuti commented 2 years ago

text size very large with isSelectable enabled

If the feature is enabled, the text size is large. If the feature is not enabled the text size is not (extra large) large <p class="definition">[Dhātu+ṇvu+ī] CL=0 Ati Thayan Chit Tin Croatian Dhataki; န ဒါ ဒီ၊ Dhan, T. 589.] Pattaki Pin.</p><!-- https://github.com/bksubhuti/tipitaka-pali-reader webview 3.0 has been removed from project before posting this bug report. It is pushed to the git https://github.com/bksubhuti/tipitaka-pali-reader

Expected results

standard text size is what i wanted to see.

Actual results

picture below: Screenshot_20211215-133142

bksubhuti commented 2 years ago

it seems that the emulator does not produce this bug. It is specific to my phone it seems.. I will try release mode. Perhaps that is the problem.

bksubhuti commented 2 years ago

update it is only my phone.. emulator works fine in release too. I have samsung A50 android 11

bksubhuti commented 2 years ago

I see now.. my phone has the system font size a little bigger (+10-15%). So when the isSelectable = true then the font size goes based relative to the system. system was not that big but something is affecting it. When isSelectable is not turned on, this is not affected.

This is why it did not get reproduced on Linux or the Emulator.

I still think this is a bug.. but our div does not have a size given.


I/flutter (29310): <h3>Concise Pali-English Dictionary</h3>
I/flutter (29310): <br>
I/flutter (29310): <p class="definition">phassa/m./touch; contact.</p>
bksubhuti commented 2 years ago

our problem is solved by doing a textStyle , but maybe a bug since it behaves differently for isSelectable.

daohoangson commented 2 years ago

Yes, this is still a bug. How did you workaround with a TextStyle?

bksubhuti commented 2 years ago
                child: HtmlWidget(
                  content,
                  textStyle: TextStyle(fontSize: Prefs.fontSize.toDouble()),
                  factoryBuilder: () => _MyFactory(),
                  //isSelectable: true,
                  //onSelectionChanged: (selection, cause) {
                  //  print(selection);
                  //},
                ))),
daohoangson commented 2 years ago

This is a bug, I'm working on it at #689.

daohoangson commented 2 years ago

fwfh_selectable_text@0.8.3+1 has been released with the fix for this. Please try upgrading, it should work on your real device (the one with the scaled up font size) without any workaround.

bksubhuti commented 2 years ago

sorry for being slow to verify