LCOV - code coverage report
Current view: top level - lib/pages/goal/widgets - goal_line_widget.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 47 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_design.dart';
       5              : import 'package:app_finance/_classes/herald/app_locale.dart';
       6              : import 'package:app_finance/_classes/structure/navigation/app_route.dart';
       7              : import 'package:app_finance/_configs/custom_text_theme.dart';
       8              : import 'package:app_finance/_configs/theme_helper.dart';
       9              : import 'package:app_finance/_ext/build_context_ext.dart';
      10              : import 'package:app_finance/charts/bar_horizontal_single.dart';
      11              : import 'package:app_finance/design/generic/base_swipe_widget.dart';
      12              : import 'package:app_finance/design/wrapper/number_wrapper.dart';
      13              : import 'package:app_finance/design/wrapper/row_widget.dart';
      14              : import 'package:app_finance/design/wrapper/tap_widget.dart';
      15              : import 'package:app_finance/design/wrapper/text_wrapper.dart';
      16              : import 'package:material_ui/material_ui.dart';
      17              : import 'package:flutter_currency_picker/flutter_currency_picker.dart';
      18              : 
      19              : class GoalLineWidget extends StatelessWidget {
      20              :   final String uuid;
      21              :   final String title;
      22              :   final double details;
      23              :   final String description;
      24              :   final double progress;
      25              :   final Color color;
      26              :   final IconData icon;
      27              :   final double width;
      28              :   final String route;
      29              :   final bool hidden;
      30              :   final bool showDivider;
      31              :   final int count;
      32              :   final Currency? currency;
      33              : 
      34            0 :   const GoalLineWidget({
      35              :     super.key,
      36              :     required this.uuid,
      37              :     required this.title,
      38              :     required this.details,
      39              :     required this.description,
      40              :     required this.color,
      41              :     required this.icon,
      42              :     required this.currency,
      43              :     required this.width,
      44              :     this.count = 2,
      45              :     this.hidden = 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 :     final targetFormatted = details.toCurrency(currency: currency, withPattern: false);
      60            0 :     final curFormatted = (details * progress).toCurrency(currency: currency, withPattern: false);
      61            0 :     return BaseSwipeWidget(
      62              :       routePath: AppRoute.budgetEditRoute,
      63            0 :       uuid: uuid,
      64            0 :       child: TapWidget(
      65              :         tooltip: '',
      66            0 :         route: RouteSettings(name: route, arguments: {routeArguments.uuid: uuid}),
      67            0 :         child: Column(
      68            0 :           crossAxisAlignment: AppDesign.getAlignment(),
      69            0 :           children: [
      70            0 :             RowWidget(
      71            0 :               chunk: [
      72              :                 iconSize,
      73              :                 null,
      74            0 :                 ...(count > 2 ? [0.2, 0.15, 0.1, 0.1] : [0, 0, 0, null])
      75              :               ],
      76              :               indent: indent,
      77            0 :               maxWidth: width + indent,
      78            0 :               children: [
      79            0 :                 [
      80            0 :                   Padding(padding: EdgeInsets.only(top: indent), child: Icon(icon, color: color, size: iconSize)),
      81              :                 ],
      82            0 :                 if (description != '' && count < 2)
      83            0 :                   [
      84            0 :                     Column(
      85            0 :                       crossAxisAlignment: AppDesign.getAlignment(),
      86            0 :                       children: [
      87            0 :                         TextWrapper(title, style: textTheme.headlineMedium),
      88            0 :                         TextWrapper(AppLocale.labels.goalProfit(description), style: textTheme.numberSmall),
      89              :                       ],
      90              :                     ),
      91              :                   ]
      92              :                 else
      93            0 :                   [
      94            0 :                     Padding(
      95            0 :                       padding: EdgeInsets.fromLTRB(0, indent - 1, 0, indent - 1),
      96            0 :                       child: TextWrapper(title, style: textTheme.headlineMedium),
      97              :                     ),
      98              :                   ],
      99            0 :                 [
     100            0 :                   Align(
     101              :                     alignment: Alignment.centerRight,
     102            0 :                     child: NumberWidget(description, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     103              :                   ),
     104              :                 ],
     105            0 :                 [
     106            0 :                   Align(
     107              :                     alignment: Alignment.centerRight,
     108            0 :                     child: NumberWidget(curFormatted, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     109              :                   ),
     110              :                 ],
     111            0 :                 [
     112            0 :                   Align(
     113              :                     alignment: Alignment.centerRight,
     114            0 :                     child: NumberWidget('${(progress * 100).toStringAsFixed(2)}%',
     115            0 :                         colorScheme: context.colorScheme, style: textTheme.numberMedium),
     116              :                   ),
     117              :                 ],
     118            0 :                 [
     119            0 :                   Align(
     120              :                     alignment: Alignment.centerRight,
     121              :                     child:
     122            0 :                         NumberWidget(targetFormatted, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     123              :                   ),
     124              :                 ]
     125              :               ],
     126              :             ),
     127            0 :             if (showDivider) ...[
     128              :               ThemeHelper.hIndent05,
     129            0 :               BarHorizontalSingle(value: progress, width: width, color: color),
     130              :               ThemeHelper.hIndent05,
     131              :             ],
     132              :           ],
     133              :         ),
     134              :       ),
     135              :     );
     136              :   }
     137              : }
        

Generated by: LCOV version 2.0-1