diff --git a/lib/src/css_box_widget.dart b/lib/src/css_box_widget.dart index 77d545d022..bb77e44a0f 100644 --- a/lib/src/css_box_widget.dart +++ b/lib/src/css_box_widget.dart @@ -473,6 +473,10 @@ class RenderCSSBox extends RenderBox @override double? computeDistanceToActualBaseline(TextBaseline baseline) { + if (childIsReplaced) { + return size.height; + } + return firstChild?.getDistanceToActualBaseline(baseline); } @@ -487,6 +491,10 @@ class RenderCSSBox extends RenderBox @override double? computeDryBaseline( covariant BoxConstraints constraints, TextBaseline baseline) { + if (childIsReplaced) { + return computeDryLayout(constraints).height; + } + return null; } diff --git a/packages/flutter_html_table/test/img_in_table_test.dart b/packages/flutter_html_table/test/img_in_table_test.dart new file mode 100644 index 0000000000..cca37f60a5 --- /dev/null +++ b/packages/flutter_html_table/test/img_in_table_test.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:flutter_html_table/flutter_html_table.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('table with img', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Html( + data: + '
', + extensions: [const TableHtmlExtension()], + ), + ), + ), + ); + }); +}