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/_classes/structure/navigation/app_route.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/tab_widget.dart';
9 : import 'package:app_finance/pages/home/widgets/goal_line_widget.dart';
10 : import 'package:app_finance/design/wrapper/tap_widget.dart';
11 : import 'package:material_ui/material_ui.dart';
12 :
13 : class GoalWidget extends StatelessWidget {
14 : final double? width;
15 : final List<dynamic> state;
16 :
17 1 : const GoalWidget({
18 : super.key,
19 : required this.state,
20 : this.width,
21 : });
22 :
23 1 : @override
24 : Widget build(BuildContext context) {
25 2 : if (state.isEmpty) {
26 1 : return TapWidget(
27 : route: const RouteSettings(name: AppRoute.goalAddRoute),
28 2 : tooltip: AppLocale.labels.addGoalTooltip,
29 1 : child: Container(
30 : width: double.infinity,
31 2 : padding: EdgeInsets.only(top: ThemeHelper.getIndent()),
32 1 : child: Container(
33 1 : decoration: BoxDecoration(
34 : shape: BoxShape.rectangle,
35 3 : color: context.colorScheme.primary.withValues(alpha: 0.2),
36 4 : border: Border.all(color: context.colorScheme.inverseSurface.withValues(alpha: 0.1), width: 1),
37 : ),
38 1 : child: Padding(
39 : padding: const EdgeInsets.only(top: 6),
40 1 : child: Center(
41 5 : child: Text(AppLocale.labels.addGoalTooltip, style: context.textTheme.headlineMedium),
42 : ),
43 : ),
44 : ),
45 : ),
46 : );
47 : }
48 0 : return SizedBox(
49 : height: 70,
50 0 : child: Transform.translate(
51 : offset: const Offset(0, 18),
52 0 : child: TabWidget(
53 : type: TabType.dots,
54 0 : maxWidth: width,
55 0 : children: state.map((e) => GoalLineWidget(goal: e, width: width)).toList(),
56 : ),
57 : ),
58 : );
59 : }
60 : }
|