Open
Description
Describe your feature request
I want to know when a user tap on a tag even if the href is is empty or missing. By default, Html() make a tag not clickable when href is missing so i need to provide a custom extension.
Html(
text: "Ship to: <a>75017</a> <a>PARIS</a>",
extensions: <HtmlExtension>[
TagWrapExtension(
tagsToWrap: <String>{'a'},
builder: (Widget child) {
return GestureDetector(
onTap: () {
print('onTap');
},
child: child,
);
},
),
],
'a': Style.fromTextStyle(
context.texts.linkPrimary.copyWith(
color: Color(0xFF2E4EAA),
),
).copyWith(
margin: Margins.zero,
textDecoration: TextDecoration.none,
),
)
If i run this code this will display :
Instead of :
To bypass this issue, i used the bellow code, but that require an unsexy import and for more complexe scenario i will maybe be blocked later. :
// ignore: implementation_imports
import 'package:flutter_html/src/builtins/interactive_element_builtin.dart';
class InteractiveElementOverride extends InteractiveElementBuiltIn {
const InteractiveElementOverride();
@override
bool matches(ExtensionContext context) =>
supportedTags.contains(context.elementName);
}
/// ...
extensions: <HtmlExtension>[
InteractiveElementOverride(),
],
/// ...
Additional context
flutter_html: 3.0.0-beta.2
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo