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/_mixins/launcher_mixin.dart';
8 : import 'package:app_finance/design/wrapper/markdown_builder_wrapper.dart';
9 : import 'package:app_finance/pages/_interfaces/abstract_page_state.dart';
10 : import 'package:app_finance/design/wrapper/row_widget.dart';
11 : import 'package:app_finance/design/wrapper/tab_widget.dart';
12 : import 'package:app_finance/design/wrapper/text_wrapper.dart';
13 : import 'package:app_finance/pages/about/widgets/members_tab.dart';
14 : import 'package:flutter/material.dart';
15 : import 'package:package_info_plus/package_info_plus.dart';
16 :
17 : class AboutPage extends StatefulWidget {
18 : final String? search;
19 :
20 0 : const AboutPage({super.key, this.search});
21 :
22 0 : @override
23 0 : AboutPageState createState() => AboutPageState();
24 : }
25 :
26 : class AboutPageState extends AbstractPageState<AboutPage> with LauncherMixin {
27 : String version = '';
28 : String buildNumber = '';
29 :
30 0 : @override
31 : void initState() {
32 0 : PackageInfo.fromPlatform().then((PackageInfo value) {
33 0 : setState(() {
34 0 : version = value.version;
35 0 : buildNumber = value.buildNumber;
36 : });
37 : });
38 0 : super.initState();
39 : }
40 :
41 0 : @override
42 : String? getHelperName() => 'upgrade';
43 :
44 0 : @override
45 0 : String getTitle() => AppLocale.labels.aboutHeadline;
46 :
47 0 : @override
48 : String getButtonName() => '';
49 :
50 0 : @override
51 : Widget buildButton(BuildContext context, BoxConstraints constraints) => ThemeHelper.emptyBox;
52 :
53 0 : Widget buildMarkdown(String name) => MarkdownBuilderWrapper(url: './assets/l10n/$name.md');
54 :
55 0 : @override
56 : Widget buildContent(BuildContext context, BoxConstraints constraints) {
57 0 : double indent = ThemeHelper.getIndent();
58 0 : double width = ThemeHelper.getWidth(context, 2, constraints);
59 0 : final locale = AppLocale.labels.localeName;
60 0 : return Padding(
61 0 : padding: EdgeInsets.fromLTRB(indent, indent, indent, 0),
62 0 : child: Column(
63 0 : children: [
64 0 : RowWidget(
65 : alignment: MainAxisAlignment.spaceEvenly,
66 : indent: indent,
67 : maxWidth: width,
68 : chunk: const [60, null, null],
69 0 : children: [
70 0 : [
71 0 : Image.asset(
72 : 'assets/images/logo.png',
73 : width: 60,
74 : height: 60,
75 : ),
76 : ],
77 0 : [
78 0 : TextWrapper(
79 0 : AppLocale.labels.appTitle,
80 0 : style: context.textTheme.headlineLarge,
81 : ),
82 : ],
83 0 : [
84 0 : TextWrapper(AppLocale.labels.appVersion(version)),
85 0 : TextWrapper(AppLocale.labels.appBuild(buildNumber)),
86 : ],
87 : ],
88 : ),
89 : const Divider(),
90 0 : RowWidget(
91 : indent: indent,
92 : maxWidth: width,
93 : alignment: MainAxisAlignment.spaceEvenly,
94 : chunk: const [null, null, null],
95 0 : children: [
96 0 : [
97 0 : ElevatedButton(
98 0 : onPressed: () => openURL('https://github.com/lyskouski/app-finance/releases'),
99 0 : child: TextWrapper(AppLocale.labels.releases),
100 : ),
101 : ],
102 0 : [
103 0 : Center(
104 0 : child: ElevatedButton(
105 0 : onPressed: () => openURL('https://github.com/users/lyskouski/projects/2/views/1'),
106 0 : child: TextWrapper(AppLocale.labels.roadmap),
107 : ),
108 : ),
109 : ],
110 0 : [
111 0 : Align(
112 : alignment: Alignment.centerRight,
113 0 : child: ElevatedButton(
114 0 : onPressed: () => openURL('https://github.com/lyskouski/app-finance/milestones'),
115 0 : child: TextWrapper(AppLocale.labels.milestones),
116 : ),
117 : ),
118 : ],
119 : ],
120 : ),
121 : const Divider(),
122 0 : Expanded(
123 0 : child: TabWidget(
124 : type: TabType.secondary,
125 0 : focus: double.tryParse(widget.search ?? '0')?.toInt() ?? 0,
126 0 : tabs: [
127 0 : Tab(text: AppLocale.labels.contributors, icon: const Icon(Icons.people)),
128 0 : Tab(text: AppLocale.labels.termPrivacy, icon: const Icon(Icons.privacy_tip)),
129 0 : Tab(text: AppLocale.labels.termUse, icon: const Icon(Icons.data_usage)),
130 : ],
131 0 : children: [
132 : const MembersTab(),
133 0 : buildMarkdown('privacy_policy_$locale'),
134 0 : buildMarkdown('terms_of_use_$locale'),
135 : ],
136 : ),
137 : ),
138 : ],
139 : ),
140 : );
141 : }
142 : }
|