Unverified Commit 02d441ea authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Revert "TextField and last input character should visible on the screen when...

Revert "TextField and last input character should visible on the screen when the cursor is not shown (#74722)" (#75532)

This reverts commit cd771404.
parent 643e6598
......@@ -2708,7 +2708,6 @@ class _FloatingCursorPainter extends RenderEditablePainter {
caretRect = caretRect.shift(renderEditable._paintOffset);
final Rect integralRect = caretRect.shift(renderEditable._snapToPhysicalPixel(caretRect.topLeft));
if (shouldPaint) {
final Radius? radius = cursorRadius;
caretPaint.color = caretColor;
if (radius == null) {
......@@ -2717,13 +2716,13 @@ class _FloatingCursorPainter extends RenderEditablePainter {
final RRect caretRRect = RRect.fromRectAndRadius(integralRect, radius);
canvas.drawRRect(caretRRect, caretPaint);
}
}
caretPaintCallback(integralRect);
}
@override
void paint(Canvas canvas, Size size, RenderEditable renderEditable) {
// Compute the caret location even when `shouldPaint` is false.
if (!shouldPaint)
return;
assert(renderEditable != null);
final TextSelection? selection = renderEditable.selection;
......@@ -2748,7 +2747,7 @@ class _FloatingCursorPainter extends RenderEditablePainter {
final Color? floatingCursorColor = this.caretColor?.withOpacity(0.75);
// Floating Cursor.
if (floatingCursorRect == null || floatingCursorColor == null || !shouldPaint)
if (floatingCursorRect == null || floatingCursorColor == null)
return;
canvas.drawRRect(
......
......@@ -8573,51 +8573,6 @@ void main() {
expect(scrollController.offset, 48.0);
});
// Regression test for https://github.com/flutter/flutter/issues/74566
testWidgets('TextField and last input character are visible on the screen when the cursor is not shown', (WidgetTester tester) async {
final ScrollController scrollController = ScrollController();
final ScrollController textFieldScrollController = ScrollController();
await tester.pumpWidget(MaterialApp(
theme: ThemeData(),
home: Scaffold(
body: Center(
child: ListView(
controller: scrollController,
children: <Widget>[
Container(height: 579), // Push field almost off screen.
TextField(
scrollController: textFieldScrollController,
showCursor: false,
),
Container(height: 1000),
],
),
),
),
));
// Tap the TextField to bring it into view.
expect(scrollController.offset, 0.0);
await tester.tapAt(tester.getTopLeft(find.byType(TextField)));
await tester.pumpAndSettle();
// The ListView has scrolled to keep the TextField visible.
expect(scrollController.offset, 48.0);
expect(textFieldScrollController.offset, 0.0);
// After entering some long text, the last input character remains on the screen.
final String testValue = 'I love Flutter!' * 10;
tester.testTextInput.updateEditingValue(TextEditingValue(
text: testValue,
selection: TextSelection.collapsed(offset: testValue.length),
));
await tester.pump();
await tester.pumpAndSettle(); // Text scroll animation.
expect(textFieldScrollController.offset, 1602.0);
});
group('height', () {
testWidgets('By default, TextField is at least kMinInteractiveDimension high', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
......
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