price_text 0.0.7 copy "price_text: ^0.0.7" to clipboard
price_text: ^0.0.7 copied to clipboard

Show prices in Flutter apps with currency symbols, codes, and flags.

dashstack_poster

Price Text – Flutter #

A customizable Price Text for Flutter apps.
Format and display prices in multiple currencies with flags, symbols, and localized formatting.


✨ Features #

✅ Supports multiple currencies (USD, EUR, GBP, INR, JPY, AUD, CAD, CNY, SGD, NZD, MXN, ZAR, TRY).
✅ Automatically formats numbers with proper separators and decimals.
✅ Localized currency formatting using intl.
✅ Display currency code, symbol, and even country flag.
✅ Supports custom text style and color logic (positive/negative/custom).
✅ Plug & Play → Simply using PriceText with any screen.


How to use it ? #

1. Add dependency #

Add this to your package's pubspec.yaml file:

dependencies:
  price_text: <latest_version>

2. Install it You can install packages from the command line: #

with pub :

$ pub get

with Flutter :

$ flutter pub get

3. Import it #

Now in your Dart code, you can use :

import 'package:price_text/price_Text.dart';

4. Use it #

Sample app demonstrates how simple the usage of the library actually is.

Using PriceText in your project is super simple.

You just need to add the widget with an amount and currency type, and it will handle formatting for you.

Basic usage #

Without any customization: #

📸 Example #

without Any Customization Adding with formatterPattern
without formatterPattern formatterPattern
 //Example usage of PriceText
  PriceText(
    currencyType: CurrencyType.USD, //for currency type to be displayed
    amount: 1000, //for amount to be displayed on screen using currency format
    formatterPattern:'#,##0.00', //custom pattern for formatting amount(showing like second image)
  ),

show flag : #

without Any Customization Adding with formatterPattern
without formatterPattern Screenshot_20250904-095056
 PriceText(
   currencyType: CurrencyType.USD, //for currency type to be displayed
    amount: 1000, //for amount to be displayed on screen using currency format
     showFlag: true, //to show flag of the country
     formatterPattern:'#,##0.00', //custom pattern for formatting amount(showing like second image)
  ),

show showCurrencyCode : #

without Any Customization Adding with formatterPattern
without formatterPattern Screenshot_20250904-095515
 PriceText(
   currencyType: CurrencyType.USD, //for currency type to be displayed
   amount: 1000, //for amount to be displayed on screen using currency format
   showFlag: true, //to show flag of the country
   showCurrencyCode: true, //to show currency code
 ),

customize with CurrencyCode Text and TextStyle : #

Screenshot_20250904-095939

PriceText(
  currencyType: CurrencyType.USD, //for currency type to be displayed
  amount: 1000, //for amount to be displayed on screen using currency format
  showFlag: true, //to show flag of the country
  showCurrencyCode: true, //to show currency code
  currencyCodeText: 'Us Dollar', //custom currency code text
  currencyCodeTextStyle: TextStyle(color: Colors.black, fontSize: 20,fontWeight: FontWeight.w600), //custom style for currency code text
),

customize with flagspacing and alignment(left-right) : #

Flag Left (default) Flag Right
flag_left flag_right
Flag Left (default) Flag Right
flag_right flag_left
PriceText(
  currencyType: CurrencyType.USD, //for currency type to be displayed
  amount: 1000, //for amount to be displayed on screen using currency format
  showFlag: true, //to show flag of the country
  showCurrencyCode: true, //to show currency code
  flagSpacing: 30,// to space betweenflag and currencyText
  flagAlignment: AlignmentOption.right,//to align flag left-right side
),

customize flag using image assets : #

customize flag using image assets without currency format
Screenshot_20250904-103055 flag_left
  PriceText(
    currencyType: CurrencyType.AUD, //for currency type to be displayed
    amount: 1000, //for amount to be displayed on screen using currency format
    showFlag: true, //to show flag of the country
    showCurrencyCode: true, //to show currency code
    /// custom flag widget using image asset
    customFlagWidget: Image.asset(
      'assets/aud.png',
       height: 40, 
       width: 40, 
       fit: BoxFit.cover
    ),
  ),

hide Currency symbol : #

Hide Currency Symbol
Screenshot_20250904-102604 flag_left
    PriceText(
      currencyType: CurrencyType.AUD, //for currency type to be displayed
      amount: 1000, //for amount to be displayed on screen using currency format
      showFlag: true, //to show flag of the country
      showCurrencyCode: true, //to show currency code
      hideCurrencySymbol: true, //to hide currency symbol like $, ₹ etc
    ),

positive and negative value changes color Bydefault : #

Colors (Positive value) Colors (Negative value) Colors (Zero value)
positive negative zero
Colors (Positive value) Colors (Negative value) Colors (Zero value)
positive negative zero
/// show nagative red color default 
PriceText(
  currencyType: CurrencyType.AUD, //for currency type to be displayed
  amount: -1000, //for amount to be displayed on screen nagative value to show red color
  showFlag: true, //to show flag of the country
  howCurrencyCode: true, //to show currency code
),

/// show positive value green color default 
PriceText(
  currencyType: CurrencyType.AUD, //for currency type to be displayed
  amount: 1000, //for amount to be displayed on screen positive value to show green color
  showFlag: true, //to show flag of the country
  howCurrencyCode: true, //to show currency code
),

/// show 0 value grey color bydefult 
PriceText(
  currencyType: CurrencyType.AUD, //for currency type to be displayed
  amount: 0, //for amount to be displayed on screen 0 value to show grey color
  showFlag: true, //to show flag of the country
  howCurrencyCode: true, //to show currency code
),

customize positive and negative value changes color according to your choice : #

Colors (Positive value) Colors (Negative value) Colors (Zero value)
positive negative zero
Colors (Positive value) Colors (Negative value) Colors (Zero value)
positive negative zero
/// changes text color according amountColorStyle
PriceText(
  currencyType: CurrencyType.AUD, //for currency type to be displayed
  amount: 0, //for amount to be displayed on screen 0 value to show black color
  showFlag: true, //to show flag of the country
  showCurrencyCode: true, //to show currency code.
  /// to change color of amount based on value
    amountColorStyle: (num amount) {
      if (amount > 0) {
         return Colors.blue; // for positive value
      } else if (amount < 0) {
         return Colors.purpleAccent; // for nagative value
      } else {
         return Colors.black; // for 0 value
      }
    },
  ),

Use Currency locale for using formatting #

The locale property allows you to set the regional formatting for your currency display. Supported locales:INR → en_IN, USD → en_US, CAD → en_CA, EUR → en_IE, GBP → en_GB, JPY → ja_JP, AUD → en_AU, CNY → zh_CN, SGD → en_SG, NZD → en_NZ, MXN → es_MX, ZAR → en_ZA, TRY → tr_TR

Currency locale formatting
Screenshot_20250904-103055 Screenshot_20250904-095515
PriceText(
  currencyType: CurrencyType.USD, //for currency type to be displayed
  amount: 12345.67, //for amount to be displayed on screen 0 value to show grey color
  locale: "en_US", //locale for formatting
  usePatternWithTextSpan: true, // to use pattern with TextSpan
  formatterPattern: '#,##0.0', //custom pattern for formatting
),

Use Currency formatterPattern #

The formatterPattern property lets you customize the number format of the amount.

Currency locale formatting
Screenshot_20250904-103055 Screenshot_20251003-162652
PriceText(
  currencyType: CurrencyType.USD, //for currency type to be displayed
  amount: 12345.67, //for amount to be displayed on screen 0 value to show grey color
  locale: "en_US", //locale for formatting
  formatterPattern: '#,##0.0', //custom pattern for formatting
  usePatternWithTextSpan: true, // to use pattern with TextSpan
),

All Code Customization Options : #

Basic Options #

  • currencyType → select currency
  • amount → enter amount (0 = grey)
  • showFlag → show/hide country flag
  • showCurrencyCode → show/hide currency code

Layout #

  • contryCodeSpacing → space between flag & code
  • flagSpacing → space between code & amount
  • flagAlignment → flag left / right

Styling #

  • amountColorStyle → customize color according to your choice
  • positive = green
  • negative = red
  • zero = grey
  • hideCurrencySymbol → hide symbol, only show amount
  • avoidCurrencyFormat → disable auto-formatting

Advanced #

  • customFlagWidget → use your own flag image/widget
  • currencyCodeText → replace code with custom text (e.g., US,AUD)
  • currencyCodeTextStyle → custom text style

Supported Currencies: #

  • USD, EUR, GBP, INR, JPY, AUD, CAD, CNY, SGD, NZD, MXN, ZAR, TRY
    • Example : CurrencyType.AUD, // add according your choice
 PriceText(
  /// Supported Currencies: USD, EUR, GBP, INR, JPY, AUD, CAD, CNY, SGD, NZD, MXN, ZAR, TRY
  currencyType: CurrencyType.AUD, //for currency type to be displayed
  locale: "en_AU", //locale for formatting
  formatterPattern: '#,##0.00', //custom pattern for formatting
  amount: 2000, //for amount to be displayed on screen 0 value to show grey color
  showFlag: true, //to show flag of the country
  showCurrencyCode: true, //to show currency code
  ontryCodeSpacing: 10, //spacing between flag and currency code
  flagSpacing: 20, //spacing between currency code and amount
  flagAlignment: AlignmentOption.left, //flag alignment left or right
  amountColorStyle: (amount) {
     if (amount > 0) {
      return Colors.green;
     } else if (amount < 0) {
       return Colors.red;
     } else {
        return Colors.grey;
     }
   }, //custom color resolver for amount
  hideCurrencySymbol: false, //to hide currency symbol if you want to show only amount
  avoidCurrencyFormat: false, //to avoid currency formatting
  customFlagWidget: Image.asset('assets/aud.png', width: 40, height: 40,fit: BoxFit.cover,), //custom flag widget if you want to show custom flag using image
  currencyCodeText: 'australia', //custom currency code text if you want to show custom text
  currencyCodeTextStyle: const TextStyle(fontSize: 22, fontWeight: FontWeight.w500), //custom text style for currency code
),
All Customization
Screenshot_20250904-103055 flag_left

Bugs and Feedback #

We welcome and appreciate any suggestions you may have for improvement. For bugs, questions, and discussions please use the GitHub Issues.

Acknowledgments #

It extends Flutter’s foundation to provide a ready-to-use, customizable currency formatter widget.While Flutter and intl provide the base, price_text simplifies the process by combining widgets and formatting logic into a single package you can drop into any app.

Contribution #

The DashStack team enthusiastically welcomes contributions and project participation! There are a bunch of things you can do if you want to contribute! The Contributor Guide has all the information you need for everything from reporting bugs to contributing new features.

Credits #

price_text is owned and maintained by the Dashstack Infotech team (SURAT, INDIA). Follow us for updates and new releases 🚀.

5
likes
150
points
20
downloads

Publisher

verified publisherdashstack.tech

Weekly Downloads

Show prices in Flutter apps with currency symbols, codes, and flags.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, intl

More

Packages that depend on price_text