|
6 | 6 | import "package:auto_route/auto_route.dart"; |
7 | 7 | import "package:auto_size_text/auto_size_text.dart"; |
8 | 8 | import "package:flutter/material.dart"; |
| 9 | +import "package:flutter_hooks/flutter_hooks.dart"; |
9 | 10 | import "package:google_fonts/google_fonts.dart"; |
10 | 11 | import "package:hooks_riverpod/hooks_riverpod.dart"; |
11 | 12 | import "package:url_launcher/link.dart"; |
@@ -68,15 +69,13 @@ class _ExpandedWrapper extends HookConsumerWidget { |
68 | 69 | @override |
69 | 70 | Widget build(BuildContext context, WidgetRef ref) { |
70 | 71 | final theme = Theme.of(context); |
71 | | - final textStyle = theme.textTheme.bodyMedium; |
72 | 72 | final name = ref.watch(usernameProvider).valueOrNull; |
73 | 73 | final email = ref.watch(emailProvider).valueOrNull; |
74 | 74 | final avatar = ref.watch(avatarProvider).valueOrNull; |
75 | 75 | final mrDafoe = GoogleFonts.mrDafoe(); |
76 | 76 | final isMrDafoeLoaded = ref.watch( |
77 | 77 | isFontLoadedProvider(Fonts(families: [mrDafoe])), |
78 | 78 | ); |
79 | | - const githubLink = "https://github.com/PSDTools/app"; |
80 | 79 |
|
81 | 80 | return Scaffold( |
82 | 81 | appBar: AppBar( |
@@ -105,31 +104,10 @@ class _ExpandedWrapper extends HookConsumerWidget { |
105 | 104 | aboutBoxChildren: [ |
106 | 105 | const SizedBox(height: 24), |
107 | 106 | Link( |
108 | | - uri: Uri.parse(githubLink), |
| 107 | + uri: Uri.https("github.com", "PSDTools/app"), |
| 108 | + target: LinkTarget.blank, |
109 | 109 | builder: (context, followLink) { |
110 | | - final tapGestureRecognizer = useTapGestureRecognizer( |
111 | | - onTap: followLink, |
112 | | - ); |
113 | | - |
114 | | - return AutoSizeText.rich( |
115 | | - TextSpan( |
116 | | - children: [ |
117 | | - TextSpan( |
118 | | - style: textStyle, |
119 | | - text: |
120 | | - "Pattonville Wallet is hopefully going to become Pattonville School District's new app for reenforcing positive behavior. View the source at ", |
121 | | - ), |
122 | | - TextSpan( |
123 | | - style: textStyle?.copyWith( |
124 | | - color: theme.colorScheme.primary, |
125 | | - ), |
126 | | - text: githubLink, |
127 | | - recognizer: tapGestureRecognizer, |
128 | | - ), |
129 | | - TextSpan(style: textStyle, text: "."), |
130 | | - ], |
131 | | - ), |
132 | | - ); |
| 110 | + return _AppDescription(followLink: followLink); |
133 | 111 | }, |
134 | 112 | ), |
135 | 113 | ], |
@@ -188,6 +166,48 @@ class _ExpandedWrapper extends HookConsumerWidget { |
188 | 166 | } |
189 | 167 | } |
190 | 168 |
|
| 169 | +class _AppDescription extends HookWidget { |
| 170 | + const _AppDescription({ |
| 171 | + this.followLink, |
| 172 | + // Temporary ignore, see <dart-lang/sdk#49025>. |
| 173 | + // ignore: unused_element |
| 174 | + super.key, |
| 175 | + }); |
| 176 | + |
| 177 | + final GestureTapCallback? followLink; |
| 178 | + |
| 179 | + @override |
| 180 | + Widget build(BuildContext context) { |
| 181 | + final theme = Theme.of(context); |
| 182 | + |
| 183 | + final textStyle = theme.textTheme.bodyMedium; |
| 184 | + |
| 185 | + final tapGestureRecognizer = useTapGestureRecognizer( |
| 186 | + onTap: followLink, |
| 187 | + ); |
| 188 | + |
| 189 | + return Text.rich( |
| 190 | + TextSpan( |
| 191 | + style: textStyle, |
| 192 | + children: [ |
| 193 | + const TextSpan( |
| 194 | + text: |
| 195 | + "Pattonville Wallet is hopefully going to become Pattonville School District's new app for reenforcing positive behavior. View the source at ", |
| 196 | + ), |
| 197 | + TextSpan( |
| 198 | + style: textStyle?.copyWith( |
| 199 | + color: theme.colorScheme.primary, |
| 200 | + ), |
| 201 | + text: "github:PSDTools/app", |
| 202 | + recognizer: tapGestureRecognizer, |
| 203 | + ), |
| 204 | + const TextSpan(text: "."), |
| 205 | + ], |
| 206 | + ), |
| 207 | + ); |
| 208 | + } |
| 209 | +} |
| 210 | + |
191 | 211 | class _MobileWrapper extends StatelessWidget { |
192 | 212 | const _MobileWrapper({ |
193 | 213 | required this.child, |
|
0 commit comments