Skip to content

[Android] When setting a cursorHeight's value, the cursor position is too high #143480

@dmvvilela

Description

@dmvvilela

Steps to reproduce

  1. I made this TextFormField.. it uses cursor height, maybe has something to do with it:
TextFormField(
        controller: controller,
        onSaved: onSaved,
        textInputAction: TextInputAction.done,
        inputFormatters: formatter != null ? [formatter!] : null,
        keyboardType: numeric
            ? TextInputType.numberWithOptions(decimal: true)
            : TextInputType.text,
        cursorColor: AppTheme.darkLight,
        cursorHeight: 14,
        style: TextStyle(
          color: AppTheme.primaryColorDark,
          fontSize: 16,
        ),
        decoration: InputDecoration(
          labelText: label,
          labelStyle: context.textTheme.labelLarge!.copyWith(
            color: AppTheme.darkLight,
            fontWeight: FontWeight.w400,
          ),
          contentPadding: EdgeInsets.only(bottom: 2.5, top: 12),
          enabledBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Color(0x0D000000), width: 1.5),
          ),
          focusedBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Color(0x0D000000), width: 1.5),
          ),
          suffixText: suffixText,
          suffixStyle: context.textTheme.labelMedium!.copyWith(
            color: AppTheme.darkLight,
            fontWeight: FontWeight.w400,
            fontSize: 13,
          ),
          hintText: hintText,
          hintStyle: TextStyle(color: Colors.grey, fontSize: 12),
        ),
        validator: validator,
        onTapOutside: (_) => context.scopeUnfocus(),
      ),
  1. Use it on a samsung Galaxy s22 device..

Expected results

Captura de Tela 2024-02-14 às 16 39 19

Actual results

Captura de Tela 2024-02-14 às 16 39 57

Code sample

Code sample
TextFormField(
        controller: controller,
        onSaved: onSaved,
        textInputAction: TextInputAction.done,
        inputFormatters: formatter != null ? [formatter!] : null,
        keyboardType: numeric
            ? TextInputType.numberWithOptions(decimal: true)
            : TextInputType.text,
        cursorColor: AppTheme.darkLight,
        cursorHeight: 14,
        style: TextStyle(
          color: AppTheme.primaryColorDark,
          fontSize: 16,
        ),
        decoration: InputDecoration(
          labelText: label,
          labelStyle: context.textTheme.labelLarge!.copyWith(
            color: AppTheme.darkLight,
            fontWeight: FontWeight.w400,
          ),
          contentPadding: EdgeInsets.only(bottom: 2.5, top: 12),
          enabledBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Color(0x0D000000), width: 1.5),
          ),
          focusedBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Color(0x0D000000), width: 1.5),
          ),
          suffixText: suffixText,
          suffixStyle: context.textTheme.labelMedium!.copyWith(
            color: AppTheme.darkLight,
            fontWeight: FontWeight.w400,
            fontSize: 13,
          ),
          hintText: hintText,
          hintStyle: TextStyle(color: Colors.grey, fontSize: 12),
        ),
        validator: validator,
        onTapOutside: (_) => context.scopeUnfocus(),
      );

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.2.1 23C71 darwin-arm64, locale pt-BR)
    • Flutter version 3.16.9 on channel stable at /Users/danvilela/Code/Misc/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (3 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/danvilela/Library/Android/sdk
    • Platform android-34, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

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

[✓] Android Studio (version 2023.1)
    • 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 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.86.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (4 available)
    • Daniel's iPhone 13 Pro (mobile) • 00008110-001A11283E38801E            • ios            • iOS 17.2.1 21C66
    • iPhone 15 Pro (mobile)          • C1C8AB6F-F631-4AF4-B90E-2D72CCE36136 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.2.1 23C71
      darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome
      121.0.6167.160

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions