From 0a06644c38bf4f812c932b646db4f01d8cf79e37 Mon Sep 17 00:00:00 2001 From: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Date: Wed, 6 Jul 2022 16:19:09 -0700 Subject: [PATCH] Clarify that inputFormatters don't run on programmatical changes (#106904) --- packages/flutter/lib/src/painting/text_style.dart | 2 +- .../flutter/lib/src/widgets/editable_text.dart | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index d41b5d6f69..862e87268c 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -504,7 +504,7 @@ class TextStyle with Diagnosticable { /// style (e.g., in a [TextSpan] tree). /// /// If this is false, properties that don't have explicit values will revert - /// to the defaults: white in color, a font size of 10 pixels, in a sans-serif + /// to the defaults: white in color, a font size of 14 pixels, in a sans-serif /// font face. final bool inherit; diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index bab60e6a7d..f2302e2f2b 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -1070,6 +1070,8 @@ class EditableText extends StatefulWidget { /// runs and can validate and change ("format") the input value. /// * [onEditingComplete], [onSubmitted], [onSelectionChanged]: /// which are more specialized input change notifications. + /// * [TextEditingController], which implements the [Listenable] interface + /// and notifies its listeners on [TextEditingValue] changes. final ValueChanged? onChanged; /// {@template flutter.widgets.editableText.onEditingComplete} @@ -1133,9 +1135,16 @@ class EditableText extends StatefulWidget { /// {@template flutter.widgets.editableText.inputFormatters} /// Optional input validation and formatting overrides. /// - /// Formatters are run in the provided order when the text input changes. When - /// this parameter changes, the new formatters will not be applied until the - /// next time the user inserts or deletes text. + /// Formatters are run in the provided order when the user changes the text + /// this widget contains. When this parameter changes, the new formatters will + /// not be applied until the next time the user inserts or deletes text. + /// Similar to the [onChanged] callback, formatters don't run when the text is + /// changed programmatically via [controller]. + /// + /// See also: + /// + /// * [TextEditingController], which implements the [Listenable] interface + /// and notifies its listeners on [TextEditingValue] changes. /// {@endtemplate} final List? inputFormatters;