-
-
Notifications
You must be signed in to change notification settings - Fork 913
Closed
Labels
Milestone
Description
Describe the bug:
When using customRenders
, simple non-wrapped text does not get rendered. It has to be wrapped in p
, span
or similar.
HTML to reproduce the issue:
<custom>Hello <span>there</span> <test></test> <p>new</p></custom>
Html
widget configuration:
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
class HtmlApp extends StatelessWidget {
const HtmlApp({super.key});
final _testTag = 'test';
final _customWrapperTag = 'custom';
CustomRender _testRender() {
return CustomRender.widget(widget: (_, __) {
return const Icon(Icons.abc);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('HTML example'),
),
body: Html(
data:
'<custom>Hello <span>there</span> <test></test> <p>new</p></custom>',
customRenders: {
tagMatcher(_testTag): _testRender(),
tagMatcher(_customWrapperTag): fallbackRender(),
},
tagsList: Html.tags
..addAll([
_testTag,
_customWrapperTag,
]),
),
),
debugShowCheckedModeBanner: false,
);
}
}
Expected behavior:
I would expect the word Hello
to be rendered. But it is not - as it does not appear in the buildChildren
function. If I comment out the following line, it works as expected.
tagMatcher(_customWrapperTag): fallbackRender(),
Is this the correct behavior - am I just missing something?
Screenshots:
Expected | Actual |
---|---|
![]() |
![]() |
Device details and Flutter/Dart/flutter_html
versions:
- Device: any
- Flutter
3.7.12
- Dart
2.19.6
- flutter_html
3.0.0-alpha.6