Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved. 2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file. 3 : 4 : import 'package:app_finance/_classes/herald/app_locale.dart'; 5 : import 'package:app_finance/_classes/structure/invoice_app_data.dart'; 6 : import 'package:app_finance/_ext/double_ext.dart'; 7 : import 'package:app_finance/pages/bill/widgets/transfer_tab.dart'; 8 : 9 : class TransferEditTab extends TransferTab { 10 : final String uuid; 11 : 12 0 : const TransferEditTab({ 13 : super.key, 14 : required this.uuid, 15 : required super.state, 16 : required super.callback, 17 : super.accountFrom, 18 : super.accountTo, 19 : super.amount, 20 : super.description, 21 : super.currency, 22 : super.createdAt, 23 : }); 24 : 25 0 : @override 26 0 : TransferEditTabState createState() => TransferEditTabState(); 27 : } 28 : 29 : class TransferEditTabState extends TransferTabState<TransferEditTab> { 30 0 : @override 31 : void updateStorage() { 32 0 : exchange.save(); 33 0 : widget.state.update( 34 : // ignore: unnecessary_cast 35 0 : (widget as TransferEditTab).uuid, 36 0 : InvoiceAppData( 37 : // ignore: unnecessary_cast 38 0 : uuid: (widget as TransferEditTab).uuid, 39 0 : title: description.text, 40 0 : color: widget.state.getByUuid(accountTo!)?.color, 41 0 : account: accountTo!, 42 0 : accountFrom: accountFrom, 43 0 : details: double.tryParse(amount.text)?.toFixed(currency?.decimalDigits) ?? 0.0, 44 0 : currency: currency, 45 0 : createdAt: createdAt, 46 : )); 47 : } 48 : 49 0 : @override 50 0 : String getTitle() => AppLocale.labels.editTransferTooltip; 51 : 52 0 : @override 53 0 : String getButtonName() => AppLocale.labels.editTransferTooltip; 54 : }