currency_decoration 1.0.0 copy "currency_decoration: ^1.0.0" to clipboard
currency_decoration: ^1.0.0 copied to clipboard

outdated

A package to easily format money with custom UI. It support setting a custom currency symbol and format.

currency_decoration #

A package to easily format money with custom UI. It support setting a custom currency symbol and format.

Preview #

currency_decoration_2

Installation #

Add currency_decoration as a dependency in your pubspec.yaml file.

dependencies:
    currency_decoration: ^1.0.0

Usage #

// Example:
CurrencyDecoration(
    symbol: CurrencySymbol.USD,
    amount: 28945.6778,
    symbolSeparator: ' ',
    symbolAlign: SymbolAlign.left,
    fractionDigits: 2,
    currencyValuePlaceStyle: CurrencyValuePlaceStyle.style2,
    primaryTextStyle: const TextStyle(
        color: Colors.green,
        fontWeight: FontWeight.bold,
        fontSize: 18.0),
    secondaryTextStyle: TextStyle(
        color: Colors.green.shade800,
        fontWeight: FontWeight.bold,
        fontSize: 14.0),
    symbolTextStyle: const TextStyle(
      fontSize: 20.0,
      fontWeight: FontWeight.bold,
    ),
  )

compact #

CurrencyDecoration(
    symbol: CurrencySymbol.USD,
    amount: 134000,
    compact: true,
    currencyValuePlaceStyle: CurrencyValuePlaceStyle.style2,
    primaryTextStyle: TextStyle(
        color: Colors.deepOrangeAccent,
        fontWeight: FontWeight.bold,
        fontSize: 18.0),
  )

Output: $134K

Supported default currency symbol #

Link

Money format style #

International style #

CurrencyDecoration(
    symbol: CurrencySymbol.USD,
    amount: 134000,
    currencyValuePlaceStyle: CurrencyValuePlaceStyle.style1,
  )

Output: $134,000.00

Indian style #

CurrencyDecoration(
    symbol: CurrencySymbol.INR,
    amount: 134000,
    symbolSeparator: '',
    currencyValuePlaceStyle: CurrencyValuePlaceStyle.style2,
  )

Output: ₹1,34,000.00

Currency Symbol Align #

CurrencyDecoration(
    symbol: CurrencySymbol.USD,
    amount: 134000,
    fractionDigits: 0,
    symbolAlign: SymbolAlign.left,  // output: `$ 134,000`
 // symbolAlign: SymbolAlign.right, // output: `134,000 $`
    symbolSeparator: ' ',
    currencyValuePlaceStyle: CurrencyValuePlaceStyle.style1,
  )

Parameters #

Parameter Description
key Controls widget in the tree.
amount* decimal/integer value
symbol* currency symbol Link, also accept any String value like USD or INR etc.
symbolAlign Alignment of symbol defaultSymbolAlign.left
thousandSeparator Thousand separator. e.g. 1,000,000 (',') or 1.000.000 ('.'). It can be set to any desired [String].
decimalSeparator Decimal separator. e.g. 9.10 ('.') or 9,10 (','). It can be set to any desired [String].
symbolSeparator Character(s) between the amount and the currency symbol. e.g. $ 9.10 (' ') or $9.10 ('')
enforceDecimals If [enforceDecimals] is set to true, decimals will be shown even if it is an integer. e.g. '$ 5.00' instead of '$ 5'.
showThousandSeparator Thousand separator. e.g. 1,000,000 (',') or 1.000.000 ('.'). It can be set to any desired [String].
compact If [compact] is true the compact form will be used. e.g. '$ 1.23K' instead of '$ 1,230'.
primaryTextStyle Text style apply on whole units/value (e.g. 52470.596 then text style apply on 52470). if a primary style does not define then use DefaultTextStyle.of(context) as a default style
secondaryTextStyle Text style apply on fractional part (e.g. 52470.596 then text style apply on 596). if a secondary style does not define then use primaryTextStyle as default
symbolTextStyle Text style apply on currency Symbol. if symbol style does not define then use primaryTextStyle as default
currencyValuePlaceStyle Whole units/value comma style
fractionalStyle Style on fractional part/value
fractionDigits fractional value

Parameters marked with * are mandatory to give value.

MIT License #

Copyright (c) 2018 Anand Patel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9
likes
0
points
14
downloads

Documentation

Documentation

Publisher

unverified uploader

Weekly Downloads

A package to easily format money with custom UI. It support setting a custom currency symbol and format.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, intl

More

Packages that depend on currency_decoration