LCOV - code coverage report
Current view: top level - lib/_classes/structure - invoice_app_data.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 46 0
Test Date: 2026-12-05 10:54:13 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              :   List<String> tags;
      16              : 
      17            0 :   InvoiceAppData({
      18              :     required super.title,
      19              :     required this.account,
      20              :     this.accountFrom,
      21              :     super.uuid,
      22              :     super.details,
      23              :     super.description,
      24              :     super.color,
      25              :     super.currency,
      26              :     super.updatedAt,
      27              :     super.createdAt,
      28              :     super.createdAtFormatted,
      29              :     super.hidden,
      30              :     super.payment,
      31              :     List<String>? tags,
      32            0 :   }) : tags = tags ?? [];
      33              : 
      34            0 :   @override
      35              :   String getClassName() => 'InvoiceAppData';
      36              : 
      37            0 :   @override
      38              :   AppDataType getType() => AppDataType.invoice;
      39              : 
      40            0 :   @override
      41              :   InvoiceAppData clone() {
      42            0 :     return InvoiceAppData(
      43            0 :       account: account,
      44            0 :       accountFrom: accountFrom,
      45            0 :       uuid: super.uuid,
      46            0 :       title: super.title,
      47            0 :       details: super.details,
      48            0 :       description: super.description,
      49            0 :       color: super.color,
      50            0 :       currency: super.currency,
      51            0 :       createdAt: super.createdAt,
      52            0 :       hidden: super.hidden,
      53            0 :       payment: super.payment,
      54            0 :       tags: [...tags],
      55              :     );
      56              :   }
      57              : 
      58            0 :   factory InvoiceAppData.fromJson(Map<String, dynamic> json) {
      59            0 :     return InvoiceAppData(
      60            0 :       uuid: json['uuid'],
      61            0 :       title: json['title'],
      62            0 :       account: json['account'],
      63            0 :       accountFrom: json['accountFrom'],
      64            0 :       details: 0.0 + (json['details'] ?? 0),
      65            0 :       description: json['description'],
      66            0 :       color: json['color'] != null ? MaterialColor(json['color'], const <int, Color>{}) : null,
      67            0 :       currency: CurrencyProvider.find(json['currency']),
      68            0 :       createdAt: DateTime.parse(json['createdAt']),
      69            0 :       updatedAt: DateTime.parse(json['updatedAt']),
      70            0 :       hidden: json['hidden'],
      71            0 :       payment: json['payment'],
      72            0 :       tags: (json['tags'] as List<dynamic>?)?.cast<String>(),
      73              :     );
      74              :   }
      75              : 
      76            0 :   @override
      77            0 :   Map<String, dynamic> toJson() => {
      78            0 :         ...super.toJson(),
      79            0 :         'account': account,
      80            0 :         'accountFrom': accountFrom,
      81            0 :         'tags': tags,
      82              :       };
      83              : 
      84            0 :   String get detailsFormatted => (super.details as double).toCurrency(currency: currency, withPattern: false);
      85              : 
      86            0 :   @override
      87            0 :   String get description => DateFormat.MMMMd(AppLocale.code).format(super.createdAt);
      88              : 
      89            0 :   @override
      90            0 :   IconData? get icon => getState().getByUuid(account).icon;
      91              : 
      92            0 :   String get accountNamed => getState().getByUuid(account).title;
      93              : 
      94            0 :   String? get accountFromNamed => accountFrom != null ? getState().getByUuid(accountFrom!).title : null;
      95              : }
        

Generated by: LCOV version 2.0-1