Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.79k stars 860 forks source link

[BUG]onLinkTap not working for the links #1182

Closed preteambuy closed 1 year ago

preteambuy commented 1 year ago

Describe the bug: onLinkTap not working on clicking links

HTML to reproduce the issue:

<a href="https://google.com" rel="noopener noreferrer" target="_blank">Link</a>

Html widget configuration:

Html(
    data: data,
    onLinkTap: (url, _, __, ___) {
                    print("am here...");
    },
    style: {
       "body": Style(
             color: Colors.black
        ),
    },
)

Expected behavior: Should be able to click the links

Screenshots:

Device details and Flutter/Dart/flutter_html versions: Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision eb6d86ee27 (4 weeks ago) • 2022-10-04 22:31:45 -0700 Engine • revision c08d7d5efc Tools • Dart 2.18.2 • DevTools 2.15.0

Stacktrace/Logcat No Errors

Additional info: Version used: 3.0.0-alpha.6 A picture of a cute animal (not mandatory but encouraged)

Sub6Resources commented 1 year ago

Your onLinkTap method is empty. You need to do something in that method when the link is tapped. This plugin doesn't handle opening urls for you.

preteambuy commented 1 year ago

@Sub6Resources intentionally left the handler blank. Added a debug statement and the click doesn't even hit the handler.

Sub6Resources commented 1 year ago

Strange. I'll look into this

preteambuy commented 1 year ago

@Sub6Resources any updates mate? We are kind off waiting on this for our next release

Sub6Resources commented 1 year ago

If this is blocking, you can try to revert to an earlier version to see if that resolves your issue (try 3.0.0-alpha.5).

preteambuy commented 1 year ago

even the older versions of alpha doesn't work @Sub6Resources

preteambuy commented 1 year ago

any other suggestions @Sub6Resources ?

Sub6Resources commented 1 year ago

@preteambuy I've personally tested older versions of alpha and onlinktap works just fine for me. We'll need some more info or context code to help you debug this case. Maybe a gesture detector or something at a higher level stealing focus?

preteambuy commented 1 year ago

@Sub6Resources thx mate. Lemme see if something else s not propagating the click event.

Sub6Resources commented 1 year ago

Closing, since I can't reproduce