LCOV - code coverage report
Current view: top level - lib/pages/budget/widgets - budget_line_widget.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 60 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/structure/navigation/app_route.dart';
       6              : import 'package:app_finance/_configs/custom_text_theme.dart';
       7              : import 'package:app_finance/_configs/theme_helper.dart';
       8              : import 'package:app_finance/_ext/build_context_ext.dart';
       9              : import 'package:app_finance/charts/bar_horizontal_single.dart';
      10              : import 'package:app_finance/design/generic/base_swipe_widget.dart';
      11              : import 'package:app_finance/design/wrapper/number_wrapper.dart';
      12              : import 'package:app_finance/design/wrapper/row_widget.dart';
      13              : import 'package:app_finance/design/wrapper/tap_widget.dart';
      14              : import 'package:app_finance/design/wrapper/text_wrapper.dart';
      15              : import 'package:material_ui/material_ui.dart';
      16              : 
      17              : class BudgetLineWidget extends StatelessWidget {
      18              :   final String uuid;
      19              :   final String title;
      20              :   final String details;
      21              :   final String description;
      22              :   final double progress;
      23              :   final String amount;
      24              :   final Color color;
      25              :   final IconData icon;
      26              :   final double width;
      27              :   final String route;
      28              :   final bool hidden;
      29              :   final bool showDivider;
      30              :   final int count;
      31              :   final bool skip;
      32              : 
      33            0 :   const BudgetLineWidget({
      34              :     super.key,
      35              :     required this.uuid,
      36              :     required this.title,
      37              :     required this.details,
      38              :     required this.description,
      39              :     required this.color,
      40              :     required this.amount,
      41              :     required this.icon,
      42              :     required this.width,
      43              :     this.count = 1,
      44              :     this.hidden = false,
      45              :     this.skip = false,
      46              :     this.progress = 1,
      47              :     this.route = '',
      48              :     this.showDivider = true,
      49              :   });
      50              : 
      51            0 :   @override
      52              :   Widget build(BuildContext context) {
      53            0 :     if (hidden) {
      54              :       return ThemeHelper.emptyBox;
      55              :     }
      56            0 :     final indent = ThemeHelper.getIndent();
      57            0 :     final textTheme = context.textTheme;
      58              :     const iconSize = 18.0;
      59            0 :     return BaseSwipeWidget(
      60              :       routePath: AppRoute.budgetEditRoute,
      61            0 :       uuid: uuid,
      62            0 :       child: TapWidget(
      63              :         tooltip: '',
      64            0 :         route: RouteSettings(name: route, arguments: {routeArguments.uuid: uuid}),
      65            0 :         child: Column(
      66            0 :           crossAxisAlignment: AppDesign.getAlignment(),
      67            0 :           children: [
      68            0 :             count > 2
      69            0 :                 ? Padding(
      70            0 :                     padding: EdgeInsets.symmetric(vertical: indent),
      71            0 :                     child: RowWidget(
      72              :                       chunk: const [20, null, 0.3, 0.15, 0.1],
      73              :                       indent: indent,
      74            0 :                       maxWidth: width,
      75            0 :                       children: [
      76            0 :                         [
      77            0 :                           Icon(icon, color: color, size: iconSize),
      78              :                         ],
      79            0 :                         [
      80            0 :                           TextWrapper(
      81            0 :                             title,
      82            0 :                             style: textTheme.headlineMedium?.copyWith(
      83            0 :                               fontStyle: skip ? FontStyle.italic : FontStyle.normal,
      84              :                             ),
      85              :                           ),
      86              :                         ],
      87            0 :                         [
      88            0 :                           Align(
      89              :                             alignment: Alignment.centerRight,
      90            0 :                             child: TextWrapper(description, style: textTheme.numberMedium),
      91              :                           ),
      92              :                         ],
      93            0 :                         [
      94            0 :                           Align(
      95              :                             alignment: Alignment.centerRight,
      96              :                             child:
      97            0 :                                 NumberWidget(amount, colorScheme: context.colorScheme, style: textTheme.numberMedium),
      98              :                           ),
      99              :                         ],
     100            0 :                         [
     101            0 :                           Container(
     102              :                             alignment: Alignment.centerRight,
     103            0 :                             padding: EdgeInsets.only(right: indent * 2),
     104              :                             child:
     105            0 :                                 NumberWidget(details, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     106              :                           ),
     107              :                         ],
     108              :                       ],
     109              :                     ),
     110              :                   )
     111            0 :                 : RowWidget(
     112            0 :                     chunk: [
     113              :                       iconSize,
     114              :                       null,
     115            0 :                       ThemeHelper.getTextWidth(Text(details, style: textTheme.numberMedium)),
     116              :                     ],
     117              :                     indent: indent,
     118            0 :                     maxWidth: width + indent,
     119            0 :                     children: [
     120            0 :                       [
     121            0 :                         Icon(icon, color: color, size: iconSize),
     122              :                       ],
     123            0 :                       if (description != '')
     124            0 :                         [
     125            0 :                           Column(
     126            0 :                             crossAxisAlignment: AppDesign.getAlignment(),
     127            0 :                             children: [
     128            0 :                               TextWrapper(
     129            0 :                                 title,
     130            0 :                                 style: textTheme.headlineMedium?.copyWith(
     131            0 :                                   fontStyle: skip ? FontStyle.italic : FontStyle.normal,
     132              :                                 ),
     133              :                               ),
     134            0 :                               TextWrapper(description, style: textTheme.numberSmall),
     135              :                             ],
     136              :                           ),
     137              :                         ]
     138              :                       else
     139            0 :                         [
     140            0 :                           Padding(
     141            0 :                             padding: EdgeInsets.fromLTRB(0, indent - 1, 0, indent - 1),
     142            0 :                             child: TextWrapper(title, style: textTheme.headlineMedium),
     143              :                           ),
     144              :                         ],
     145            0 :                       [
     146            0 :                         NumberWidget(details, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     147              :                       ]
     148              :                     ],
     149              :                   ),
     150            0 :             if (showDivider) ...[
     151              :               ThemeHelper.hIndent05,
     152            0 :               BarHorizontalSingle(value: progress, width: width, color: color),
     153              :               ThemeHelper.hIndent05,
     154              :             ],
     155              :           ],
     156              :         ),
     157              :       ),
     158              :     );
     159              :   }
     160              : }
        

Generated by: LCOV version 2.0-1