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