LCOV - code coverage report
Current view: top level - lib/pages/bill/widgets - bill_line_widget.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 60 0.0 %
Date: 2024-10-04 11:12: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_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/design/wrapper/row_widget.dart';
      11             : import 'package:app_finance/design/wrapper/tap_widget.dart';
      12             : import 'package:app_finance/design/wrapper/text_wrapper.dart';
      13             : import 'package:flutter/material.dart';
      14             : 
      15             : class BillLineWidget extends StatelessWidget {
      16             :   final String uuid;
      17             :   final String title;
      18             :   final String details;
      19             :   final String description;
      20             :   final Color descriptionColor;
      21             :   final double progress;
      22             :   final Color color;
      23             :   final IconData icon;
      24             :   final String iconTooltip;
      25             :   final String route;
      26             :   final bool hidden;
      27             :   final double width;
      28             :   final int count;
      29             : 
      30           0 :   const BillLineWidget({
      31             :     super.key,
      32             :     required this.uuid,
      33             :     required this.title,
      34             :     required this.details,
      35             :     required this.description,
      36             :     required this.descriptionColor,
      37             :     required this.color,
      38             :     required this.icon,
      39             :     required this.iconTooltip,
      40             :     required this.width,
      41             :     this.count = 1,
      42             :     this.hidden = false,
      43             :     this.progress = 1,
      44             :     this.route = '',
      45             :   });
      46             : 
      47           0 :   @override
      48             :   Widget build(BuildContext context) {
      49           0 :     if (hidden) {
      50             :       return ThemeHelper.emptyBox;
      51             :     }
      52           0 :     final indent = ThemeHelper.getIndent(0.5);
      53           0 :     final textTheme = context.textTheme;
      54             : 
      55           0 :     return Padding(
      56           0 :       padding: EdgeInsets.fromLTRB(indent, indent, indent * 2, indent),
      57           0 :       child: TapWidget(
      58             :         tooltip: '',
      59           0 :         route: RouteSettings(name: route, arguments: {routeArguments.uuid: uuid}),
      60           0 :         child: count > 2
      61           0 :             ? RowWidget(
      62           0 :                 maxWidth: width,
      63             :                 indent: indent,
      64             :                 chunk: const [24, null, 0.2, 0.2, 0.1],
      65           0 :                 children: [
      66           0 :                   [
      67           0 :                     Padding(
      68           0 :                       padding: EdgeInsets.only(top: indent, left: indent),
      69           0 :                       child: Icon(icon, color: color, size: 20),
      70             :                     ),
      71             :                   ],
      72           0 :                   [
      73           0 :                     Padding(
      74           0 :                       padding: EdgeInsets.only(top: indent),
      75           0 :                       child: TextWrapper(title, style: textTheme.headlineMedium),
      76             :                     ),
      77             :                   ],
      78           0 :                   [
      79           0 :                     TextWrapper(AppLocale.labels.account, style: textTheme.bodySmall),
      80           0 :                     TextWrapper(
      81           0 :                       description,
      82           0 :                       style: textTheme.headlineMedium?.copyWith(
      83           0 :                         color: Color.alphaBlend(descriptionColor.withOpacity(0.4), context.colorScheme.secondary),
      84             :                       ),
      85             :                     ),
      86             :                   ],
      87           0 :                   [
      88           0 :                     TextWrapper(AppLocale.labels.budget, style: textTheme.bodySmall),
      89           0 :                     TextWrapper(
      90           0 :                       iconTooltip,
      91           0 :                       style: textTheme.headlineMedium?.copyWith(
      92           0 :                         color: Color.alphaBlend(color.withOpacity(0.4), context.colorScheme.secondary),
      93             :                       ),
      94             :                     ),
      95             :                   ],
      96           0 :                   [
      97           0 :                     Container(
      98             :                       alignment: Alignment.centerRight,
      99           0 :                       padding: EdgeInsets.only(top: indent, right: indent),
     100           0 :                       child: TextWrapper(details, style: textTheme.numberMedium),
     101             :                     ),
     102             :                   ]
     103             :                 ],
     104             :               )
     105           0 :             : RowWidget(
     106           0 :                 chunk: [
     107             :                   20,
     108             :                   null,
     109           0 :                   ThemeHelper.getTextWidth(Text(
     110           0 :                     details,
     111             :                     maxLines: 1,
     112           0 :                     style: textTheme.numberMedium,
     113             :                     overflow: TextOverflow.ellipsis,
     114             :                   )),
     115             :                 ],
     116           0 :                 indent: indent * 2,
     117           0 :                 maxWidth: width,
     118           0 :                 children: [
     119           0 :                   [
     120           0 :                     Tooltip(
     121           0 :                       message: iconTooltip,
     122           0 :                       child: Icon(icon, color: color, size: 20),
     123             :                     ),
     124             :                   ],
     125           0 :                   [
     126           0 :                     Column(
     127           0 :                       crossAxisAlignment: AppDesign.getAlignment(),
     128           0 :                       children: [
     129           0 :                         TextWrapper(title, style: textTheme.headlineMedium),
     130           0 :                         TextWrapper(
     131           0 :                           description,
     132           0 :                           style: textTheme.numberSmall.copyWith(
     133           0 :                             color: Color.alphaBlend(descriptionColor.withOpacity(0.4), context.colorScheme.secondary),
     134             :                           ),
     135             :                         ),
     136             :                       ],
     137             :                     ),
     138             :                   ],
     139           0 :                   [
     140           0 :                     TextWrapper(details, style: textTheme.numberMedium),
     141             :                   ]
     142             :                 ],
     143             :               ),
     144             :       ),
     145             :     );
     146             :   }
     147             : }

Generated by: LCOV version 1.14