Repository navigation
Textfield cursor height strange behaviour(gif) #64072
Copy link
Copy link
Closed
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 1.21Found to occur in 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Description
Relates to #61714
Steps to Reproduce
import 'package:flutter/material.dart';
class Pr61714CursorHeight extends StatefulWidget {
@override
_Pr61714CursorHeightState createState() => _Pr61714CursorHeightState();
}
class _Pr61714CursorHeightState extends State<Pr61714CursorHeight> {
double height = 5;
double width = 2;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Label unnecessarily elided'),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
cursorHeight: height,
cursorWidth: width,
),
),
Slider(
value: height,
min: 5,
max: 50.0,
divisions: 15,
activeColor: Colors.red,
inactiveColor: Colors.black,
label: '$height',
onChanged: (double newValue) {
setState(() {
height = newValue;
});
},
semanticFormatterCallback: (double newValue) {
return '$newValue';
},
),
Slider(
value: width,
min: 2,
max: 20.0,
divisions: 9,
activeColor: Colors.red,
inactiveColor: Colors.black,
label: '$width',
onChanged: (double newValue) {
setState(() {
width = newValue;
});
},
semanticFormatterCallback: (double newValue) {
return '$newValue';
},
),
],
),
);
}
}
Expected results:
Consistent behaviour while changing the cursor height on the fly
Actual results:
Cursor jumps and cropped. See the attached gif
Logs
Analyzing whatsup_flutter...
info • Unused import: 'package:whatsup_flutter/whats_up.dart' • lib/home_screen.dart:6:8 • unused_import
info • The value of the field '_search' isn't used • lib/home_screen.dart:14:10 • unused_field
info • The declaration '_handleSearchClear' isn't referenced • lib/home_screen.dart:28:8 • unused_element
info • Don't explicitly initialize variables to null • lib/text.dart:142:7 • avoid_init_to_null
[✓] Flutter (Channel master, 1.21.0-10.0.pre.139, on Mac OS X 10.15.4 19E287, locale en-UA)
• Flutter version 1.21.0-10.0.pre.139 at /Users/vasilich/IdeaProjects/flutter
• Framework revision a51dc3d913 (12 hours ago), 2020-08-18 02:51:02 -0400
• Engine revision 0b330467da
• Dart version 2.10.0 (build 2.10.0-38.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/vasilich/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/vasilich/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.6, Build version 11E708
• CocoaPods version 1.9.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio
• Android Studio at /Applications/Android Studio 4.1 Preview.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.47.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.11.0
[✓] Connected device (4 available)
• iPhone 11 Pro (mobile) • 34A1C1C6-659A-4332-A240-988ABC68E2FF • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E287
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 84.0.4147.125
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 1.21Found to occur in 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages

Activity
justinmc commentedon Aug 18, 2020
@vasilich6107 Thanks for opening this, I'm trying to reproduce it. Can you update your example so that it doesn't use the whatsup_flutter package?
vasilich6107 commentedon Aug 19, 2020
@justinmc - done.
Thanks for quick response.
guidezpl commentedon Aug 19, 2020
Reproed. I noticed that when you type a letter, the cursor adjusts back to the expected size, and stays correct
pedromassangocode commentedon Aug 19, 2020
I was able to reproduce this on latest
masterchannel.Worth noting that the size of the cursor only changes when the field is empty. Not sure if this is the expected behaviour when setting the
cursorHeightproperty and if it is then we probably may need to update the API docs of that property.flutter doctor -v
guidezpl commentedon Aug 19, 2020
Interesting, macOS and iOS applied cursor height when the field wasn't empty text, as expected.
pedromassangocode commentedon Aug 19, 2020
I didn’t noticed that at first. So we just found a new bug. @guidezpl do you think it is necessary to file a new issue? or we can track it here?
guidezpl commentedon Aug 19, 2020
We can track it here
rusticpow commentedon Sep 29, 2021
Still repro Flutter 2.5.1
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-arm, locale en-RU)
• Flutter version 2.5.1 at /Users/rzakirov/Sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ffb2ece (12 days ago), 2021-09-17 15:26:33 -0400
• Engine revision b3af521a05
• Dart version 2.14.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/rzakirov/Library/Android/sdk
✗ cmdline-tools component is missing
Run
path/to/sdkmanager --install "cmdline-tools;latest"See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run
flutter doctor --android-licensesto accept the SDK licenses.See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.10.1
[✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.60.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (2 available)
• R’s iPhone (mobile) • 00008030-00145506116B802E • ios • iOS 15.0 19A346
• macOS (desktop) • macos • darwin-arm64 • macOS 11.6 20G165 darwin-arm
! Doctor found issues in 1 category.
maheshj01 commentedon Dec 21, 2022
I wonder if this is still valid given that the Textfield loses focus (Cursor goes away) when interacting with other widgets. And when the textfield is focused back it shows the appropriate height.
The behavior is similar for Desktop
Screen.Recording.2022-12-20.at.7.12.14.PM.mov
flutter doctor -v (mac)
cc: @justinmc
guidezpl commentedon Mar 14, 2023
Fixed by #120834
github-actions commentedon Mar 28, 2023
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 -vand a minimal reproduction of the issue.