Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong cursor position after clearing text field when mantissaLength = 0 #97

Closed
yosemiteyss opened this issue Sep 25, 2022 · 3 comments
Closed

Comments

@yosemiteyss
Copy link

Hi, when all characters are cleared in the text field, the cursor is placed in front of the zero character. The next time the user inputs a new digit, the zero character is accidentally appended to the end.

Expected result: the zero character should be replaced by the new input digit.

Sep-25-2022.17-19-08.mp4
@yosemiteyss
Copy link
Author

Codes:

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      darkTheme: ThemeData.dark(),
      theme: ThemeData.light(),
      home: const MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter app'),
      ),
      body: Center(
        child: TextFormField(
          keyboardType: TextInputType.number,
          inputFormatters: [CurrencyInputFormatter(mantissaLength: 0)],
        ),
      ),
    );
  }
}

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

@caseyryan
Copy link
Owner

Hi! Thanks, I'll check that as soon as I can

caseyryan added a commit that referenced this issue Oct 20, 2022
@jale-codex
Copy link

This is not fixed in the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants