# flutter_currency_input_formatter
---
A lightweight and customizable **currency input formatter** for Flutter text fields.
Supports dynamic currency symbols, decimal digits, and left/right symbol positioning — perfect for apps like **Bkash**, **POS systems**, and **financial apps**.
---
## 🚀 Features
- Real-time currency input formatting
- Works with or without decimals (e.g., `500` or `500.25`)
- Dynamic currency symbol (e.g., `$`, `€`, `৳`, `₹`)
- Symbol can be placed on the left or right
- Max integer digit limit (e.g., 6 → allows `999999`)
- Clean format (e.g., `1000` instead of `1,000`)
- No dependencies — just plug and play
---
## 🧩 Installation
Install via **Flutter CLI**:
```bash
flutter pub add flutter_currency_input_formatter
Or manually add to your pubspec.yaml:
dependencies:
flutter_currency_input_formatter: ^1.0.1
🧑💻 Usage Example
import 'package:flutter/material.dart';
import 'package:flutter_currency_input_formatter/flutter_currency_input_formatter.dart';
class CurrencyInputExample extends StatelessWidget {
const CurrencyInputExample({super.key});
@override
Widget build(BuildContext context) {
final formatter = CurrencyInputFormatter(
currencySymbol: '\$',
symbolOnLeft: false,
decimalDigits: 2,
maxIntegerDigits: 6,
);
return Scaffold(
appBar: AppBar(title: const Text('Currency Input Example')),
body: Padding(
padding: const EdgeInsets.all(20),
child: TextField(
keyboardType: const TextInputType.numberWithOptions(decimal: true),
inputFormatters: [formatter],
decoration: const InputDecoration(
labelText: 'Enter amount',
border: OutlineInputBorder(),
),
),
),
);
}
}
⚙️ Parameters
| Parameter |
Type |
Default |
Description |
currencySymbol |
String |
'৳' |
The currency symbol to display |
symbolOnLeft |
bool |
true |
Whether the symbol appears before or after the number |
decimalDigits |
int |
2 |
Number of decimal digits allowed |
maxIntegerDigits |
int? |
null |
Maximum number of digits before the decimal point |
🧮 Example Outputs
| Input |
Output |
Config |
1234 |
৳1234 |
symbolOnLeft: true |
1234 |
1234৳ |
symbolOnLeft: false |
56.7 |
৳56.7 |
decimalDigits: 2 |
9999999 |
৳999999 |
maxIntegerDigits: 6 |