Repository navigation
TextSpan with recognizer in ListTile fails assertion #54665
Copy link
Copy link
Closed
Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsa: typographyText rendering, possibly libtxtText rendering, possibly libtxtfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to Reproduce
$ flutter test <file.dart>import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets("ups ...", (WidgetTester tester) async {
TextSpan w = TextSpan(
text: 'foo',
style: TextStyle(color: Colors.blueAccent, fontWeight: FontWeight.bold),
recognizer: TapGestureRecognizer()
..onTap = () {
// navigate to desired screen
},
);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SwitchListTile(
title: RichText(
text: w,
),
value: false,
onChanged: (_) {},
),
),
),
);
await tester.pumpAndSettle();
});
}Expected results:
Test succeeds.
Actual results:
Test fails with the following error:
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
'package:flutter/src/semantics/semantics.dart': Failed assertion: line 2626 pos 16: 'node.parent ==
null || !node.parent.isPartOfNodeMerging || node.isMergedIntoParent': is not true.
See flutter test in Logs for whole output!
Logs
Testing started at 16:54 ...
/Users/xxxxxx/development/flutter/bin/flutter --no-color test --machine --plain-name "ups ..." test/widget/richtext_link_test.dart
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
'package:flutter/src/semantics/semantics.dart': Failed assertion: line 2626 pos 16: 'node.parent ==
null || !node.parent.isPartOfNodeMerging || node.isMergedIntoParent': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
When the exception was thrown, this was the stack:
#2 SemanticsOwner.sendSemanticsUpdate (package:flutter/src/semantics/semantics.dart:2626:16)
#3 PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1042:23)
#4 AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:985:31)
#5 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
#6 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15)
#7 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9)
#8 AutomatedTestWidgetsFlutterBinding.pump.<anonymous closure> (package:flutter_test/src/binding.dart:872:9)
#11 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)
#12 AutomatedTestWidgetsFlutterBinding.pump (package:flutter_test/src/binding.dart:859:27)
#13 WidgetTester.pumpWidget.<anonymous closure> (package:flutter_test/src/widget_tester.dart:323:22)
#16 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)
#17 WidgetTester.pumpWidget (package:flutter_test/src/widget_tester.dart:320:27)
#18 main.<anonymous closure> (file:///Users/xxxxxx77/coding-pers/glutyfree/frontend-flutter/test/widget/richtext_link_test.dart:16:18)
#20 main.<anonymous closure> (file:///Users/xxxxxx77/coding-pers/glutyfree/frontend-flutter/test/widget/richtext_link_test.dart:6:26)
#21 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:124:25)
#23 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:122:9)
#24 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:696:19)
#38 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1066:17)
#40 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1054:35)
(elided 37 frames from class _AssertionError, class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: ups ...
Nothing to show, test is provided.
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E266, locale en-DE)
• Flutter version 1.12.13+hotfix.9 at /Users/xxxxxx/development/flutter
• Framework revision f139b11009 (2 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/xxxxxx/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4, Build version 11E146
• CocoaPods version 1.9.1
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.0.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.40.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.0
[✓] Connected device (3 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• iPhone 11 Pro • F5B265ED-92AE-4C3E-BCBB-FB695B0CF5A2 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• iPhone 11 Pro Max • 40A5CB14-4898-4953-B776-B83CAFFCC589 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsa: typographyText rendering, possibly libtxtText rendering, possibly libtxtfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
[-]RichText with recognizer in ListTile fails assertion[/-][+]TextSpan with recognizer in ListTile fails assertion[/+]TahaTesser commentedon Apr 13, 2020
flutter doctor -v
iapicca commentedon Apr 13, 2020
Hi @nachtmaar
for my understanding on the matter
SwitchListTilemerge the semantics andonChangeis actually
onTapin disguise.I tried changing in
TapGestureRecognizeronTaptoonTapDown,without luck, but I have teh feeling that is the right direction.
Of course without TapGestureRecognizer() works as intended.
I'll try looking into it
Thanks for reporting that
nachtmaar commentedon Apr 16, 2020
@iapicca thanks for investigating. I am using a
Flexibleas a replacement for the SwitchListTile`. That means, the issue is not urgent for me. But I think it should either be fixed, or a better error message guiding the user in solving the problem.Btw, the same problem happens when using a
CheckBoxListTile.For anyone having the same problem, my workaround looks similar to this:
iapicca commentedon Jul 24, 2020
testing the code above with the latest master
logs
doctor
the issue persists
Thank you
The-Redhat commentedon Nov 19, 2020
another workaround is wrapping the
RichtTextinExcludeSemantics.maheshj01 commentedon Dec 1, 2022
I verified this issue on the latest stable and the master channel and I was able to reproduce the issue.
logs
flutter doctor -v (mac)
iPypeNB commentedon Jun 13, 2023
any progress on this error? i have the same problem, when i use the checkboxListTile
Make `SemanticsNode.isMergedIntoParent` Readonly (#137304)
github-actions commentedon Nov 10, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.