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

Generated by: LCOV version 1.14