Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField Cursor does not display on iPad in some cases #141546

Closed
zhouzhuo810 opened this issue Jan 15, 2024 · 8 comments
Closed

TextField Cursor does not display on iPad in some cases #141546

zhouzhuo810 opened this issue Jan 15, 2024 · 8 comments
Labels
r: duplicate Issue is closed as a duplicate of an existing issue

Comments

@zhouzhuo810
Copy link

zhouzhuo810 commented Jan 15, 2024

Steps to reproduce

Device:iPad 9
System:iPadOS 15.1

  1. Create a demo
  2. Create a TextFiled
  3. Click TextFiled, type anything, and close the keyboard immediately
  4. Tap TextFiled immediately

Expected results

Appear cursor

Actual results

The keyboard pops up, but the cursor is not displayed and the input content is not responsive.

Code sample

Code sample
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 MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.

    return Scaffold(
      appBar: AppBar(
        // TRY THIS: Try changing the color here to a specific color (to
        // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
        // change color while the other colors stay the same.
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Column(
        // Column is also a layout widget. It takes a list of children and
        // arranges them vertically. By default, it sizes itself to fit its
        // children horizontally, and tries to be as tall as its parent.
        //
        // Column has various properties to control how it sizes itself and
        // how it positions its children. Here we use mainAxisAlignment to
        // center the children vertically; the main axis here is the vertical
        // axis because Columns are vertical (the cross axis would be
        // horizontal).
        //
        // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
        // action in the IDE, or press "p" in the console), to see the
        // wireframe for each widget.
        children: <Widget>[
          TextField(),
          const Text(
            'You have pushed the button this many times:',
          ),
          Text(
            '$_counter',
            style: Theme.of(context).textTheme.headlineMedium,
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x283164f50 'assistantView.bottom' TUISystemInputAssistantView:0x1020d8e80.bottom == _UIKBCompatInputView:0x1020fc960.top   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2024-01-15 11:02:36.100671+0800 Runner[2833:659940] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x283159090 'assistantHeight' TUISystemInputAssistantView:0x1020d8e80.height == 55   (active)>",
    "<NSLayoutConstraint:0x28314b110 'assistantView.bottom' TUISystemInputAssistantView:0x1020d8e80.bottom == _UIKBCompatInputView:0x1020fc960.top   (active)>",
    "<NSLayoutConstraint:0x283149040 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x1020d8e80]   (active, names: '|':UIInputSetHostView:0x120484170 )>",
    "<NSLayoutConstraint:0x2831690e0 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x1020fc960]   (active, names: '|':UIInputSetHostView:0x120484170 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x28314b110 'assistantView.bottom' TUISystemInputAssistantView:0x1020d8e80.bottom == _UIKBCompatInputView:0x1020fc960.top   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.16.5, on macOS 14.0 23A344 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.16.5 on channel stable at /Users/zhouzhuo810/flutter/flutter
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.17.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/zhouzhuo810/flutter/flutter. Consider adding /Users/zhouzhuo810/flutter/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (4 weeks ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/zhouzhuo810/Library/Android/sdk
    • Platform android-34, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio 4.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • 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.14.3

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

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio 2.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.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio 4.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.6+0-17.0.6b829.9-10027231)

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/zhouzhuo810/Documents/develop/as/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.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

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

[✓] Connected device (5 available)
    • 22101317C (mobile) • e02a721d0722              • android-arm64  • Android 13 (API 33)
    • 周卓的iPhone (mobile) • 00008110-0005449C3C87801E • ios            • iOS 17.1.2 21B101
    • iPad (mobile)      • 00008030-000E61862110C02E • ios            • iOS 15.1 19B74
    • macOS (desktop)    • macos                     • darwin-x64     • macOS 14.0 23A344 darwin-x64
    • Chrome (web)       • chrome                    • web-javascript • Google Chrome 117.0.5938.149

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

! Doctor found issues in 1 category.
Process finished with exit code 0
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Jan 15, 2024
@darshankawar darshankawar changed the title TextFiled Cursor does not display on iPad in some cases TextField Cursor does not display on iPad in some cases Jan 15, 2024
@darshankawar
Copy link
Member

Thanks for the report @zhouzhuo810
Is it occuring using physical ipad or with ipad simulator as well ?

3. Click TextFiled, type anything,

Does it occur while inputing English or any non-English characters ?

I tried on ipad simulator (ipad pro, 5th gen, iOS 15.2) but couldn't replicate the reported behavior.
Also, if you could provide a short video showing the reported behavior, would be useful further.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 15, 2024
@zhouzhuo810
Copy link
Author

RPReplay_Final1705393121.MP4

OK,this is the short video

Although I couldn't see it on screen recording, I kept clicking on the text area of the input box without any response。

And I have noticed that this issue only occurs when running in Xcode debug mode, and after modifying the Build Configuration to release, it will not occur.

This is my Xcode version.

image

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 16, 2024
@zhouzhuo810
Copy link
Author

Sorry, I made a mistake. It can also be reproduced in release mode

@zhouzhuo810
Copy link
Author

copy_911DCED4-94EF-4FEF-8EEF-933683F3A7BD.MOV

I recorded another video on my phone

@darshankawar
Copy link
Member

Thanks for the update @zhouzhuo810
Can you check if your issue is similar to #138395 ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 17, 2024
@zhouzhuo810
Copy link
Author

Thanks for the update @zhouzhuo810 Can you check if your issue is similar to #138395 ?

Maybe it is the same issue,but my language is Chinese。

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 17, 2024
@darshankawar
Copy link
Member

I think once the linked issue is fixed, you can re-run your scenario and confirm if it fixes your case or not. The fix most probably won't be language specific.
I'll close this issue in favor of the linked one and you can follow-up in it for further updates. You may also share your findings in that issue for tracking. If you disagree, write in comments and I'll reopen it.

@darshankawar darshankawar closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
@darshankawar darshankawar added r: duplicate Issue is closed as a duplicate of an existing issue and removed in triage Presently being triaged by the triage team labels Jan 17, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: duplicate Issue is closed as a duplicate of an existing issue
Projects
None yet
Development

No branches or pull requests

2 participants