@@ -23,6 +23,40 @@ import 'package:provider/provider.dart';
23
23
import 'package:wger/helpers/misc.dart' ;
24
24
import 'package:wger/providers/auth.dart' ;
25
25
26
+ class AboutEntry extends StatelessWidget {
27
+ final String url;
28
+ final String title;
29
+ final String content;
30
+ final Icon icon;
31
+
32
+ const AboutEntry ({
33
+ required this .title,
34
+ required this .content,
35
+ required this .url,
36
+ required this .icon,
37
+ });
38
+
39
+ @override
40
+ Widget build (BuildContext context) {
41
+ return ListTile (
42
+ leading: icon,
43
+ title: Text (title),
44
+ subtitle: Column (
45
+ crossAxisAlignment: CrossAxisAlignment .start,
46
+ children: [
47
+ Text (content),
48
+ Text (
49
+ url,
50
+ style: const TextStyle (color: Colors .blue),
51
+ ),
52
+ ],
53
+ ),
54
+ contentPadding: EdgeInsets .zero,
55
+ onTap: () async => launchURL (url, context),
56
+ );
57
+ }
58
+ }
59
+
26
60
class AboutPage extends StatefulWidget {
27
61
static String routeName = '/AboutPage' ;
28
62
const AboutPage ({super .key});
@@ -89,91 +123,40 @@ class _AboutPageState extends State<AboutPage> {
89
123
AppLocalizations .of (context).aboutDescription,
90
124
style: Theme .of (context).textTheme.bodyMedium! .copyWith (fontSize: 16 ),
91
125
),
92
- SizedBox (height: 0.04 * deviceSize.height),
93
- ListTile (
94
- leading: const Icon (Icons .code),
95
- title: Text (AppLocalizations .of (context).aboutSourceTitle),
96
- subtitle: Column (
97
- crossAxisAlignment: CrossAxisAlignment .start,
98
- children: [
99
- Text (AppLocalizations .of (context).aboutSourceText),
100
- const Text (
101
- 'https://github.com/wger-project' ,
102
- style: TextStyle (color: Colors .blue),
103
- ),
104
- ],
105
- ),
106
- contentPadding: EdgeInsets .zero,
107
- onTap: () async => launchURL ('https://github.com/wger-project' , context),
126
+ const SizedBox (height: 10 ),
127
+ AboutEntry (
128
+ title: AppLocalizations .of (context).aboutSourceTitle,
129
+ content: AppLocalizations .of (context).aboutSourceText,
130
+ url: 'https://github.com/wger-project' ,
131
+ icon: const Icon (Icons .code),
108
132
),
109
133
const SizedBox (height: 10 ),
110
- ListTile (
111
- leading: const Icon (Icons .bug_report),
112
- title: Text (AppLocalizations .of (context).aboutBugsTitle),
113
- subtitle: Column (
114
- crossAxisAlignment: CrossAxisAlignment .start,
115
- children: [
116
- Text (AppLocalizations .of (context).aboutBugsText),
117
- const Text (
118
- 'https://github.com/wger-project/flutter/issues/new/choose' ,
119
- style: TextStyle (color: Colors .blue),
120
- )
121
- ],
122
- ),
123
- contentPadding: EdgeInsets .zero,
124
- onTap: () async =>
125
- launchURL ('https://github.com/wger-project/flutter/issues/new/choose' , context),
134
+ AboutEntry (
135
+ title: AppLocalizations .of (context).aboutBugsTitle,
136
+ content: AppLocalizations .of (context).aboutBugsText,
137
+ url: 'https://github.com/wger-project/flutter/issues/new/choose' ,
138
+ icon: const Icon (Icons .bug_report),
126
139
),
127
140
const SizedBox (height: 10 ),
128
- ListTile (
129
- leading: const Icon (FontAwesomeIcons .discord),
130
- title: Text (AppLocalizations .of (context).aboutContactUsTitle),
131
- subtitle: Column (
132
- crossAxisAlignment: CrossAxisAlignment .start,
133
- children: [
134
- Text (AppLocalizations .of (context).aboutContactUsText),
135
- const Text (
136
- 'https://discord.gg/rPWFv6W' ,
137
- style: TextStyle (color: Colors .blue),
138
- ),
139
- ],
140
- ),
141
- contentPadding: EdgeInsets .zero,
142
- onTap: () async => launchURL ('https://discord.gg/rPWFv6W' , context),
141
+ AboutEntry (
142
+ title: AppLocalizations .of (context).aboutContactUsTitle,
143
+ content: AppLocalizations .of (context).aboutContactUsText,
144
+ url: 'https://discord.gg/rPWFv6W' ,
145
+ icon: const Icon (FontAwesomeIcons .discord),
143
146
),
144
147
const SizedBox (height: 10 ),
145
- ListTile (
146
- leading: const Icon (FontAwesomeIcons .mastodon),
147
- title: Text (AppLocalizations .of (context).aboutMastodonTitle),
148
- subtitle: Column (
149
- crossAxisAlignment: CrossAxisAlignment .start,
150
- children: [
151
- Text (AppLocalizations .of (context).aboutMastodonText),
152
- const Text (
153
- 'https://fosstodon.org/@wger' ,
154
- style: TextStyle (color: Colors .blue),
155
- ),
156
- ],
157
- ),
158
- contentPadding: EdgeInsets .zero,
159
- onTap: () async => launchURL ('https://fosstodon.org/@wger' , context),
148
+ AboutEntry (
149
+ title: AppLocalizations .of (context).aboutMastodonTitle,
150
+ content: AppLocalizations .of (context).aboutMastodonText,
151
+ url: 'https://fosstodon.org/@wger' ,
152
+ icon: const Icon (FontAwesomeIcons .mastodon),
160
153
),
161
154
const SizedBox (height: 10 ),
162
- ListTile (
163
- leading: const Icon (Icons .translate),
164
- title: Text (AppLocalizations .of (context).aboutTranslationTitle),
165
- subtitle: Column (
166
- crossAxisAlignment: CrossAxisAlignment .start,
167
- children: [
168
- Text (AppLocalizations .of (context).aboutTranslationText),
169
- const Text (
170
- 'https://hosted.weblate.org/engage/wger/' ,
171
- style: TextStyle (color: Colors .blue),
172
- ),
173
- ],
174
- ),
175
- contentPadding: EdgeInsets .zero,
176
- onTap: () async => launchURL ('https://hosted.weblate.org/engage/wger/' , context),
155
+ AboutEntry (
156
+ title: AppLocalizations .of (context).aboutTranslationTitle,
157
+ content: AppLocalizations .of (context).aboutTranslationText,
158
+ url: 'https://hosted.weblate.org/engage/wger' ,
159
+ icon: const Icon (Icons .translate),
177
160
),
178
161
ListTile (
179
162
leading: const Icon (Icons .article),
0 commit comments