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 0 : const HeaderWidget({
16 : super.key,
17 : required this.count,
18 : required this.width,
19 : });
20 :
21 0 : @override
22 : Widget build(BuildContext context) {
23 0 : final indent = ThemeHelper.getIndent();
24 0 : final textStyle = context.textTheme.headlineSmall?.copyWith(color: context.colorScheme.primary);
25 0 : return Container(
26 0 : padding: EdgeInsets.fromLTRB(0, indent / 2, 0, 0),
27 : height: 30,
28 0 : decoration: BoxDecoration(
29 0 : border: Border(
30 0 : bottom: BorderSide(
31 0 : color: context.colorScheme.secondary.withOpacity(0.2),
32 : ),
33 : ),
34 : ),
35 0 : child: RowWidget(
36 0 : indent: ThemeHelper.getIndent(),
37 0 : maxWidth: width,
38 0 : chunk: [
39 : null,
40 0 : ...(count > 2 ? [0.3, 0.15, 0.1] : [0, 0, null])
41 : ],
42 0 : children: [
43 0 : [
44 0 : Padding(
45 0 : padding: EdgeInsets.only(left: indent * 3),
46 0 : child: TextWrapper(AppLocale.labels.title, style: textStyle),
47 : ),
48 : ],
49 0 : [
50 0 : Align(
51 : alignment: Alignment.centerRight,
52 0 : child: TextWrapper(AppLocale.labels.budgetLimit, style: textStyle),
53 : ),
54 : ],
55 0 : [
56 0 : Align(
57 : alignment: Alignment.centerRight,
58 0 : child: TextWrapper(AppLocale.labels.expense, style: textStyle),
59 : ),
60 : ],
61 0 : [
62 0 : Container(
63 : alignment: Alignment.centerRight,
64 0 : padding: EdgeInsets.only(right: indent),
65 0 : child: TextWrapper(AppLocale.labels.balance, style: textStyle),
66 : ),
67 : ],
68 : ],
69 : ),
70 : );
71 : }
72 : }
|