Cherrypick #75532 (#75546)

* Revert "Reland "Update PopupMenuButton to match Material Design spec" (#74620)"

This reverts commit 12016e4145022109e7ccf35fa4a7755771d75319.

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

This reverts commit cd771404e9da3606405c29e1c380684e449665c4.

Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart
index 075ce42..083b51f 100644
--- a/packages/flutter/lib/src/rendering/editable.dart
+++ b/packages/flutter/lib/src/rendering/editable.dart
@@ -2708,22 +2708,21 @@
     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) {
-        canvas.drawRect(integralRect, caretPaint);
-      } else {
-        final RRect caretRRect = RRect.fromRectAndRadius(integralRect, radius);
-        canvas.drawRRect(caretRRect, caretPaint);
-      }
+    final Radius? radius = cursorRadius;
+    caretPaint.color = caretColor;
+    if (radius == null) {
+      canvas.drawRect(integralRect, caretPaint);
+    } else {
+      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 @@
 
     final Color? floatingCursorColor = this.caretColor?.withOpacity(0.75);
     // Floating Cursor.
-    if (floatingCursorRect == null || floatingCursorColor == null || !shouldPaint)
+    if (floatingCursorRect == null || floatingCursorColor == null)
       return;
 
     canvas.drawRRect(
diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart
index 38b295c..bfa7b25 100644
--- a/packages/flutter/test/material/text_field_test.dart
+++ b/packages/flutter/test/material/text_field_test.dart
@@ -8574,51 +8574,6 @@
     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(