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 text content disappears #90256

Open
changleibox opened this issue Sep 17, 2021 · 13 comments
Open

TextField text content disappears #90256

changleibox opened this issue Sep 17, 2021 · 13 comments
Assignees
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@changleibox
Copy link

changleibox commented Sep 17, 2021

This is the translated version of the original issue via google translate

Steps to Reproduce

  1. Set the keyboardType property to TextInputType.number.
  2. Enter any content, and then keep switching the keyboard display state
  3. After repeating several times, the content of TextField disappears

Expected results:

The content is always displayed unless the content is manually cleared

Actual results:

The TextField with keyboardType is set, and the content disappears when the keyboard display state is switched

Original Issue

Steps to Reproduce

  1. 设置keyboardType属性为TextInputType.number.
  2. 输入任何内容,然后不断切换键盘显示状态
  3. 重复几次以后,TextField内容消失

Expected results:
除非手动清除内容,否则一直显示内容

Actual results:
设置了keyboardType的TextField,切换键盘显示状态时,内容消失

Logs
[  +12 ms] executing: xcrun simctl launch 9D89D4DD-4B46-4A6F-999D-BABBB2808A98 com.grasp.ipad --enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-port=0
[ +187 ms] com.grasp.ipad: 21074
[        ] Waiting for observatory port to be available...
[ +790 ms] Observatory URL on device: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[   +6 ms] Caching compiled dill
[ +184 ms] Connecting to service protocol: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[ +118 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:58937/Z-nKVt2YqKc=/.
[ +362 ms] DDS is listening at http://127.0.0.1:58940/ZVRrXId79lA=/.
[  +44 ms] Successfully connected to service protocol: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[  +12 ms] DevFS: Creating new filesystem on the device (null)
[  +13 ms] DevFS: Created new filesystem on the device (file:///Users/changlei/Library/Developer/CoreSimulator/Devices/9D89D4DD-4B46-4A6F-999D-BABBB2808A98/data/Containers/Data/Application/3CD9FE15-F2D2-4662-88A2-854C45C0567A/tmp/ishop_padCvNM3K/ishop_pad/)
[   +1 ms] Updating assets
[ +170 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[   +5 ms] Syncing files to device iPad Pro (11-inch) (3rd generation)...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +5 ms] <- recompile package:ishop_pad/main.dart 96481e14-02de-4e10-93be-3b057ead7cd7
[        ] <- 96481e14-02de-4e10-93be-3b057ead7cd7
[   +5 ms] Bugly appId: 73b6284637
[ +294 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device iPad Pro (11-inch) (3rd generation)... (completed in 308ms)
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +1 ms] Connected to _flutterView/0x7fa48d849a20.
[   +2 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] Running with unsound null safety
[        ] For more information see https://dart.dev/null-safety/unsound-null-safety
[        ] An Observatory debugger and profiler on iPad Pro (11-inch) (3rd generation) is available at: http://127.0.0.1:58940/ZVRrXId79lA=/
[ +350 ms] DevTools activation throttled until 2021-09-18 01:03:53.976555.
Analyzing ishop_pad...                                                  
No issues found! (ran in 6.2s)
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.5.0 at /Users/changlei/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (9 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/changlei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/changlei/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 14.0.1+7)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.7759

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

[✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1
    • NO_PROXY contains 127.0.0.1
    • NO_PROXY contains localhost

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 9D89D4DD-4B46-4A6F-999D-BABBB2808A98 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 93.0.4577.82

• No issues found!
Example
class _Content extends StatefulWidget {
  @override
  __ContentState createState() => __ContentState();
}

class __ContentState extends State<_Content> {
  final _controller = TextEditingController(text: '1');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TextField设置了KeyboardType,在频繁切换键盘,文本内容消失'),
      ),
      body: ListView(
        padding: const EdgeInsets.all(10),
        children: [
          TextField(
            controller: _controller,
            decoration: InputDecoration(
              fillColor: Colors.white,
              filled: true,
              hintText: '请输入',
              contentPadding: const EdgeInsets.symmetric(
                horizontal: 15,
                vertical: 10,
              ),
              border: OutlineInputBorder(
                borderSide: BorderSide(
                  color: Theme.of(context).dividerColor,
                  width: 0,
                ),
              ),
            ),
            keyboardType: TextInputType.number,
          ),
        ],
      ),
    );
  }
}
@changleibox changleibox changed the title TextField设置了KeyboardType,在频繁切换键盘,文本内容消失 TextField设置了KeyboardType为TextInputType.number时,频繁切换键盘,文本内容消失 Sep 17, 2021
@maheshmnj maheshmnj added the in triage Presently being triaged by the triage team label Sep 17, 2021
@maheshmnj maheshmnj changed the title TextField设置了KeyboardType为TextInputType.number时,频繁切换键盘,文本内容消失 When the KeyboardType of TextField is set to TextInputType.number, the keyboard is frequently switched and the text content disappears Sep 17, 2021
@maheshmnj
Copy link
Member

@changleibox Thanks for filing the issue.

keep switching the keyboard display state

I am not sure I understand what you meant by this? I construed it as hiding and showing the keyboard if so I was not able to reproduce the issue and the text does not get disappeared.

Screen.Recording.2021-09-17.at.4.55.35.PM.mov
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.6 20G165 darwin-arm, locale en-GB)
    • Flutter version 2.5.0 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (9 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

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

[✓] Android Studio (version 4.2)
    • 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 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 60.1.4
    • Dart plugin version 212.5080.8

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

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 4367E72A-10EB-46BA-9E12-D89A8F0DA157 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-arm64   • macOS 11.6 20G165
      darwin-arm
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome
      93.0.4577.82

• No issues found!

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 17, 2021
@maheshmnj maheshmnj changed the title When the KeyboardType of TextField is set to TextInputType.number, the keyboard is frequently switched and the text content disappears TextField text content disappears Sep 17, 2021
@changleibox
Copy link
Author

changleibox commented Sep 18, 2021

你好,感谢你的回复,是我的回复没有表达清楚,不好意思,以下是我的复现代码:

Translated via google translate

Hello, thank you for your reply, my reply is not clear, sorry, the following is my recurring code:

Example
class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final _controller = TextEditingController(text: '1');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () {
        FocusScope.of(context).unfocus();
      },
      child: Scaffold(
        appBar: AppBar(
          title: const Text('TextField设置了KeyboardType,在频繁切换键盘,文本内容消失'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(10),
          children: [
            TextField(
              controller: _controller,
              decoration: InputDecoration(
                fillColor: Colors.white,
                filled: true,
                hintText: '请输入',
                contentPadding: const EdgeInsets.symmetric(
                  horizontal: 15,
                  vertical: 10,
                ),
                border: OutlineInputBorder(
                  borderSide: BorderSide(
                    color: Theme.of(context).dividerColor,
                    width: 0,
                  ),
                ),
              ),
              keyboardType: TextInputType.number,
            ),
          ],
        ),
      ),
    );
  }
}

@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 Sep 18, 2021
@changleibox
Copy link
Author

changleibox commented Sep 18, 2021

这是我的复现视频

Translated via google translate

This is my recurring video

2021-09-18.10.19.40.mov
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.6 20G165 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.5.0 at /Users/changlei/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (10 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/changlei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/changlei/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 14.0.1+7)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.7759

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

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 9D89D4DD-4B46-4A6F-999D-BABBB2808A98 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-x64     • macOS 11.6 20G165 darwin-x64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 93.0.4577.82

• No issues found!

@maheshmnj
Copy link
Member

Hi @changleibox thanks for the video, but I am not able to reproduce the issue on stable 2.5.0 or 2.5.1 could you please try upgrading to the latest stable 2.5.1 and see if it fixes the issue.

code sample
import 'package:flutter/material.dart';

// void main() => runApp(const MyApp());
void main() {
  runApp(MyApp());
}

final darkNotifier = ValueNotifier<bool>(false);

class MyApp extends StatelessWidget {
  MyApp({Key? key}) : super(key: key);
  TextEditingController username = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Flutter Demo', home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final _controller = TextEditingController(text: '1');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () {
        FocusScope.of(context).unfocus();
      },
      child: Scaffold(
        appBar: AppBar(
          title: const Text('TextField设置了KeyboardType,在频繁切换键盘,文本内容消失'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(10),
          children: [
            TextField(
              controller: _controller,
              decoration: InputDecoration(
                fillColor: Colors.white,
                filled: true,
                hintText: '请输入',
                contentPadding: const EdgeInsets.symmetric(
                  horizontal: 15,
                  vertical: 10,
                ),
                border: OutlineInputBorder(
                  borderSide: BorderSide(
                    color: Theme.of(context).dividerColor,
                    width: 0,
                  ),
                ),
              ),
              keyboardType: TextInputType.number,
            ),
          ],
        ),
      ),
    );
  }
}
Screen.Recording.2021-09-20.at.10.51.30.AM.mov
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-arm, locale en-GB)
    • Flutter version 2.5.1 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (2 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 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

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

[✓] Android Studio (version 4.2)
    • 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 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 60.1.4
    • Dart plugin version 212.5080.8

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

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 4367E72A-10EB-46BA-9E12-D89A8F0DA157 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-arm64   • macOS 11.6 20G165 darwin-arm
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 93.0.4577.82

• No issues found!

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 20, 2021
@neelansh-creatorstack
Copy link

In flutter 2.3 the list view ddidn't reload when soft keyboard opens. After upgarding to flutter 2.5.0. Opening soft keyboard forces the list view to rebuild.

@changleibox
Copy link
Author

changleibox commented Sep 22, 2021

Hi @changleibox thanks for the video, but I am not able to reproduce the issue on stable 2.5.0 or 2.5.1 could you please try upgrading to the latest stable 2.5.1 and see if it fixes the issue.

code sample
Screen.Recording.2021-09-20.at.10.51.30.AM.mov
flutter doctor -v

你好,感谢你的回复,我在flutter2.5.1无法复现此问题,看来是已经修复了,谢谢你

Edited

translated from Google translate

Hello, thank you for your reply, I cannot reproduce this problem in flutter 2.5.1, it seems that it has been fixed, thank you

@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 Sep 22, 2021
@maheshmnj
Copy link
Member

Hello, thank you for your reply, I cannot reproduce this problem in flutter 2.5.1, it seems that it has been fixed, thank you

@changleibox provided your last comment I feel its safe to close this issue, Closing as fixed in newer version if you disagree feel free to write in the comments and I will reopen it.

Thank you.

@maheshmnj
Copy link
Member

In flutter 2.3 the list view ddidn't reload when soft keyboard opens. After upgarding to flutter 2.5.0. Opening soft keyboard forces the list view to rebuild.

@neelansh-creatorstack, That seems to be a different issue, Please file a separate issue describing the exact steps with the output of flutter doctor -v , logs to reproduce the issue.

Thanks.

@maheshmnj maheshmnj added r: fixed Issue is closed as already fixed in a newer version and removed in triage Presently being triaged by the triage team labels Sep 22, 2021
@changleibox
Copy link
Author

changleibox commented Sep 24, 2021

您好,谢谢您的回复,我在flutter 2.5.1中无法重现这个问题,看来已经修复了,谢谢

@chanleibox提供了您的最后一条评论,我觉得关闭这个问题是安全的,如果您不同意,请在新版本中修复,请随时在评论中写下,我将重新打开它。

谢谢你。

@maheshmnj 你好,又要打扰你了,我又在flutter2.5.1上复现了这个问题,麻烦再帮忙看一下,谢谢

translated using google translate

@maheshmnj Hello, I’m going to disturb you again, I reproduced this problem on flutter 2.5.1, please help me take a look again, thank you

2021-09-18.10.19.40.mov
code sample
import 'package:flutter/material.dart';

// void main() => runApp(const MyApp());
void main() {
  runApp(MyApp());
}

final darkNotifier = ValueNotifier<bool>(false);

class MyApp extends StatelessWidget {
  MyApp({Key? key}) : super(key: key);
  TextEditingController username = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Flutter Demo', home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final _controller = TextEditingController(text: '1');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () {
        FocusScope.of(context).unfocus();
      },
      child: Scaffold(
        appBar: AppBar(
          title: const Text('TextField设置了KeyboardType,在频繁切换键盘,文本内容消失'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(10),
          children: [
            TextField(
              controller: _controller,
              decoration: InputDecoration(
                fillColor: Colors.white,
                filled: true,
                hintText: '请输入',
                contentPadding: const EdgeInsets.symmetric(
                  horizontal: 15,
                  vertical: 10,
                ),
                border: OutlineInputBorder(
                  borderSide: BorderSide(
                    color: Theme.of(context).dividerColor,
                    width: 0,
                  ),
                ),
              ),
              keyboardType: TextInputType.number,
            ),
          ],
        ),
      ),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.5.1 at /Users/changlei/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (7 days ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/changlei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/changlei/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 14.0.1+7)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.7759

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

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 34DDC767-BF9A-4B6D-8701-CDD0539C541F • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • macOS (desktop)                              • macos                                • darwin-x64     • macOS 11.6 20G165 darwin-x64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 93.0.4577.82

• No issues found!

@maheshmnj
Copy link
Member

@maheshmnj 你好,又要打扰你了,我又在flutter2.5.1上复现了这个问题,麻烦再帮忙看一下,谢谢

translated using google translate

@maheshmnj Hello, I’m going to disturb you again, I reproduced this problem on flutter 2.5.1, please help me take a look again, thank you

Reopening the issue for further investigation based on the above comment.

@maheshmnj maheshmnj reopened this Sep 24, 2021
@maheshmnj maheshmnj added in triage Presently being triaged by the triage team and removed r: fixed Issue is closed as already fixed in a newer version labels Sep 24, 2021
@maheshmnj
Copy link
Member

maheshmnj commented Sep 24, 2021

@changleibox could you please also verify on other devices as well to understand if this issue is device / OS-version specific.

Thanks

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 24, 2021
@changleibox
Copy link
Author

changleibox commented Sep 26, 2021

@maheshmnj 你好,我用iPhone 13 Pro Max - iOS 15.0模拟器,无法复现此问题,在iPad Pro (11-inch) 3rd generation - iOS 15.0模拟器上,可以百分百复现此问题。

Translated via Google translate

Hello @maheshmnj, I use iPhone 13 Pro Max-iOS 15.0 simulator, this problem cannot be reproduced. On iPad Pro (11-inch) 3rd generation-iOS 15.0 simulator, this problem can be reproduced 100%.

@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 Sep 26, 2021
@maheshmnj
Copy link
Member

@changleibox Thanks for verifying, I can't reproduce the issue so labeling this issue for further investigation from the team.

@maheshmnj maheshmnj removed the in triage Presently being triaged by the triage team label Sep 27, 2021
@maheshmnj maheshmnj added a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices framework flutter/packages/flutter repository. See also f: labels. passed first triage platform-ios iOS applications specifically labels Sep 27, 2021
@LongCatIsLooong LongCatIsLooong added the P2 Important issues not at the top of the work list label Sep 27, 2021
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
@Renzo-Olivares Renzo-Olivares added team-design Owned by Design Languages team triaged-design Triaged by Design Languages team and removed team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests

6 participants