forked from firka/flutter
Remove assert that prevents WidgetSpans from being used in SelectableText (#92295)
This commit is contained in:
@@ -585,9 +585,11 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context); // See AutomaticKeepAliveClientMixin.
|
||||
assert(() {
|
||||
return _controller._textSpan.visitChildren((InlineSpan span) => span.runtimeType == TextSpan);
|
||||
}(), 'SelectableText only supports TextSpan; Other type of InlineSpan is not allowed');
|
||||
// TODO(garyq): Assert to block WidgetSpans from being used here are removed,
|
||||
// but we still do not yet have nice handling of things like carets, clipboard,
|
||||
// and other features. We should add proper support. Currently, caret handling
|
||||
// is blocked on SkParagraph switch and https://github.com/flutter/engine/pull/27010
|
||||
// should be landed in SkParagraph after the switch is complete.
|
||||
assert(debugCheckHasMediaQuery(context));
|
||||
assert(debugCheckHasDirectionality(context));
|
||||
assert(
|
||||
|
||||
@@ -319,7 +319,7 @@ void main() {
|
||||
expect(selectableText.enableInteractiveSelection, true);
|
||||
});
|
||||
|
||||
testWidgets('Rich selectable text only support TextSpan', (WidgetTester tester) async {
|
||||
testWidgets('Rich selectable text supports WidgetSpan', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(),
|
||||
@@ -357,7 +357,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.takeException(), isAssertionError);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('no text keyboard when widget is focused', (WidgetTester tester) async {
|
||||
|
||||
Reference in New Issue
Block a user