Unverified Commit 120a1fc4 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "Fix text field selection toolbar under Opacity (#31097)" (#31800)

parent e427c2dd
...@@ -1282,13 +1282,6 @@ class OpacityLayer extends ContainerLayer { ...@@ -1282,13 +1282,6 @@ class OpacityLayer extends ContainerLayer {
} }
} }
@override
void applyTransform(Layer child, Matrix4 transform) {
assert(child != null);
assert(transform != null);
transform.translate(offset.dx, offset.dy);
}
@override @override
ui.EngineLayer addToScene(ui.SceneBuilder builder, [ Offset layerOffset = Offset.zero ]) { ui.EngineLayer addToScene(ui.SceneBuilder builder, [ Offset layerOffset = Offset.zero ]) {
bool enabled = firstChild != null; // don't add this layer if there's no child bool enabled = firstChild != null; // don't add this layer if there's no child
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui show window; import 'dart:ui' as ui show window;
...@@ -381,58 +380,6 @@ void main() { ...@@ -381,58 +380,6 @@ void main() {
expect(textField.cursorRadius, const Radius.circular(3.0)); expect(textField.cursorRadius, const Radius.circular(3.0));
}); });
testWidgets('text field selection toolbar renders correctly inside opacity', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: Container(
width: 100,
height: 100,
child: const Opacity(
opacity: 0.5,
child: TextField(
decoration: InputDecoration(hintText: 'Placeholder'),
),
),
),
),
),
),
);
await tester.showKeyboard(find.byType(TextField));
const String testValue = 'A B C';
tester.testTextInput.updateEditingValue(
const TextEditingValue(
text: testValue
)
);
await tester.pump();
// The selectWordsInRange with SelectionChangedCause.tap seems to be needed to show the toolbar.
// (This is true even if we provide selection parameter to the TextEditingValue above.)
final EditableTextState state = tester.state<EditableTextState>(find.byType(EditableText));
state.renderEditable.selectWordsInRange(from: const Offset(0, 0), cause: SelectionChangedCause.tap);
expect(state.showToolbar(), true);
// This is needed for the AnimatedOpacity to turn from 0 to 1 so the toolbar is visible.
await tester.pump();
await tester.pump(const Duration(seconds: 1));
// Sanity check that the toolbar widget exists.
expect(find.text('PASTE'), findsOneWidget);
await expectLater(
// The toolbar exists in the Overlay above the MaterialApp.
find.byType(Overlay),
matchesGoldenFile('text_field_opacity_test.0.0.png'),
skip: !Platform.isLinux,
);
});
// TODO(hansmuller): restore these tests after the fix for #24876 has landed. // TODO(hansmuller): restore these tests after the fix for #24876 has landed.
/* /*
testWidgets('cursor layout has correct width', (WidgetTester tester) async { testWidgets('cursor layout has correct width', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment