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

The value is multiplied by 100 when a number is deleted #159

Closed
Tracked by #164
gokhancvs opened this issue May 31, 2024 · 3 comments
Closed
Tracked by #164

The value is multiplied by 100 when a number is deleted #159

gokhancvs opened this issue May 31, 2024 · 3 comments

Comments

@gokhancvs
Copy link

Hello,

There has been an issue in this package for a long time. When the entered value is being deleted, if the cursor is just to the right of the comma and we delete to move to the left side of the comma, the entered value is multiplied by 100. The value appears correctly in the text field, but the value that returns from onValueChange is multiplied by 100.

issue.mp4

Example code:

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

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String enteredValue = '';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(32),
          child: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                TextFormField(
                  autofocus: true,
                  textAlign: TextAlign.center,
                  inputFormatters: [
                    CurrencyInputFormatter(
                      onValueChange: (value) {
                        setState(() {
                          enteredValue = value.toStringAsFixed(2);
                        });
                      },
                    ),
                  ],
                ),
                const SizedBox(height: 16),
                Text('Entered Value: $enteredValue'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
@gokberkbar
Copy link

Hello, any updates about this?

@IguJl15
Copy link
Contributor

IguJl15 commented Jul 12, 2024

I'm using this package this week, and to support the small community around it, I will try to assist the original developer.
I believe I can assist with this issue next week.

I'll provide some feedback on it shortly. Keep me in touch if you found some workaround or found the whole solution

@gokberkbar
Copy link

@IguJl15 Hi, thank you for the support. I did not have time to deep dive the issue. If i can find time next week I will try to find solution too. Keep in touch 👋

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

4 participants