Docs on iOS's directional quote characters (#132869)

When you type a single or double quote character on the default iOS keyboard, it doesn't actually insert the usual `'` or `"`.  Instead, it inserts a directional version that tries to match with others.  This is very tricky when allow/deny-listing characters, so I've added a section about this to the docs.

Fixes https://github.com/flutter/flutter/issues/132232
This commit is contained in:
Justin McCandless 2023-08-21 12:02:33 -07:00 committed by GitHub
parent 0c78dce529
commit 8e95ee2e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,6 +251,14 @@ class _TextEditingValueAccumulator {
/// As an example, [FilteringTextInputFormatter] typically shouldn't be used /// As an example, [FilteringTextInputFormatter] typically shouldn't be used
/// with [RegExp]s that contain positional matchers (`^` or `$`) since these /// with [RegExp]s that contain positional matchers (`^` or `$`) since these
/// patterns are usually meant for matching the whole string. /// patterns are usually meant for matching the whole string.
///
/// ### Quote characters on iOS
///
/// When filtering single (`'`) or double (`"`) quote characters, be aware that
/// the default iOS keyboard actually inserts special directional versions of
/// these characters (`` and `` for single quote, and `` and `` for double
/// quote). Consider including all three variants in your regular expressions to
/// support iOS.
class FilteringTextInputFormatter extends TextInputFormatter { class FilteringTextInputFormatter extends TextInputFormatter {
/// Creates a formatter that replaces banned patterns with the given /// Creates a formatter that replaces banned patterns with the given
/// [replacementString]. /// [replacementString].