-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.0.23 - Fix Summary page currency bug (#23)
* v1.0.23 - Version * v1.0.23 - Fix transaction order * v1.0.23 - Fix non EUR preferred currency * v1.0.23 - Fix Summary page currency bug * v1.0.23 - Correction in Hide Alert * v1.0.23 - Correction in Menu * v1.0.23 - Let preferred currency change * v1.0.23 - Improve language * v1.0.23 - Update workflow
- Loading branch information
Showing
13 changed files
with
119 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:currency_picker/currency_picker.dart'; | ||
import 'package:finease/core/extensions/text_style_extension.dart'; | ||
import 'package:finease/db/settings.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:finease/db/currency.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
class CurrencySelectorWidget extends StatefulWidget { | ||
final Function onChange; | ||
const CurrencySelectorWidget({ | ||
super.key, | ||
required this.onChange, | ||
}); | ||
|
||
@override | ||
CurrencySelectorWidgetState createState() => CurrencySelectorWidgetState(); | ||
} | ||
|
||
class CurrencySelectorWidgetState extends State<CurrencySelectorWidget> { | ||
final SettingService _settingService = SettingService(); | ||
String? currency; | ||
String? symbol; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
onLoad(); | ||
} | ||
|
||
Future<void> onLoad() async { | ||
final curr = await _settingService.getSetting(Setting.prefCurrency); | ||
|
||
setState(() { | ||
currency = curr; | ||
symbol = SupportedCurrency[curr]; | ||
}); | ||
} | ||
|
||
void _showCurrencyPicker(BuildContext context) { | ||
showCurrencyPicker( | ||
context: context, | ||
currencyFilter: SupportedCurrency.keys.toList(), | ||
showFlag: true, | ||
onSelect: (Currency selectedCurrency) async { | ||
setState(() { | ||
currency = selectedCurrency.code; | ||
symbol = selectedCurrency.symbol; | ||
}); | ||
await _settingService.setSetting(Setting.prefCurrency, currency!); | ||
// ignore: use_build_context_synchronously | ||
context.pop(); | ||
widget.onChange(); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ListTile( | ||
title: const Text("Preferred Currency"), | ||
subtitle: Text(currency ?? ''), | ||
leading: Text( | ||
symbol ?? '', | ||
style: context.titleLarge, | ||
), | ||
onTap: () => _showCurrencyPicker(context), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters