https://github.com/daniel-ioannou/flutter_currency_picker
A flutter package to select a currency from a list of currencies.
https://github.com/daniel-ioannou/flutter_currency_picker
currency-picker flutter flutter-package
Last synced: about 1 month ago
JSON representation
A flutter package to select a currency from a list of currencies.
- Host: GitHub
- URL: https://github.com/daniel-ioannou/flutter_currency_picker
- Owner: Daniel-Ioannou
- License: mit
- Created: 2020-10-22T16:10:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-14T21:26:49.000Z (6 months ago)
- Last Synced: 2025-04-04T05:05:45.355Z (about 2 months ago)
- Topics: currency-picker, flutter, flutter-package
- Language: Dart
- Homepage: https://pub.dev/packages/currency_picker
- Size: 2.5 MB
- Stars: 37
- Watchers: 2
- Forks: 98
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Currency picker
[](https://pub.dev/packages/currency_picker)
A flutter package to select a currency from a list of currencies.
## Getting Started
Add the package to your pubspec.yaml:
```yaml
currency_picker: ^2.0.21
```
In your dart file, import the library:```Dart
import 'package:currency_picker/currency_picker.dart';
```
Show currency picker using `showCurrencyPicker`:
```Dart
showCurrencyPicker(
context: context,
showFlag: true,
showCurrencyName: true,
showCurrencyCode: true,
onSelect: (Currency currency) {
print('Select currency: ${currency.name}');
},
);
```### Parameters:
* `onSelect`: Called when a currency is select. The currency picker passes the new value to the callback (required)
* `showFlag`: Shows flag for each currency. Default value `true` (optional).
* `searchHint`: Option to customize hint of the search TextField (optional).
* `showCurrencyName`: Option to show/hide the currency name, default value `true` (optional).
* `showCurrencyCode`: Option to show/hide the currency code, default value `true` (optional).
* `showSearchField`: Option to show/hide the search TextField, default value `true` (optional).
* `currencyFilter`: Can be used to filter the Currency list (optional).
```Dart
showCurrencyPicker(
context: context,
onSelect: (Currency currency) {
print('Select currency: ${currency.name}');
},
currencyFilter: ['EUR', 'GBP', 'USD', 'AUD', 'CAD', 'JPY', 'HKD', 'CHF', 'SEK', 'ILS'],
);
```
* `favorite`: Can be used to show the favorite currencies at the top of the list (optional).
* `theme`: Can be used to customizing the currency list bottom sheet. (optional).
```Dart
showCurrencyPicker(
context: context,
theme: CurrencyPickerThemeData(
flagSize: 25,
titleTextStyle: TextStyle(fontSize: 17),
subtitleTextStyle: TextStyle(fontSize: 15, color: Theme.of(context).hintColor),
bottomSheetHeight: MediaQuery.of(context).size.height / 2,
//Optional. Styles the search field.
inputDecoration: InputDecoration(
labelText: 'Search',
hintText: 'Start typing to search',
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderSide: BorderSide(
color: const Color(0xFF8C98A8).withOpacity(0.2),
),
),
),
),
onSelect: (Currency currency) => print('Select currency: ${currency.name}'),
);
```
## Contributions
Contributions of any kind are more than welcome! Feel free to fork and improve currency_picker in any way you want, make a pull request, or open an issue.