Skip to content

Undo/Redo history disappears on Japanese keyboard #130881

@toshiaki-h

Description

@toshiaki-h

Is there an existing issue for this?

Steps to reproduce

  1. Type 2022 on Japanese keyboard.
  2. Tap the Undo button
  3. You can see that the Redo button cannot be tapped.

Expected results

Undo/Redo works correctly when using a Japanese keyboard.
In this case, Redo can be tapped.

Actual results

The Redo button is enabled for a moment, but becomes disable immediately.

Code sample

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Undo/Redo Test',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Undo/Redo Test'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  late final _undoController = UndoHistoryController();

  late final _editingController = TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    _undoController.dispose();
    _editingController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
          child: Column(children: [
            TextField(
              controller: _editingController,
              undoController: _undoController,
            ),
            ValueListenableBuilder(
              valueListenable: _undoController,
              builder: (context, value, child) {
                return Row(
                  children: [
                    IconButton(
                      icon: const Icon(Icons.undo),
                      onPressed: value.canUndo ? _undoController.undo : null,
                    ),
                    IconButton(
                      icon: const Icon(Icons.redo),
                      onPressed: value.canRedo ? _undoController.redo : null,
                    ),
                  ],
                );
              },
            )
          ]),
        ));
  }
}

Screenshots or Video

Screenshots / Video demonstration
screen-20230719-211736.2.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-x64, locale ja-JP)
    • Flutter version 3.10.6 on channel stable at /Users/aki/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (7 days ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/aki/Library/Android/sdk
    • Platform android-33, 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.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.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.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)

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

[✓] Connected device (3 available)
    • Pixel 7 (mobile) • adb-29151FDH200FTQ-ysEEH4._adb-tls-connect._tcp. • android-arm64  • Android 13 (API 33)
    • macOS (desktop)  • macos                                            • darwin-x64     • macOS 13.4.1 22F770820d darwin-x64
    • Chrome (web)     • chrome                                           • web-javascript • Google Chrome 114.0.5735.198

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

• No issues found!

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsfound in release: 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13frameworkflutter/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-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions