Code Monkey home page Code Monkey logo

fadhly-permata / flutter_money_formatter Goto Github PK

View Code? Open in Web Editor NEW
85.0 85.0 106.0 2.31 MB

"FlutterMoneyFormatter" is a Flutter extension to formatting various types of currencies according to the characteristics you like, without having to be tied to any localization.

Home Page: https://pub.dartlang.org/packages/flutter_money_formatter

License: Other

Java 3.63% Objective-C 4.36% Dart 88.45% Ruby 1.81% Shell 1.75%
compact flutter flutter-package formatter money money-formatter money-library money-package

flutter_money_formatter's People

Contributors

fadhly-permata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter_money_formatter's Issues

coflict

Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and every version of flutter_localizations from sdk depends on intl 0.16.0, flutter_money_formatter >=0.8.2 is incompatible with flutter_localizations from sdk.

Dependency conflict with intl v0.16.0

Describe the bug
Upon installing flutter money formatter, I'm receiving a dependency conflict with the intl package. Here is the error message:

Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and <project_name> depends on intl ^0.16.0, flutter_money_formatter >=0.8.2 is forbidden.

I have tried downgrading my version of intl, but then I get other dependency errors from packages in my project which depend on it.

To Reproduce
Steps to reproduce the behavior:

  1. Install intl v0.16.0
  2. Attempt to install flutter_money_formatter v0.8.3
  3. See error described above

Expected behavior
Ideally the package would install with intl v0.16.0 already installed.

Hopefully it's not me doing something wrong, if not would it be possible to update your package to work with the latest version of intl? Thank you.

How do I use it within a listView?

How do I use this package within a listView bearing in mind the index since I always have to instantiate the function with the amount inside initState?

output.withoutFractionDigits doesn't give the expected result

Describe the bug
FlutterMoneyFormatter(..).output.withoutFractionDigits doesn't give the expected result.

To Reproduce
Steps to reproduce the behavior:

  1. Declare FlutterMoneyFormatter( amount: 0, settings: MoneyFormatterSettings( thousandSeparator: '.', fractionDigits: 0)) as singleton
  2. Execute the formatter :
    moneyFormatter.copyWith( amount: double.parse("3435696689") ).output.withoutFractionDigits
  3. See the result

Expected behavior
The result should be 3.435.696.689

Actual behavior
Formatter returned 3

Library unusable on Dutch locale

When switching away from regular number format seen in English locale, to for example Dutch there is an issue with "flutter_money_formatter_base.dart" file that crashes when trying to parse a number that can't be parsed. Specific line that crashes is:

crashScreenshot

.format(num.parse(numerics));

To Reproduce
Steps to reproduce the behavior:

  1. Enter decimal value and switch to Dutch locale in Flutter app

Expected behavior
I expect that locale for decimal and thousands separator is respected, but I get crash.

Smartphone (please complete the following information):

  • any device Android or iOS. This is not phone specific.

Locale in formatter

Describe the bug
I had NumberFormatException, while using your lib on my Ukrainian locale.

Additional context
I was not able to push changes in any branch an make a PR, so I forked, but it have sense to make a PR and hold all stuff in one place. So please, give me a response, when and how I can contribute. Thanks

Update to Android V2 embedding

Describe the bug

The plugins `flutter_money_formatter` use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Incompatibility with flutter 1.12.13-hotfixes

when update flutter to 1.12.13-hotfixes I got this error:

Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and every version of flutter_localizations from sdk depends on intl 0.16.0, flutter_money_formatter >=0.8.2 is incompatible with flutter_localizations from sdk.

Flutter Money Formatter is not compatible with intl 0.16.1

Describe the bug
Running "flutter pub get" in fitway_crm...
Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and flutter_money_formatter <0.8.2 depends on intl ^0.15.7, every version of flutter_money_formatter requires intl ^0.15.7.

And because every version of flutter_localizations from sdk depends on intl 0.16.0, flutter_money_formatter is incompatible with flutter_localizations from sdk.

So, because fitway_crm depends on both flutter_localizations any from sdk and flutter_money_formatter any, version solving failed.
pub get failed (1; So, because fitway_crm depends on both flutter_localizations any from sdk and flutter_money_formatter any, version solving failed.)
Process finished with exit code 1

Add option to set significantDigits for compact format

Is your feature request related to a problem? Please describe.
Yes when we format this number: 1314731674000000 this turnout be 1,310T in web not 1,315T. After investigate this is because in web js have significantDigits in 3

Describe the solution you'd like
add option in settings for set this

Describe alternatives you've considered

Additional context
If u using intl in behind you can use this snipplets as inspiration:

var formatter = NumberFormat.compact(locale: "id_ID")
          ..significantDigits = 4;
String formatted = formatter.format(value);

Update intl

Please update the version of intl in pub to intl 0.16.1 or higher!

Cannot run with valid yaml

When I try to run flutter web app with flutter_money_formatter i get this error, if i delete flutter_money_formatter from pubspec.yaml file, it compiles

Launching lib/main.dart on Chrome in debug mode...
Unhandled exception:
NoSuchMethodError: The getter 'path' was called on null.
Receiver: null
Tried calling: path
�[38;5;244m#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)�[39;49m
�[38;5;248m#1      JavaScriptBundler.compile  (package:frontend_server/src/javascript_bundle.dart:150:65)�[39;49m
�[38;5;244m<asynchronous suspension>�[39;49m
�[38;5;248m#2      FrontendCompiler.writeJavascriptBundle  (package:frontend_server/frontend_server.dart:627:20)�[39;49m
�[38;5;244m<asynchronous suspension>�[39;49m
�[38;5;248m#3      FrontendCompiler.compile  (package:frontend_server/frontend_server.dart:533:15)�[39;49m
�[38;5;244m<asynchronous suspension>�[39;49m
�[38;5;248m#4      _FlutterFrontendCompiler.compile  (package:flutter_frontend_server/server.dart:40:22)�[39;49m
�[38;5;248m#5      listenAndCompile.<anonymous closure>  (package:frontend_server/frontend_server.dart:1164:26)�[39;49m
�[38;5;244m#6      _RootZone.runUnaryGuarded  (dart:async/zone.dart:1374:10)�[39;49m
�[38;5;244m#7      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)�[39;49m
�[38;5;244m#8      _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:266:7)�[39;49m
�[38;5;244m#9      _SinkTransformerStreamSubscription._add  (dart:async/stream_transformers.dart:70:11)�[39;49m
�[38;5;244m#10     _EventSinkWrapper.add  (dart:async/stream_transformers.dart:17:11)�[39;49m
�[38;5;244m#11     _StringAdapterSink.add  (dart:convert/string_conversion.dart:238:11)�[39;49m
�[38;5;244m#12     _LineSplitterSink._addLines  (dart:convert/line_splitter.dart:152:13)�[39;49m
�[38;5;244m#13     _LineSplitterSink.addSlice  (dart:convert/line_splitter.dart:127:5)�[39;49m
�[38;5;244m#14     StringConversionSinkMixin.add  (dart:convert/string_conversion.dart:165:5)�[39;49m
�[38;5;244m#15     _SinkTransformerStreamSubscription._handleData  (dart:async/stream_transformers.dart:122:24)�[39;49m
�[38;5;244m#16     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1374:10)�[39;49m

�[38;5;244m#17     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)�[39;49m
�[38;5;244m#18     _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:266:7)�[39;49m
�[38;5;244m#19     _SinkTransformerStreamSubscription._add  (dart:async/stream_transformers.dart:70:11)�[39;49m
�[38;5;244m#20     _EventSinkWrapper.add  (dart:async/stream_transformers.dart:17:11)�[39;49m

�[38;5;244m#21     _StringAdapterSink.add  (dart:convert/string_conversion.dart:238:11)�[39;49m
�[38;5;244m#22     _StringAdapterSink.addSlice  (dart:convert/string_conversion.dart:243:7)�[39;49m
�[38;5;244m#23     _Utf8ConversionSink.addSlice  (dart:convert/string_conversion.dart:315:20)�[39;49m
�[38;5;244m#24     _Utf8ConversionSink.add  (dart:convert/string_conversion.dart:308:5)�[39;49m
�[38;5;244m#25     _ConverterStreamEventSink.add  (dart:convert/chunked_conversion.dart:74:18)�[39;49m
�[38;5;244m#26     _SinkTransformerStreamSubscription._handleData  (dart:async/stream_transformers.dart:122:24)�[39;49m
�[38;5;244m#27     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1374:10)�[39;49m

�[38;5;244m#28     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)�[39;49m
�[38;5;244m#29     _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:266:7)�[39;49m

�[38;5;244m#30     _SyncStreamControllerDispatch._sendData  (dart:async/stream_controller.dart:779:19)�[39;49m
�[38;5;244m#31     _StreamController._add  (dart:async/stream_controller.dart:655:7)�[39;49m
�[38;5;244m#32     _StreamController.add  (dart:async/stream_controller.dart:597:5)�[39;49m
�[38;5;244m#33     _Socket._onData  (dart:io-patch/socket_patch.dart:1999:41)�[39;49m
�[38;5;244m#34     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1374:10)�[39;49m

�[38;5;244m#35     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)�[39;49m
�[38;5;244m#36     _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:266:7)�[39;49m

�[38;5;244m#37     _SyncStreamControllerDispatch._sendData  (dart:async/stream_controller.dart:779:19)�[39;49m
�[38;5;244m#38     _StreamController._add  (dart:async/stream_controller.dart:655:7)�[39;49m
�[38;5;244m#39     _StreamController.add  (dart:async/stream_controller.dart:597:5)�[39;49m
�[38;5;244m#40     new _RawSocket.<anonymous closure>  (dart:io-patch/socket_patch.dart:1544:33)�[39;49m

�[38;5;244m#41     _NativeSocket.issueReadEvent.issue  (dart:io-patch/socket_patch.dart:1036:14)�[39;49m
�[38;5;244m#42     _microtaskLoop  (dart:async/schedule_microtask.dart:43:21)�[39;49m
�[38;5;244m#43     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:52:5)�[39;49m
�[38;5;244m#44     _runPendingImmediateCallback  (dart:isolate-patch/isolate_patch.dart:118:13)�[39;49m
�[38;5;244m#45     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:169:5)�[39;49m

the Dart compiler exited unexpectedly.
Exited (sigterm)
Failed to compile application.

My pubspec.yaml

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  logger: ^0.9.1
  redux:
  redux_thunk:
  redux_persist: ^0.8.4
  redux_persist_web: ^0.8.2
  flutter_redux:
  http:
  web_socket_channel: ^1.1.0
  rxdart:
  shared_preferences: ^0.5.7+1
  universal_html: ^1.2.2
  flutter_screenutil: ^0.5.3
  intl: ^0.16.1
  flutter_money_formatter:
    git:
      url: git://github.com/anisalibegic/flutter_money_formatter.git
dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:

Flutter Doctor -v
[✓] Flutter (Channel beta, 1.18.0-11.1.pre, on Mac OS X 10.15.4 19E287, locale tr-TR)
• Flutter version 1.18.0-11.1.pre at /Users/ulaskasim/Documents/development/flutter
• Framework revision 2738a1148b (11 days ago), 2020-05-13 15:24:36 -0700
• Engine revision ef9215ceb2
• Dart version 2.9.0 (build 2.9.0-8.2.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/ulaskasim/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/ulaskasim/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.4

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

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.45.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.2

[✓] Connected device (2 available)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 81.0.4044.138

• No issues found!

Support intl 0.16.0

Overview
After I updated the project to the stable channel, I have started getting the following error:

Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and every version of flutter_localizations from sdk depends on intl 0.16.0, flutter_money_formatter >=0.8.2 is incompatible with flutter_localizations from sdk.

So, because bcmd_end_client_app_flutter depends on both flutter_localizations any from sdk and flutter_money_formatter ^0.8.3, version

Current version

Flutter (Channel master, v1.10.6-pre.39, on Mac OS X 10.14.5 18F132, locale en-NL)
    • Flutter version 1.10.6-pre.39 at /Users/denree/Projects/Others.../Flutter/flutter
    • Framework revision 4815b26d71 (3 hours ago), 2019-09-24 00:21:44 -0700
    • Engine revision 953ac71749
    • Dart version 2.6.0 (build 2.6.0-dev.0.0 d53d355c6c)

Decimal view

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

It would be greate if you could have a flag which sets the decimal part as superscript

Value not in range: -1

Describe the bug
Hello, I'm facing an issue when I try to execute this simple instruction

FlutterMoneyFormatter(amount: 15.0, settings: MoneyFormatterSettings(symbol: 'EUR'))

Result:

Value not in range: -1

Important note: This error does not occur on the emulator, it does only concern real devices (in my case, a S9+)

To Reproduce
Steps to reproduce the behavior:
Just execute the instruction above on a real device

Additional context
The error is thrown by the following code execution:

FlutterMoneyFormatter._getOutput (package:flutter_money_formatter/src/flutter_money_formatter_base.dart:91:18)

Note: I have of course added the 'intl: ^0.15.8' dependency

Is this package maintain?

Is this package still being maintain? There are 4 PR pending and its not working to the latest flutter because of this issue #23

FormatException thrown when I used Indonesia language as the app localisations

FormatException is thrown when I used Indonesia language as the Applocalizations in both iOS and Android. It was working fine if I set the device language to English but when I switch to Indonesia language I got this FormatException(2, 32).

To Reproduce
Steps to reproduce the behavior:

  1. Create flutter app localisations (in this case I use "en", and "id")
  2. Go to Settings in iOS device or Android device emulator
  3. Switch the language to Indonesia
  4. Start the app and you will see the format exception error.

Expected behavior
The money value should be formatted correctly regardless of the language.

Screenshots
Screen Shot 2019-08-18 at 10 46 13 am

Smartphone (please complete the following information):

  • Device: Android and iOS emulator

null safety

null safety in dart version 2.12.0 and publish to pub.dart lang , i want use this package in my project , but after i wanna release apk show me errors than - package:flutter_money_formatter does not null safety .

Rounding Value

Describe the bug
I get a problem with rounding value

To Reproduce
your sample :
FlutterMoneyFormatter fmf = FlutterMoneyFormatter(
amount: 12345678.9012345
);
and output with print(fo.compactNonSymbol); is 12.30M

My sample :
i change amount with 12355678.9012345 (change number four to five)
and output with print(fo.compactNonSymbol); is 12.40M

Expected behavior
My Expectation is 12.35

Screenshots

Screen Shot 2019-07-29 at 12 26 56

Smartphone (please complete the following information):

  • Device: [Xiaomi Redmi Note 5]
  • OS: [8.1]

Thanks!

Upgrade intl version to 0.16.0

Because flutter_money_formatter >=0.8.2 depends on intl ^0.15.8 and every version of flutter_localizations from sdk depends on intl 0.16.0, flutter_money_formatter >=0.8.2 is incompatible with flutter_localizations from sdk.
So, because onus depends on both flutter_localizations any from sdk and flutter_money_formatter ^0.8.3, version solving failed.

pub get failed (1; So, because onus depends on both flutter_localizations any from sdk and flutter_money_formatter ^0.8.3, version solving failed.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.