Skip to content

Textfield cursor height strange behaviour(gif) #64072

@vasilich6107

Description

@vasilich6107

Relates to #61714

@guidezpl @justinmc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions