Skip to content

FilteringTextInputFormatter.allow can't handle ' char #132232

@oscarceretti

Description

@oscarceretti

Is there an existing issue for this?

Steps to reproduce

  1. tap on textfield
  2. type ' char on keyboard

Expected results

  1. typing ' char on keyboard
  2. appear ' char on textfield

Actual results

  1. typing ' char on keyboard
  2. switch alphabetic keyboard
  3. texfield don't accept 'char

Code sample

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Text Input Formatter Test')),
        body: Center(child: TextInputWidget()),
      ),
    );
  }
}

class TextInputWidget extends StatelessWidget {
  final _textInputController = TextEditingController();
  final _textInputFormatter = FilteringTextInputFormatter.allow(RegExp(r"^[a-zA-Z\u00C0-\u017F'\s\-]+"));

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(16.0),
      child: TextField(
        controller: _textInputController,
        inputFormatters: [_textInputFormatter],
        decoration: InputDecoration(
          labelText: 'Enter text',
          border: OutlineInputBorder(),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Registrazione.schermo.2023-08-09.alle.17.57.09.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.0 22A380 darwin-x64, locale
    it-IT)
    • Flutter version 3.10.1 on channel stable at
      /Users/particlesrl/Documents/SDK/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (3 months ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/particlesrl/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    • 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.12.1

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

[✓] Android Studio (version 2021.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.13+0-b1751.21-8125866)

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • 0654E878-A28D-45A2-8FBD-37DD6806DFC5 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64
      • macOS 13.0 22A380 darwin-x64
    • Chrome (web)           • chrome                               •
      web-javascript • Google Chrome 115.0.5790.170

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: 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-iosiOS 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