From 77273da24c8520b1c464b212a55910b794a564c1 Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:20:48 +1030 Subject: [PATCH 1/2] Dont automatically make keys for me --- lib/flutter_html.dart | 6 +++--- lib/src/html_parser.dart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/flutter_html.dart b/lib/flutter_html.dart index 0247d4c94b..9e60de9d05 100644 --- a/lib/flutter_html.dart +++ b/lib/flutter_html.dart @@ -60,7 +60,7 @@ class Html extends StatefulWidget { this.style = const {}, }) : documentElement = null, assert(data != null), - _anchorKey = anchorKey ?? GlobalKey(), + _anchorKey = anchorKey, super(key: key); Html.fromDom({ @@ -78,7 +78,7 @@ class Html extends StatefulWidget { }) : data = null, assert(document != null), documentElement = document!.documentElement, - _anchorKey = anchorKey ?? GlobalKey(), + _anchorKey = anchorKey, super(key: key); Html.fromElement({ @@ -95,7 +95,7 @@ class Html extends StatefulWidget { this.style = const {}, }) : data = null, assert(documentElement != null), - _anchorKey = anchorKey ?? GlobalKey(), + _anchorKey = anchorKey, super(key: key); /// A unique key for this Html widget to ensure uniqueness of anchors diff --git a/lib/src/html_parser.dart b/lib/src/html_parser.dart index 287063fb6a..4f71e92611 100644 --- a/lib/src/html_parser.dart +++ b/lib/src/html_parser.dart @@ -43,7 +43,7 @@ class HtmlParser extends StatefulWidget { final Html? root; HtmlParser({ - required super.key, + super.key, required this.htmlData, required this.onLinkTap, required this.onAnchorTap, From 8f695c4bf6c16cf00aa2d4e9933f6b3ed17098d6 Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:23:38 +1030 Subject: [PATCH 2/2] Update flutter_html.dart --- lib/flutter_html.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flutter_html.dart b/lib/flutter_html.dart index 9e60de9d05..39e27b51d7 100644 --- a/lib/flutter_html.dart +++ b/lib/flutter_html.dart @@ -99,7 +99,7 @@ class Html extends StatefulWidget { super(key: key); /// A unique key for this Html widget to ensure uniqueness of anchors - final GlobalKey _anchorKey; + final GlobalKey? _anchorKey; /// The HTML data passed to the widget as a String final String? data;