chore: publish version 1.1.1 #43
2 changed files with 37 additions and 40 deletions
|
@ -16,7 +16,8 @@ class CreateSingleEntryView extends StatefulWidget {
|
||||||
/// Used when user wants to add new entry
|
/// Used when user wants to add new entry
|
||||||
const CreateSingleEntryView({
|
const CreateSingleEntryView({
|
||||||
required this.w,
|
required this.w,
|
||||||
required this.locale, super.key,
|
required this.locale,
|
||||||
|
super.key,
|
||||||
this.editEntry,
|
this.editEntry,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,6 +37,9 @@ class CreateSingleEntryView extends StatefulWidget {
|
||||||
|
|
||||||
class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
late WalletSingleEntry newEntry;
|
late WalletSingleEntry newEntry;
|
||||||
|
final _entryNameController = TextEditingController();
|
||||||
|
final _entryBalanceController = TextEditingController();
|
||||||
|
final _entryDescriptionController = TextEditingController();
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -50,6 +54,9 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
category: widget.w.categories.first,
|
category: widget.w.categories.first,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_entryNameController.text = newEntry.data.name;
|
||||||
|
_entryBalanceController.text = newEntry.data.amount.toString();
|
||||||
|
_entryDescriptionController.text = newEntry.data.description;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +78,7 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
labelText: AppLocalizations.of(context).name,
|
labelText: AppLocalizations.of(context).name,
|
||||||
controller: TextEditingController(text: newEntry.data.name),
|
controller: _entryNameController,
|
||||||
onChanged: (v) {
|
|
||||||
newEntry.data.name = v;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -84,9 +88,7 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
labelText: AppLocalizations.of(context).amount,
|
labelText: AppLocalizations.of(context).amount,
|
||||||
controller: TextEditingController(
|
controller: _entryBalanceController,
|
||||||
text: newEntry.data.amount.toString(),
|
|
||||||
),
|
|
||||||
keyboardType:
|
keyboardType:
|
||||||
const TextInputType.numberWithOptions(decimal: true),
|
const TextInputType.numberWithOptions(decimal: true),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
@ -94,9 +96,6 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: (v) {
|
|
||||||
newEntry.data.amount = double.parse(v);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -183,12 +182,7 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
controller: TextEditingController(
|
controller: _entryDescriptionController,
|
||||||
text: newEntry.data.description,
|
|
||||||
),
|
|
||||||
onChanged: (v) {
|
|
||||||
newEntry.data.description = v;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -224,13 +218,18 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
||||||
PlatformButton(
|
PlatformButton(
|
||||||
text: AppLocalizations.of(context).save,
|
text: AppLocalizations.of(context).save,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (newEntry.data.name.isEmpty) {
|
if (_entryNameController.text.isEmpty) {
|
||||||
showMessage(
|
showMessage(
|
||||||
AppLocalizations.of(context).errorEmptyName,
|
AppLocalizations.of(context).errorEmptyName,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
newEntry.data.name = _entryNameController.text;
|
||||||
|
newEntry.data.amount =
|
||||||
|
double.parse(_entryBalanceController.text);
|
||||||
|
newEntry.data.description =
|
||||||
|
_entryDescriptionController.text;
|
||||||
if (widget.editEntry != null) {
|
if (widget.editEntry != null) {
|
||||||
Navigator.of(context).pop(newEntry);
|
Navigator.of(context).pop(newEntry);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:prasule/api/entry_data.dart';
|
||||||
import 'package:prasule/api/recurring_entry.dart';
|
import 'package:prasule/api/recurring_entry.dart';
|
||||||
import 'package:prasule/api/wallet.dart';
|
import 'package:prasule/api/wallet.dart';
|
||||||
import 'package:prasule/api/wallet_manager.dart';
|
import 'package:prasule/api/wallet_manager.dart';
|
||||||
import 'package:prasule/main.dart';
|
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformfield.dart';
|
import 'package:prasule/pw/platformfield.dart';
|
||||||
import 'package:prasule/util/show_message.dart';
|
import 'package:prasule/util/show_message.dart';
|
||||||
|
@ -39,6 +38,10 @@ class CreateRecurringEntryView extends StatefulWidget {
|
||||||
|
|
||||||
class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
late RecurringWalletEntry newEntry;
|
late RecurringWalletEntry newEntry;
|
||||||
|
final _entryNameController = TextEditingController();
|
||||||
|
final _entryBalanceController = TextEditingController();
|
||||||
|
final _entryDescriptionController = TextEditingController();
|
||||||
|
final _repeatAfterController = TextEditingController();
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -55,6 +58,10 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
recurType: RecurType.month,
|
recurType: RecurType.month,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_entryNameController.text = newEntry.data.name;
|
||||||
|
_entryBalanceController.text = newEntry.data.amount.toString();
|
||||||
|
_entryDescriptionController.text = newEntry.data.description;
|
||||||
|
_repeatAfterController.text = newEntry.repeatAfter.toString();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +83,7 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
labelText: AppLocalizations.of(context).name,
|
labelText: AppLocalizations.of(context).name,
|
||||||
controller: TextEditingController(text: newEntry.data.name),
|
controller: _entryNameController,
|
||||||
onChanged: (v) {
|
|
||||||
newEntry.data.name = v;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -89,9 +93,7 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
labelText: AppLocalizations.of(context).amount,
|
labelText: AppLocalizations.of(context).amount,
|
||||||
controller: TextEditingController(
|
controller: _entryBalanceController,
|
||||||
text: newEntry.data.amount.toString(),
|
|
||||||
),
|
|
||||||
keyboardType:
|
keyboardType:
|
||||||
const TextInputType.numberWithOptions(decimal: true),
|
const TextInputType.numberWithOptions(decimal: true),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
@ -99,10 +101,6 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: (v) {
|
|
||||||
logger.i(v);
|
|
||||||
newEntry.data.amount = double.parse(v);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -189,12 +187,7 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
controller: TextEditingController(
|
controller: _entryDescriptionController,
|
||||||
text: newEntry.data.description,
|
|
||||||
),
|
|
||||||
onChanged: (v) {
|
|
||||||
newEntry.data.description = v;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -215,9 +208,7 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 50,
|
width: 50,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
controller: TextEditingController(
|
controller: _repeatAfterController,
|
||||||
text: newEntry.repeatAfter.toString(),
|
|
||||||
),
|
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
FilteringTextInputFormatter.deny(
|
FilteringTextInputFormatter.deny(
|
||||||
|
@ -313,13 +304,20 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
||||||
PlatformButton(
|
PlatformButton(
|
||||||
text: AppLocalizations.of(context).save,
|
text: AppLocalizations.of(context).save,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (newEntry.data.name.isEmpty) {
|
if (_entryNameController.text.isEmpty) {
|
||||||
showMessage(
|
showMessage(
|
||||||
AppLocalizations.of(context).errorEmptyName,
|
AppLocalizations.of(context).errorEmptyName,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
newEntry.data.name = _entryNameController.text;
|
||||||
|
newEntry.data.amount =
|
||||||
|
double.parse(_entryBalanceController.text);
|
||||||
|
newEntry.repeatAfter =
|
||||||
|
int.parse(_repeatAfterController.text);
|
||||||
|
newEntry.data.description =
|
||||||
|
_entryDescriptionController.text;
|
||||||
if (widget.editEntry != null) {
|
if (widget.editEntry != null) {
|
||||||
Navigator.of(context).pop(newEntry);
|
Navigator.of(context).pop(newEntry);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue