Skip to content

Commit

Permalink
V2.0.15
Browse files Browse the repository at this point in the history
Merge pull request #71 from Daniel-Ioannou/v2.0.15
close #69
close #70
  • Loading branch information
Daniel-Ioannou committed Feb 12, 2023
2 parents 4ec212f + 3abe0b5 commit ea37355
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 11 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2.0.15
* Add more currencies:
- West African CFA franc
* Add parameter `useRootNavigator`
``` Dart
showCurrencyPicker(
context: context,
useRootNavigator: true,
onSelect: (Currency currency) => print('Select currency: ${currency.name}'),
);
```
* Update dependencies
## 2.0.14
* Add more currencies:
- Zambian Kwacha
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A flutter package to select a currency from a list of currencies.
Add the package to your pubspec.yaml:

```yaml
currency_picker: ^2.0.14
currency_picker: ^2.0.15
```

In your dart file, import the library:
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A flutter package to select a currency from a list of currencies.
Add the package to your pubspec.yaml:

```yaml
currency_picker: ^2.0.14
currency_picker: ^2.0.15
```

In your dart file, import the library:
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.14"
version: "2.0.15"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -168,5 +168,5 @@ packages:
source: hosted
version: "2.1.4"
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=1.17.0"
14 changes: 14 additions & 0 deletions lib/currency_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@ export 'package:currency_picker/src/currency_utils.dart';
/// Show currency picker
///
/// `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).
///
/// `currencyFilter`: Can be used to uses filter the Currency list (optional).
///
/// `favorite`: The Currencies that will appear at the top of the list (optional).
///
/// `theme`: can be used to customizing the country list bottom sheet (optional).
///
/// `useRootNavigator`: ensures that the root navigator is used to
/// display the [BottomSheet] when set to `true`. This is useful in the case
/// that a modal [BottomSheet] needs to be displayed above all other content
/// but the caller is inside another [Navigator].
///
/// This example demonstrates how to use `showCurrencyPicker`
/// ```dart
/// showCurrencyPicker(
Expand All @@ -45,6 +57,7 @@ void showCurrencyPicker({
bool showFlag = true,
bool showCurrencyName = true,
bool showCurrencyCode = true,
bool useRootNavigator = false,
ScrollPhysics? physics,
CurrencyPickerThemeData? theme,
}) {
Expand All @@ -60,6 +73,7 @@ void showCurrencyPicker({
showFlag: showFlag,
showCurrencyName: showCurrencyName,
showCurrencyCode: showCurrencyCode,
useRootNavigator: useRootNavigator,
favorite: favorite,
currencyFilter: currencyFilter,
theme: theme,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/currencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ List<Map<String, dynamic>> currencies = [
"code": "XOF",
"name": "UEMOA CFA franc",
"symbol": "FCFA",
"flag": "UEMOA",
"flag": "xof.png",
"decimal_digits": 2,
"number": 960,
"name_plural": "UEMOA CFA francs",
Expand Down
2 changes: 2 additions & 0 deletions lib/src/currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Currency {
///True if symbol has space with amount
final bool spaceBetweenAmountAndSymbol;

bool get isFlagImage => flag?.endsWith('.png') ?? false;

Currency({
required this.code,
required this.name,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/currency_list_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void showCurrencyListBottomSheet({
bool showFlag = true,
bool showCurrencyName = true,
bool showCurrencyCode = true,
bool useRootNavigator = false,
ScrollPhysics? physics,
CurrencyPickerThemeData? theme,
}) {
Expand All @@ -26,6 +27,7 @@ void showCurrencyListBottomSheet({
context: context,
isScrollControlled: true,
shape: shape,
useRootNavigator: useRootNavigator,
backgroundColor: theme?.backgroundColor,
builder: (_) => _builder(
context,
Expand Down
5 changes: 2 additions & 3 deletions lib/src/currency_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ class _CurrencyListViewState extends State<CurrencyListView> {
);
}

// Verify if it is UEMOA XOF
if (currency.flag == "UEMOA") {
if (currency.isFlagImage) {
return Image.asset(
'uemoa.png'.imagePath,
currency.flag!.imagePath,
package: 'currency_picker',
width: 27,
);
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@ packages:
source: hosted
version: "2.1.4"
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=1.17.0"
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A flutter package to select a currency from a list of currencies.
homepage: https://github.com/Daniel-Ioannou
repository: https://github.com/Daniel-Ioannou/flutter_currency_picker

version: 2.0.14
version: 2.0.15

environment:
sdk: '>=2.12.0 <3.0.0'
Expand All @@ -13,7 +13,7 @@ environment:
dependencies:
flutter:
sdk: flutter
collection: ^1.16.0
collection: ^1.17.0

flutter:
assets:
Expand Down

0 comments on commit ea37355

Please sign in to comment.