LCOV - code coverage report
Current view: top level - lib/_classes/structure - invoice_app_data.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 42 0
Test Date: 2026-11-14 15:08:11 Functions: - 0 0

            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/storage/app_data.dart';
       6              : import 'package:app_finance/_classes/structure/abstract_app_data.dart';
       7              : import 'package:app_finance/_mixins/storage_mixin.dart';
       8              : import 'package:material_ui/material_ui.dart';
       9              : import 'package:flutter_currency_picker/flutter_currency_picker.dart';
      10              : import 'package:intl/intl.dart';
      11              : 
      12              : class InvoiceAppData extends AbstractAppData with StorageMixin {
      13              :   String account;
      14              :   String? accountFrom;
      15              : 
      16            0 :   InvoiceAppData({
      17              :     required super.title,
      18              :     required this.account,
      19              :     this.accountFrom,
      20              :     super.uuid,
      21              :     super.details,
      22              :     super.description,
      23              :     super.color,
      24              :     super.currency,
      25              :     super.updatedAt,
      26              :     super.createdAt,
      27              :     super.createdAtFormatted,
      28              :     super.hidden,
      29              :     super.payment,
      30              :   });
      31              : 
      32            0 :   @override
      33              :   String getClassName() => 'InvoiceAppData';
      34              : 
      35            0 :   @override
      36              :   AppDataType getType() => AppDataType.invoice;
      37              : 
      38            0 :   @override
      39              :   InvoiceAppData clone() {
      40            0 :     return InvoiceAppData(
      41            0 :       account: account,
      42            0 :       accountFrom: accountFrom,
      43            0 :       uuid: super.uuid,
      44            0 :       title: super.title,
      45            0 :       details: super.details,
      46            0 :       description: super.description,
      47            0 :       color: super.color,
      48            0 :       currency: super.currency,
      49            0 :       createdAt: super.createdAt,
      50            0 :       hidden: super.hidden,
      51            0 :       payment: super.payment,
      52              :     );
      53              :   }
      54              : 
      55            0 :   factory InvoiceAppData.fromJson(Map<String, dynamic> json) {
      56            0 :     return InvoiceAppData(
      57            0 :       uuid: json['uuid'],
      58            0 :       title: json['title'],
      59            0 :       account: json['account'],
      60            0 :       accountFrom: json['accountFrom'],
      61            0 :       details: 0.0 + (json['details'] ?? 0),
      62            0 :       description: json['description'],
      63            0 :       color: json['color'] != null ? MaterialColor(json['color'], const <int, Color>{}) : null,
      64            0 :       currency: CurrencyProvider.find(json['currency']),
      65            0 :       createdAt: DateTime.parse(json['createdAt']),
      66            0 :       updatedAt: DateTime.parse(json['updatedAt']),
      67            0 :       hidden: json['hidden'],
      68            0 :       payment: json['payment'],
      69              :     );
      70              :   }
      71              : 
      72            0 :   @override
      73            0 :   Map<String, dynamic> toJson() => {
      74            0 :         ...super.toJson(),
      75            0 :         'account': account,
      76            0 :         'accountFrom': accountFrom,
      77              :       };
      78              : 
      79            0 :   String get detailsFormatted => (super.details as double).toCurrency(currency: currency, withPattern: false);
      80              : 
      81            0 :   @override
      82            0 :   String get description => DateFormat.MMMMd(AppLocale.code).format(super.createdAt);
      83              : 
      84            0 :   @override
      85            0 :   IconData? get icon => getState().getByUuid(account).icon;
      86              : 
      87            0 :   String get accountNamed => getState().getByUuid(account).title;
      88              : 
      89            0 :   String? get accountFromNamed => accountFrom != null ? getState().getByUuid(accountFrom!).title : null;
      90              : }
        

Generated by: LCOV version 2.0-1