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

toCurrencyString() format negative amount incorrectly #113

Closed
yosemiteyss opened this issue Jan 4, 2023 · 0 comments
Closed

toCurrencyString() format negative amount incorrectly #113

yosemiteyss opened this issue Jan 4, 2023 · 0 comments

Comments

@yosemiteyss
Copy link

yosemiteyss commented Jan 4, 2023

When using toCurrencyString() to format negative amount, an extra separator is appended in front.

Version: ^2.10.0

Expected behavior:
Should produce -888.00 instead of -,888.00.

Example to reproduce:

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

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

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

  @override
  Widget build(BuildContext context) {
    final positiveString = toCurrencyString(
      '888',
      mantissaLength: 2,
    );
    final negativeString = toCurrencyString(
      '-888',
      mantissaLength: 2,
    );

    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        body: Center(
          child: Text('Positive: $positiveString\nNegative: $negativeString'),
        ),
      ),
    );
  }
}

Current Result:
Screenshot_1672805071

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

1 participant