File tree Expand file tree Collapse file tree 4 files changed +49
-9
lines changed
packages/url_launcher/url_launcher_web Expand file tree Collapse file tree 4 files changed +49
-9
lines changed Original file line number Diff line number Diff line change 1- ## NEXT
1+ ## 2.4.2
22
3+ * Ensure link widget merge its semantic node with its children to avoid duplicate nodes.
34* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.
45
56## 2.4.1
Original file line number Diff line number Diff line change @@ -208,6 +208,43 @@ void main() {
208208 maxScrolls: 1000 ,
209209 );
210210 });
211+
212+ testWidgets ('MergeSemantics is always present to avoid duplicate nodes' , (
213+ WidgetTester tester,
214+ ) async {
215+ await tester.pumpWidget (
216+ MaterialApp (
217+ home: Scaffold (
218+ body: Column (
219+ children: < Widget > [
220+ WebLinkDelegate (
221+ TestLinkInfo (
222+ uri: Uri .parse ('https://dart.dev/xyz' ),
223+ target: LinkTarget .blank,
224+ builder: (BuildContext context, FollowLink ? followLink) {
225+ return ElevatedButton (
226+ onPressed: followLink,
227+ child: const Text ('First Button' ),
228+ );
229+ },
230+ ),
231+ ),
232+ ],
233+ ),
234+ ),
235+ ),
236+ );
237+
238+ await tester.pumpAndSettle ();
239+
240+ final Finder buttonFinder = find.byType (ElevatedButton );
241+ expect (buttonFinder, findsOneWidget);
242+
243+ final Element buttonElement = tester.element (buttonFinder);
244+ final MergeSemantics ? parentWidget =
245+ buttonElement.findAncestorWidgetOfExactType <MergeSemantics >();
246+ expect (parentWidget, isNotNull);
247+ });
211248 });
212249
213250 group ('Follows links' , () {
Original file line number Diff line number Diff line change @@ -117,13 +117,15 @@ class WebLinkDelegateState extends State<WebLinkDelegate> {
117117 }
118118
119119 Widget _buildChild (BuildContext context) {
120- return Semantics (
121- link: true ,
122- identifier: _semanticsIdentifier,
123- linkUrl: widget.link.uri,
124- child: widget.link.builder (
125- context,
126- widget.link.isDisabled ? null : _followLink,
120+ return MergeSemantics (
121+ child: Semantics (
122+ link: true ,
123+ identifier: _semanticsIdentifier,
124+ linkUrl: widget.link.uri,
125+ child: widget.link.builder (
126+ context,
127+ widget.link.isDisabled ? null : _followLink,
128+ ),
127129 ),
128130 );
129131 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: url_launcher_web
22description : Web platform implementation of url_launcher
33repository : https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_web
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
5- version : 2.4.1
5+ version : 2.4.2
66
77environment :
88 sdk : ^3.7.0
You can’t perform that action at this time.
0 commit comments