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_locale.dart';
5 : import 'package:app_finance/_configs/theme_helper.dart';
6 : import 'package:app_finance/_ext/build_context_ext.dart';
7 : import 'package:app_finance/design/wrapper/row_widget.dart';
8 : import 'package:app_finance/design/wrapper/text_wrapper.dart';
9 : import 'package:flutter/material.dart';
10 :
11 : class HeaderWidget extends StatelessWidget {
12 : final int count;
13 : final double width;
14 :
15 1 : const HeaderWidget({
16 : super.key,
17 : required this.count,
18 : required this.width,
19 : });
20 :
21 1 : @override
22 : Widget build(BuildContext context) {
23 1 : final indent = ThemeHelper.getIndent();
24 5 : final textStyle = context.textTheme.headlineSmall?.copyWith(color: context.colorScheme.primary);
25 1 : return Container(
26 2 : padding: EdgeInsets.fromLTRB(0, indent / 2, 0, 0),
27 : height: 30,
28 1 : decoration: BoxDecoration(
29 1 : border: Border(
30 1 : bottom: BorderSide(
31 3 : color: context.colorScheme.secondary.withOpacity(0.2),
32 : ),
33 : ),
34 : ),
35 1 : child: RowWidget(
36 1 : indent: ThemeHelper.getIndent(),
37 1 : maxWidth: width,
38 1 : chunk: [
39 : null,
40 4 : ...(count > 2 ? [0.2, 0.15, 0.1, 0.1] : [0, 0, 0, null])
41 : ],
42 1 : children: [
43 1 : [
44 1 : Padding(
45 2 : padding: EdgeInsets.only(left: indent * 3),
46 3 : child: TextWrapper(AppLocale.labels.titleGoal, style: textStyle),
47 : ),
48 : ],
49 1 : [
50 1 : Align(
51 : alignment: Alignment.centerRight,
52 3 : child: TextWrapper(AppLocale.labels.validTillDate, style: textStyle),
53 : ),
54 : ],
55 1 : [
56 1 : Align(
57 : alignment: Alignment.centerRight,
58 5 : child: TextWrapper(AppLocale.labels.netProfit(AppLocale.labels.currency), style: textStyle),
59 : ),
60 : ],
61 1 : [
62 1 : Align(
63 : alignment: Alignment.centerRight,
64 3 : child: TextWrapper(AppLocale.labels.netProfit('%'), style: textStyle),
65 : ),
66 : ],
67 1 : [
68 1 : Container(
69 : alignment: Alignment.centerRight,
70 2 : padding: EdgeInsets.only(right: indent / 2),
71 3 : child: TextWrapper(AppLocale.labels.targetAmount, style: textStyle),
72 : ),
73 : ],
74 : ],
75 : ),
76 : );
77 : }
78 : }
|