LCOV - code coverage report
Current view: top level - lib/design/generic - base_line_widget.dart Coverage Total Hit
Test: lcov.info Lines: 93.0 % 43 40
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/_ext/build_context_ext.dart';
       7              : import 'package:app_finance/charts/bar_vertical_single.dart';
       8              : import 'package:app_finance/_configs/custom_text_theme.dart';
       9              : import 'package:app_finance/design/wrapper/number_wrapper.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/_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 BaseLineWidget extends StatelessWidget {
      17              :   final String uuid;
      18              :   final String title;
      19              :   final String details;
      20              :   final String description;
      21              :   final double progress;
      22              :   final Color color;
      23              :   final IconData? icon;
      24              :   final double width;
      25              :   final String route;
      26              :   final Map<String, dynamic>? routeCondition;
      27              :   final bool hidden;
      28              :   final bool skip;
      29              :   final bool showDivider;
      30              :   final Widget? error;
      31              : 
      32            2 :   const BaseLineWidget({
      33              :     super.key,
      34              :     required this.uuid,
      35              :     required this.title,
      36              :     required this.details,
      37              :     required this.description,
      38              :     required this.color,
      39              :     required this.width,
      40              :     this.icon = Icons.question_mark,
      41              :     this.error,
      42              :     this.hidden = false,
      43              :     this.skip = false,
      44              :     this.progress = 1,
      45              :     this.route = '',
      46              :     this.routeCondition,
      47              :     this.showDivider = true,
      48              :   });
      49              : 
      50            2 :   @override
      51              :   Widget build(BuildContext context) {
      52            2 :     if (hidden) {
      53              :       return ThemeHelper.emptyBox;
      54              :     }
      55            2 :     final textTheme = context.textTheme;
      56            2 :     final indent = ThemeHelper.getIndent();
      57            8 :     final txtWidth = ThemeHelper.getTextWidth(Text(details, style: textTheme.numberMedium));
      58              : 
      59            2 :     return TapWidget(
      60              :       tooltip: '',
      61            8 :       toWrap: route != '' && uuid != '',
      62            2 :       route: RouteSettings(
      63            2 :         name: route,
      64            6 :         arguments: routeCondition != null ? routeCondition! : {routeArguments.uuid: uuid},
      65              :       ),
      66            2 :       child: Column(
      67            2 :         crossAxisAlignment: AppDesign.getAlignment(),
      68            2 :         children: [
      69            2 :           RowWidget(
      70              :             indent: indent,
      71            2 :             alignment: AppDesign.getAlignment<MainAxisAlignment>(),
      72            2 :             maxWidth: width,
      73           12 :             chunk: [ThemeHelper.isWearable ? 0 : indent * 1.5, null, txtWidth + 2 * indent, if (error != null) 22],
      74            2 :             children: [
      75            2 :               [
      76            2 :                 Padding(
      77            2 :                   padding: EdgeInsets.only(left: indent),
      78            8 :                   child: BarVerticalSingle(value: progress, height: 32.0, width: indent / 2, color: color),
      79              :                 ),
      80              :               ],
      81            2 :               [
      82            2 :                 ThemeHelper.isWearable
      83            0 :                     ? Tooltip(
      84            0 :                         message: title,
      85            0 :                         child: Icon(icon, color: color),
      86              :                       )
      87            2 :                     : Column(
      88            2 :                         crossAxisAlignment: AppDesign.getAlignment(),
      89            2 :                         children: [
      90            2 :                           TextWrapper(
      91            2 :                             title,
      92            4 :                             style: textTheme.headlineMedium?.copyWith(
      93            2 :                               fontStyle: skip ? FontStyle.italic : FontStyle.normal,
      94              :                             ),
      95              :                           ),
      96            2 :                           TextWrapper(
      97            2 :                             description,
      98            2 :                             style: textTheme.bodySmall,
      99              :                           ),
     100              :                         ],
     101              :                       ),
     102              :               ],
     103            2 :               [
     104            2 :                 Align(
     105              :                   alignment: Alignment.centerRight,
     106            8 :                   child: NumberWidget(details, colorScheme: context.colorScheme, style: textTheme.numberMedium),
     107              :                 ),
     108              :               ],
     109            2 :               if (error != null) [error!],
     110              :             ],
     111              :           ),
     112            4 :           if (showDivider) const Divider(),
     113              :         ],
     114              :       ),
     115              :     );
     116              :   }
     117              : }
        

Generated by: LCOV version 2.0-1