LCOV - code coverage report
Current view: top level - lib/design/wrapper - text_wrapper.dart Coverage Total Hit
Test: lcov.info Lines: 100.0 % 19 19
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/_configs/theme_helper.dart';
       6              : import 'package:material_ui/material_ui.dart';
       7              : 
       8              : class TextWrapper extends StatelessWidget {
       9              :   final String text;
      10              :   final TextStyle? style;
      11              :   final int maxLines;
      12              :   final String tooltip;
      13              :   final double? maxWidth;
      14              : 
      15            1 :   const TextWrapper(
      16              :     this.text, {
      17              :     super.key,
      18              :     String? tooltip,
      19              :     this.maxWidth,
      20              :     this.style = const TextStyle(),
      21              :     this.maxLines = 1,
      22              :   }) : tooltip = tooltip ?? text;
      23              : 
      24            1 :   @override
      25              :   Widget build(BuildContext context) {
      26            1 :     return LayoutBuilder(
      27            1 :       builder: (context, constraints) {
      28            2 :         final width = maxWidth ?? constraints.maxWidth;
      29            3 :         if (ThemeHelper.isTextExceedWidth(text, style, width)) {
      30            1 :           return SizedBox(
      31              :             width: width,
      32            1 :             child: Tooltip(
      33            1 :               message: tooltip,
      34            1 :               child: Text(
      35            1 :                 text,
      36            1 :                 style: style,
      37            1 :                 maxLines: maxLines,
      38              :                 overflow: TextOverflow.ellipsis,
      39            1 :                 textDirection: AppDesign.getAlignment<TextDirection>(),
      40              :               ),
      41              :             ),
      42              :           );
      43              :         } else {
      44            1 :           return Text(
      45            1 :             text,
      46            1 :             style: style,
      47            1 :             maxLines: maxLines,
      48              :             overflow: TextOverflow.ellipsis,
      49            1 :             textDirection: AppDesign.getAlignment<TextDirection>(),
      50              :           );
      51              :         }
      52              :       },
      53              :     );
      54              :   }
      55              : }
        

Generated by: LCOV version 2.0-1