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:app_finance/design/wrapper/row_widget.dart'; 7 : import 'package:flutter/material.dart'; 8 : 9 : class TableWidget extends StatelessWidget { 10 : final List<List<Widget>> data; 11 : final List<double?> chunk; 12 : final Color shadowColor; 13 : final double width; 14 : 15 0 : const TableWidget({ 16 : super.key, 17 : required this.data, 18 : required this.width, 19 : required this.chunk, 20 : required this.shadowColor, 21 : }); 22 : 23 0 : @override 24 : Widget build(BuildContext context) { 25 0 : final length = data.isNotEmpty ? data.length + 1 : 0; 26 0 : return Column( 27 0 : children: List<Widget>.generate(length, (index) { 28 0 : if (index == 1) { 29 : return const Divider(thickness: 1); 30 : } 31 0 : final idx = index == 0 ? 0 : index - 1; 32 0 : return Container( 33 0 : color: idx > 0 && idx % 2 == 0 ? shadowColor : Colors.transparent, 34 0 : child: RowWidget( 35 0 : chunk: chunk, 36 0 : alignment: AppDesign.getInverseAlignment<MainAxisAlignment>(), 37 0 : indent: ThemeHelper.getIndent(), 38 0 : maxWidth: width, 39 0 : children: data[idx].map((o) => [o]).toList(), 40 : ), 41 : ); 42 : }), 43 : ); 44 : } 45 : }