fix: actually save starting balance
This commit is contained in:
parent
71444af7b0
commit
dab4448c14
1 changed files with 6 additions and 11 deletions
|
@ -51,7 +51,7 @@ class _SetupViewState extends State<SetupView> {
|
||||||
);
|
);
|
||||||
List<WalletCategory> categories = <WalletCategory>[];
|
List<WalletCategory> categories = <WalletCategory>[];
|
||||||
String name = "";
|
String name = "";
|
||||||
double balance = 0;
|
final _balanceController = TextEditingController(text: "0.0");
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
|
@ -158,7 +158,7 @@ class _SetupViewState extends State<SetupView> {
|
||||||
name: name,
|
name: name,
|
||||||
currency: _selectedCurrency,
|
currency: _selectedCurrency,
|
||||||
categories: categories,
|
categories: categories,
|
||||||
);
|
starterBalance: double.parse(_balanceController.text));
|
||||||
await WalletManager.saveWallet(wallet);
|
await WalletManager.saveWallet(wallet);
|
||||||
|
|
||||||
if (widget.newWallet && context.mounted) {
|
if (widget.newWallet && context.mounted) {
|
||||||
|
@ -267,7 +267,7 @@ class _SetupViewState extends State<SetupView> {
|
||||||
keyboardType: const TextInputType.numberWithOptions(
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
decimal: true,
|
decimal: true,
|
||||||
),
|
),
|
||||||
controller: TextEditingController(text: "0.0"),
|
controller: _balanceController,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.allow(
|
FilteringTextInputFormatter.allow(
|
||||||
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
||||||
|
@ -277,11 +277,6 @@ class _SetupViewState extends State<SetupView> {
|
||||||
padding: const EdgeInsets.only(right: 4),
|
padding: const EdgeInsets.only(right: 4),
|
||||||
child: Text(_selectedCurrency.symbol),
|
child: Text(_selectedCurrency.symbol),
|
||||||
),
|
),
|
||||||
onChanged: (t) {
|
|
||||||
final b = double.tryParse(t);
|
|
||||||
if (b == null) return;
|
|
||||||
balance = b;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue