flutter-masked-text icon indicating copy to clipboard operation
flutter-masked-text copied to clipboard

Blocked input on Samsung devices

Open flaviup opened this issue 5 years ago • 9 comments

The code below blocks input on Samsung phones:

final mmTextController = MoneyMaskedTextController( decimalSeparator: DecimalSeparator, thousandSeparator: ThousandSeparator, precision: precision, ); mmTextController.afterChange = (String maskedValue, double rawValue) { // the line below blocks any further input on Samsung phones mmTextController.selection = TextSelection.collapsed(offset: mmTextController.text.length); };

flaviup avatar Feb 03 '20 03:02 flaviup

Hey! I have a similar problem. :(

Only in Samsung devices, when trying update the mask, keyboard freezes

I did a example.


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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  MaskedTextController _controller;

  @override
  void initState() {
    _controller = MaskedTextController(mask: "(00) 0000-0000", text: "");
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
              keyboardType: TextInputType.number,
              controller: _controller,
              onChanged: (newValue) {
                if (newValue.length >= 15) {
                  _controller.updateMask("(00) 00000-0000");
                } else {
                  _controller.updateMask("(00) 0000-0000");
                }
                _controller.updateText(newValue);
              },
            ),
          ],
        ),
      ),
    );
  }
}

Flutter Dotcor

[√] Flutter (Channel beta, v1.13.6, on Microsoft Windows [versão 10.0.18362.592], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[√] Chrome - develop for the web
[√] Android Studio (version 3.4)
[√] VS Code (version 1.42.0)
[√] Connected device (3 available)

• No issues found!

Giuliano-Stravini avatar Feb 13 '20 17:02 Giuliano-Stravini

Maybe this issue have associate with this https://github.com/flutter/flutter/issues/42273

Giuliano-Stravini avatar Feb 14 '20 15:02 Giuliano-Stravini

I found this issue on Flutter Github.

@flaviup try change to master channel, maybe resolve your problem

Giuliano-Stravini avatar Feb 14 '20 19:02 Giuliano-Stravini

@Giuliano-Stravini hi, I have the same problem (on Samsung Note 8). I'm using Flutter Channel stable, v1.17.0

If I use TextFormField without MoneyMaskedTextController, it will be okay. How can MoneyMaskedTextController cause the lagging? Do you know?

Have you fixed your problem yet?

QkLahpita avatar Jun 25 '20 09:06 QkLahpita

Hi @QkLahpita,

Unfortunately, not yet

Giuliano-Stravini avatar Jun 25 '20 20:06 Giuliano-Stravini

This issue has been resolved?

machadoguilhermebr avatar Jul 14 '20 20:07 machadoguilhermebr

Same problem here. Any updates?

zeucxb avatar Jul 29 '20 23:07 zeucxb

same problem, delay in samsung devices.

rodrigorafaeldamaceno avatar Aug 20 '20 19:08 rodrigorafaeldamaceno

same here, delay input in samsung devices's keyboard

vcnt1 avatar Sep 04 '20 16:09 vcnt1