LCOV - code coverage report
Current view: top level - lib/charts - bar_vertical_group.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 16 0.0 %
Date: 2024-10-04 11:09:33 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:flutter/material.dart';
       5             : 
       6             : class BarVerticalGroup extends StatelessWidget {
       7             :   final List<Color> color;
       8             :   final List<double> value;
       9             :   final double height;
      10             :   final double width;
      11             : 
      12           0 :   const BarVerticalGroup({
      13             :     super.key,
      14             :     required this.color,
      15             :     required this.value,
      16             :     this.height = 32,
      17             :     this.width = 4,
      18             :   });
      19             : 
      20           0 :   @override
      21             :   Widget build(BuildContext context) {
      22           0 :     double left = value.fold(1.0, (v, e) => v - e);
      23           0 :     value.insert(0, left < 0 ? 0.0 : left);
      24           0 :     color.insert(0, Colors.grey);
      25           0 :     return SizedBox(
      26           0 :       width: width,
      27           0 :       height: height,
      28           0 :       child: ListView.builder(
      29           0 :         itemCount: value.length,
      30           0 :         itemBuilder: (context, index) {
      31           0 :           return Container(
      32           0 :             color: color[index],
      33           0 :             child: SizedBox(
      34           0 :               width: width,
      35           0 :               height: height * (value[index] > 0 ? value[index] : 0.0),
      36             :             ),
      37             :           );
      38             :         },
      39             :       ),
      40             :     );
      41             :   }
      42             : }

Generated by: LCOV version 1.14