MoneyFormatter ist eine Flutter-Erweiterung zum Formatieren verschiedener Währungen nach Ihren gewünschten Eigenschaften, ohne an eine bestimmte Lokalisierung gebunden zu sein.
Aus öffentlichen Paketdaten erstellte Orientierung.
MoneyFormatter ist ein Flutter-Paket, das flexible und anpassbare Währungsformatierung über mehrere Plattformen hinweg ermöglicht. Es ermöglicht Entwicklern, Zahlen als Geldbeträge mit Unterstützung für verschiedene Währungssymbole, Dezimalstellen, Trennzeichen sowie Präfixe/Suffixe zu formatieren, ohne sich auf Lokalisierung zu stützen. Ideal für Apps, die dynamische oder nicht-standardmäßige Geldanzeigefunktionen erfordern, bietet es präzise Kontrolle über das Erscheinungsbild, während Leistung und plattformübergreifende Konsistenz gewahrt bleiben.
Anwendungsfälle
E-Commerce-Preisdarstellung
Finanz-App-Transaktionsformatierung
Benutzerdefinierte Währungssymbolverarbeitung
Dynamische Preise in Multi-Region-Anwendungen
Benutzereingabeformatierung mit Masken
Echtzeit-Währungsumrechnungs-Vorschau
Hauptmerkmale
Anpassbare Währungssymbole
Konfigurierbare Dezimalstellen und Trennzeichen
Unterstützung für Präfixe und Suffixe
Keine Abhängigkeit von Lokalisierung
Plattformübergreifende Kompatibilität
Einfache Integration mit Textfeldern
Geeignet für
Entwickler, die eine flexible Geldformatierung benötigen
Apps mit nicht standardmäßigen Währungsformaten
Mehrräumige Finanzanwendungen
UI-Komponenten, die eine Echtzeit-Zahlenformatierung erfordern
Projekte, die eingebaute Lokalisierungsbeschränkungen vermeiden
Hinweise
Behandelt standardmäßig keine lokalspezifische Formatierung
Benötigt manuelle Konfiguration für jede Währung
Möglicherweise sind zusätzliche Überprüfungen für Benutzereingaben erforderlich
Nicht für häufige Aktualisierungen optimiert
Eingeschränkte integrierte Währungsliste über grundlegende Einstellungen hinaus
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
money_formatter
MoneyFormatter is a Flutter package to formatting various types of currencies according to the characteristics you like, without having to be tied to any localization.
Dependencies :
Screenshot
Install
For complete steps in installing MoneyFormatter you can see in the Installation Guide.
Of course you are not required to initialize the entire configuration in the settings (MoneyFormatterSettings) parameter as in the example above. You can change one or more of the configurations above. This is because each configuration above is not mandatory and has a default value.
You can change the type of compact format like for million using M or million, or trillion using T or trillion. and so on. This type only supports two type as described below:
Value
Description
CompactFormatType.short
Used to make the compact format displayed using short text.
CompactFormatType.long
Used to make the compact format displayed using long text.
MoneyFormatterOutput
You can use formats that match your needs through properties found in the MoneyFormatterOutput instance.
Property Names
Data Type
Descriptions
nonSymbol
String
The results of the format of the currency are normal and without a currency symbol. Example: 12,345,678.90
symbolOnLeft
String
The results of the normal currency format and with currency symbols are on the left. Example: $ 12,345,678.90
symbolOnRight
String
The results of the normal currency format and with currency symbols are on the right. Example: 12,345,678.90 $
compactNonSymbol
String
The results of the currency format are compact and without a currency symbol. Example: 12.3M
compactSymbolOnLeft
String
The results of the currency format are compact and with currency symbols on the left. example: $ 12.3M
compactSymbolOnRight
String
The results of the currency format are compact and with currency symbols on the right. example: 12.3M $
fractionDigitsOnly
String
Only give the fraction value. Example: 90
withoutFractionDigits
String
Give a value without fractions. Example: 12,345,678
MoneyFormatterCompare
Method
Parameter
Descriptions
isLowerThan
amount
Check current instance-amount is lower than [amount] or not.
isGreaterThan
amount
Check current instance-amount is greater than [amount] or not.
isEqual
amount
Check current instance amount is equal than [amount] or not.
isEqualOrLowerThan
amount
Check current instance amount is equal or lower than [amount] or not.
isEqualOrGreaterThan
amount
Check current instance amount is equal or greater than [amount] or not.
fastCalc is a function that can be used to perform various fast calculation processes that you might need. In implementing it, the fastCalc function gives the output of a MoneyFormatter instance so you can perform several calculation functions at once with the chaining method.
The type parameter used by the fastCalc function has the FastCalcType data type which is an enum. The following table is an explanation for the FastCalcType enum:
Index
Name
Description
0
addition
Used to do addition calculations.
1
substraction
Used to do substraction calculations.
2
multiplication
Used to do multiplication calculations.
3
division
Used to do division calculations.
4
percentageAddition
Used to do the addition calculations base on percentage.
5
percentageSubstraction
Used to do the substraction calculations base on percentage.
Duplicating Instance
For some reasons, you may need to duplicate the instance and just need to change some configurations. To do that, you can use the copyWith method as below: