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:material_ui/material_ui.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 : final indent = ThemeHelper.getIndent();
27 0 : return Column(
28 0 : children: List<Widget>.generate(length, (index) {
29 0 : if (index == 1) {
30 : return const Divider(thickness: 1);
31 : }
32 0 : final idx = index == 0 ? 0 : index - 1;
33 0 : return Container(
34 0 : color: idx > 0 && idx % 2 == 0 ? shadowColor : Colors.transparent,
35 0 : child: RowWidget(
36 0 : chunk: chunk,
37 0 : alignment: AppDesign.getInverseAlignment<MainAxisAlignment>(),
38 : indent: indent,
39 0 : maxWidth: width,
40 0 : children: data[idx].map((o) => [o]).toList(),
41 : ),
42 : );
43 : }),
44 : );
45 : }
46 : }
|