-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#46603Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13frameworkflutter/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 onplatform-iosiOS applications specificallyiOS applications specificallyteam-designOwned by Design Languages teamOwned by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
1.Place two TextField components on the page.
2.Enter a number in the first TextField, switch to Chinese input method, and continue entering Chinese characters.
3.Switch focus to the second TextField.
Expected results
After switching the input method, I should be able to enter Chinese characters correctly, and the focus should switch to the next TextField without any errors.
Actual results
An error occurs when switching to the next TextField.
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(
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});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextField(),
TextField(),
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Screenshots or Video
Screenshots / Video demonstration
RPReplay_Final1689768974.MP4
Logs
Logs
======== Exception caught by services library ======================================================
The following assertion was thrown during method call TextInputClient.updateEditingStateWithTag:
Range end 17 is out of text of length 9
'package:flutter/src/services/text_input.dart':
Failed assertion: line 965 pos 12: 'range.end >= 0 && range.end <= text.length'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 TextEditingValue._textRangeIsValid (package:flutter/src/services/text_input.dart:965:12)
#3 new TextEditingValue.fromJSON (package:flutter/src/services/text_input.dart:790:12)
#4 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1811:68)
#5 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1746:20)
#6 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:547:55)
#7 MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:540:34)
#8 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:479:35)
#9 _invoke2 (dart:ui/hooks.dart:174:13)
#10 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:40:5)
#11 _Channel.push (dart:ui/channel_buffers.dart:130:31)
#12 ChannelBuffers.push (dart:ui/channel_buffers.dart:326:17)
#13 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:686:22)
#14 _dispatchPlatformMessage (dart:ui/hooks.dart:86:31)
(elided 2 frames from class _AssertionError)
call: MethodCall(TextInputClient.updateEditingStateWithTag, [0, {EditableText-859341985: {selectionBase: 9, composingExtent: 17, selectionAffinity: TextAffinity.downstream, text: jdofjckfn, selectionIsDirectional: false, selectionExtent: 9, composingBase: 8}}])
====================================================================================================Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 12.6 21G115 darwin-arm64, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version
33.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.74.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13frameworkflutter/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 onplatform-iosiOS applications specificallyiOS applications specificallyteam-designOwned by Design Languages teamOwned by Design Languages team