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/structure/invoice_app_data.dart'; 5 : import 'package:app_finance/pages/bill/bill_add_page.dart'; 6 : import 'package:app_finance/pages/bill/widgets/income_edit_tab.dart'; 7 : import 'package:app_finance/pages/bill/widgets/transfer_edit_tab.dart'; 8 : import 'package:flutter/material.dart'; 9 : 10 : class InvoiceEditPage extends BillAddPage { 11 : final String uuid; 12 : 13 0 : const InvoiceEditPage({ 14 : super.key, 15 : required this.uuid, 16 : }); 17 : 18 0 : @override 19 0 : BillEditPageState createState() => BillEditPageState(); 20 : } 21 : 22 : class BillEditPageState extends BillAddPageState<InvoiceEditPage> { 23 0 : @override 24 : Widget buildContent(BuildContext context, BoxConstraints constraints) { 25 0 : final invoice = state.getByUuid(widget.uuid) as InvoiceAppData; 26 0 : return invoice.accountFrom != null 27 0 : ? TransferEditTab( 28 0 : state: state, 29 0 : callback: update, 30 0 : uuid: widget.uuid, 31 0 : accountFrom: invoice.accountFrom == '' ? null : invoice.accountFrom, 32 0 : accountTo: invoice.account == '' ? null : invoice.account, 33 0 : currency: invoice.currency, 34 0 : description: invoice.title, 35 0 : amount: invoice.details, 36 0 : createdAt: invoice.createdAt, 37 : ) 38 0 : : IncomeEditTab( 39 0 : state: state, 40 0 : callback: update, 41 0 : uuid: widget.uuid, 42 0 : account: invoice.account == '' ? null : invoice.account, 43 0 : currency: invoice.currency, 44 0 : description: invoice.title, 45 0 : amount: invoice.details, 46 0 : createdAt: invoice.createdAt, 47 : ); 48 : } 49 : }