LCOV - code coverage report
Current view: top level - lib/pages/account/widgets - account_line_widget.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 81 0
Test Date: 2026-11-14 15:04:37 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_design.dart';
       5              : import 'package:app_finance/_classes/herald/app_locale.dart';
       6              : import 'package:app_finance/_classes/structure/account_app_data.dart';
       7              : import 'package:app_finance/_configs/account_type.dart';
       8              : import 'package:app_finance/_ext/build_context_ext.dart';
       9              : import 'package:app_finance/_configs/custom_text_theme.dart';
      10              : import 'package:app_finance/design/wrapper/number_wrapper.dart';
      11              : import 'package:app_finance/design/wrapper/row_widget.dart';
      12              : import 'package:app_finance/_configs/theme_helper.dart';
      13              : import 'package:app_finance/design/wrapper/text_wrapper.dart';
      14              : import 'package:material_ui/material_ui.dart';
      15              : 
      16              : class AccountLineWidget extends StatelessWidget {
      17              :   final AccountAppData item;
      18              :   final double width;
      19              :   final int count;
      20              : 
      21            0 :   const AccountLineWidget({
      22              :     super.key,
      23              :     required this.item,
      24              :     required this.width,
      25              :     required this.count,
      26              :   });
      27              : 
      28            0 :   @override
      29              :   Widget build(BuildContext context) {
      30            0 :     final textTheme = context.textTheme;
      31            0 :     final indent = ThemeHelper.getIndent();
      32            0 :     final txtWidth = ThemeHelper.getTextWidth(Text(item.detailsFormatted, style: textTheme.numberMedium));
      33            0 :     final labelWidth = ThemeHelper.getTextWidth(Text(AppLocale.labels.validTillDate, style: textTheme.bodySmall));
      34            0 :     final typeWidth = ThemeHelper.getTextWidth(Text(AccountType.getLabel(item.type), style: textTheme.bodySmall));
      35            0 :     final dateWidth = ThemeHelper.getTextWidth(Text(item.closedAtFormatted, style: textTheme.numberSmall));
      36            0 :     final showValidDate = !AccountType.contains(item.type, [AppAccountType.account, AppAccountType.cash]);
      37            0 :     if (count > 2) {
      38            0 :       return Padding(
      39            0 :         padding: EdgeInsets.symmetric(vertical: indent),
      40            0 :         child: RowWidget(
      41              :           indent: indent,
      42            0 :           alignment: AppDesign.getAlignment<MainAxisAlignment>(),
      43            0 :           maxWidth: width,
      44              :           chunk: const [20, null, 0.3, 0.15, 0.1],
      45            0 :           children: [
      46            0 :             [
      47            0 :               Icon(item.icon, color: item.color, size: 20),
      48              :             ],
      49            0 :             [
      50            0 :               TextWrapper(
      51            0 :                 item.title,
      52            0 :                 style: textTheme.headlineMedium?.copyWith(
      53            0 :                   fontStyle: item.skip ? FontStyle.italic : FontStyle.normal,
      54              :                 ),
      55              :               ),
      56              :             ],
      57            0 :             [
      58            0 :               NumberWidget(item.description ?? '', colorScheme: context.colorScheme, style: textTheme.headlineMedium),
      59              :             ],
      60            0 :             [
      61            0 :               TextWrapper(AccountType.getLabel(item.type), style: textTheme.headlineMedium),
      62              :             ],
      63            0 :             [
      64            0 :               Row(
      65              :                 mainAxisAlignment: MainAxisAlignment.end,
      66            0 :                 children: [
      67            0 :                   Align(
      68              :                     alignment: Alignment.centerRight,
      69            0 :                     child: NumberWidget(
      70            0 :                       item.detailsFormatted,
      71            0 :                       colorScheme: context.colorScheme,
      72            0 :                       style: textTheme.numberMedium,
      73              :                     ),
      74              :                   ),
      75            0 :                   if (item.error != null) item.error!,
      76              :                 ],
      77              :               ),
      78              :             ],
      79              :           ],
      80              :         ),
      81              :       );
      82              :     }
      83            0 :     return Column(
      84            0 :       children: [
      85            0 :         RowWidget(
      86              :           indent: indent,
      87            0 :           alignment: AppDesign.getAlignment<MainAxisAlignment>(),
      88            0 :           maxWidth: width,
      89            0 :           chunk: [20, null, txtWidth + 2 * indent, if (item.error != null) 22],
      90            0 :           children: [
      91            0 :             [
      92            0 :               Icon(item.icon, color: item.color, size: 20),
      93              :             ],
      94            0 :             [
      95            0 :               TextWrapper(
      96            0 :                 item.title,
      97            0 :                 style: textTheme.headlineMedium?.copyWith(
      98            0 :                   fontStyle: item.skip ? FontStyle.italic : FontStyle.normal,
      99              :                 ),
     100              :               ),
     101              :             ],
     102            0 :             [
     103            0 :               Align(
     104              :                 alignment: Alignment.centerRight,
     105            0 :                 child: NumberWidget(
     106            0 :                   item.detailsFormatted,
     107            0 :                   colorScheme: context.colorScheme,
     108            0 :                   style: textTheme.numberMedium,
     109              :                 ),
     110              :               ),
     111              :             ],
     112            0 :             if (item.error != null) [item.error!],
     113              :           ],
     114              :         ),
     115            0 :         RowWidget(
     116              :           indent: indent,
     117            0 :           alignment: AppDesign.getAlignment<MainAxisAlignment>(),
     118            0 :           maxWidth: width,
     119            0 :           chunk: [
     120            0 :             typeWidth + indent / 2,
     121              :             null,
     122            0 :             if (showValidDate) ...[labelWidth + indent, dateWidth]
     123              :           ],
     124            0 :           children: [
     125            0 :             [
     126            0 :               TextWrapper(
     127            0 :                 AccountType.getLabel(item.type),
     128            0 :                 style: textTheme.bodySmall?.copyWith(fontWeight: FontWeight.bold),
     129              :               )
     130              :             ],
     131            0 :             [
     132            0 :               TextWrapper(
     133            0 :                 item.description ?? '',
     134            0 :                 style: textTheme.numberSmall,
     135              :               )
     136              :             ],
     137            0 :             if (showValidDate) ...[
     138            0 :               [
     139            0 :                 TextWrapper(
     140            0 :                   AppLocale.labels.validTillDate,
     141            0 :                   style: textTheme.bodySmall?.copyWith(fontWeight: FontWeight.bold),
     142              :                 )
     143              :               ],
     144            0 :               [
     145            0 :                 TextWrapper(
     146            0 :                   item.closedAtFormatted,
     147            0 :                   style: textTheme.numberSmall,
     148              :                 ),
     149              :               ],
     150              :             ]
     151              :           ],
     152              :         ),
     153              :       ],
     154              :     );
     155              :   }
     156              : }
        

Generated by: LCOV version 2.0-1