Skip to content

Commit e85915a

Browse files
author
Andrei
committed
Added ImageProperties to the Html widget
1 parent 7289b18 commit e85915a

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

lib/flutter_html.dart

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@ library flutter_html;
22

33
import 'package:flutter/material.dart';
44
import 'package:flutter_html/html_parser.dart';
5+
import 'image_properties.dart';
56

67
class Html extends StatelessWidget {
7-
Html({
8-
Key key,
9-
@required this.data,
10-
this.padding,
11-
this.backgroundColor,
12-
this.defaultTextStyle,
13-
this.onLinkTap,
14-
this.renderNewlines = false,
15-
this.customRender,
16-
this.customEdgeInsets,
17-
this.customTextStyle,
18-
this.blockSpacing = 14.0,
19-
this.useRichText = false,
20-
this.onImageError,
21-
this.linkStyle = const TextStyle(
22-
decoration: TextDecoration.underline,
23-
color: Colors.blueAccent,
24-
decorationColor: Colors.blueAccent),
25-
}) : super(key: key);
8+
Html(
9+
{Key key,
10+
@required this.data,
11+
this.padding,
12+
this.backgroundColor,
13+
this.defaultTextStyle,
14+
this.onLinkTap,
15+
this.renderNewlines = false,
16+
this.customRender,
17+
this.customEdgeInsets,
18+
this.customTextStyle,
19+
this.blockSpacing = 14.0,
20+
this.useRichText = false,
21+
this.onImageError,
22+
this.linkStyle = const TextStyle(
23+
decoration: TextDecoration.underline,
24+
color: Colors.blueAccent,
25+
decorationColor: Colors.blueAccent),
26+
this.imageProperties,
27+
this.onImageTap})
28+
: super(key: key);
2629

2730
final String data;
2831
final EdgeInsetsGeometry padding;
@@ -35,6 +38,10 @@ class Html extends StatelessWidget {
3538
final ImageErrorListener onImageError;
3639
final TextStyle linkStyle;
3740

41+
/// Properties for the Image widget that gets rendered by the rich text parser
42+
final ImageProperties imageProperties;
43+
final OnImageTap onImageTap;
44+
3845
/// Either return a custom widget for specific node types or return null to
3946
/// fallback to the default rendering.
4047
final CustomRender customRender;
@@ -61,6 +68,8 @@ class Html extends StatelessWidget {
6168
html: data,
6269
onImageError: onImageError,
6370
linkStyle: linkStyle,
71+
imageProperties: imageProperties,
72+
onImageTap: onImageTap,
6473
)
6574
: HtmlOldParser(
6675
width: width,

0 commit comments

Comments
 (0)