Skip to content

CupertinoTextFormFieldRow with placeholder causes unnecessary scrolling in CupertinoAlertDialog #174797

Description

@zamesilyasa
Screen.Recording.2025-09-01.at.16.48.29.mov

Steps to reproduce

CupertinoTextFormFieldRow with a non-null placeholder parameter causes the dialog content to become scrollable in CupertinoAlertDialog, even when there's sufficient space to display all content without scrolling.

STR:

  1. Create a CupertinoAlertDialog with a CupertinoTextFormFieldRow that has a non-null placeholder
  2. Observe that the dialog content becomes scrollable
  3. Remove the placeholder parameter (set to null)
  4. Observe that the dialog no longer scrolls

Expected results

The content is not scrollable and the placeholder is rendered correctly.

Actual results

The dialog content is scrollable in spite there's more than enough space

Code sample

Code sample
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter Demo',
      theme: CupertinoThemeData(),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) => CupertinoPageScaffold(
    child: SafeArea(
      child: Column(
        children: [
          CupertinoButton.filled(
            child: Text('With placeholder'),
            onPressed: () {
              showDialog(context, withPlaceholder: true);
            },
          ),
          CupertinoButton.filled(
            child: Text('With NO placeholder'),
            onPressed: () {
              showDialog(context, withPlaceholder: false);
            },
          ),
        ],
      ),
    ),
  );

  void showDialog(BuildContext context, {required bool withPlaceholder}) {
    showCupertinoDialog(
      barrierDismissible: true,
      context: context,
      builder: (BuildContext context) => AlertDialog.adaptive(

        title: Text('Dialog title'),
        content: Form(
          child: CupertinoTextFormFieldRow(
            placeholder: withPlaceholder ? 'Hello' : null,
          ),
        ),
        actions: [
          CupertinoButton(child: Text('Close1'), onPressed: () {
            Navigator.of(context).pop();
          }),
          CupertinoButton(child: Text('Close2'), onPressed: () {
            Navigator.of(context).pop();
          })
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
Any system/framework logs

Flutter Doctor output

Doctor output
~ > flutter doctor -v                
[✓] Flutter (Channel stable, 3.35.2, on macOS 15.6.1 24G90 darwin-arm64, locale en-US) [269ms]
    • Flutter version 3.35.2 on channel stable at /Users/ilias/Library/Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 05db968908 (7 days ago), 2025-08-25 10:21:35 -0700
    • Engine revision a8bfdfc394
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [934ms]
    • Android SDK at /Users/ilias/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/ilias/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [558ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [66ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [66ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] IntelliJ IDEA Community Edition (version 2025.1.4.1) [65ms]
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 86.0.2
    • Dart plugin version 251.27812.12

[✓] Connected device (5 available) [5.7s]
    • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android 16 (API 36) (emulator)
    • Ilias (wireless) (mobile)   • 00008110-000E04CE3E2B801E            • ios            • iOS 18.6.2 22G100
    • iPhone 16 Pro (mobile)      • 3545472A-F3CC-4D5E-80F2-558283517C27 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-4 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 139.0.7258.155

[✓] Network resources [854ms]
    • All expected network resources are available.

• No issues found!

https://github.com/user-attachments/assets/1979826d-deb1-46ee-8567-19c06fc48533

Activity

  1. zamesilyasa commented on Sep 2, 2025

    @zamesilyasa
    Author

    Wrapping the input into a SizedBox may fix the problem, I think it's not supposed to behave like this.

    child: SizedBox(
      height: MediaQuery.of(context).textScaler.scale(58),
      child: CupertinoTextFormFieldRow(
        controller: state.nameController,
        placeholder: 'Placeholder'
      ),
    ),
  2. darshankawar commented on Sep 2, 2025

    @darshankawar
    Member

    Thanks for the report. Seeing the same behavior as reported on latest sdk versions.

    stable : 3.35.2
    master : 3.36.0-1.0.pre-372
    
  3. added
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Sep 2, 2025
  4. manudicri commented on Sep 3, 2025

    @manudicri

    Same for me!

  5. added
    P2Important issues not at the top of the work list
    triaged-designTriaged by Design Languages team
    on Sep 3, 2025
  6. added
    r: fixedIssue is closed as already fixed in a newer version
    on Sep 4, 2025
  7. github-actions commented on Sep 18, 2025

    @github-actions

    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 -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.35Found to occur in 3.35found in release: 3.36Found to occur in 3.36frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions