|
1 | 1 | import 'package:flutter/material.dart'; |
2 | 2 | import 'package:open_authenticator/app.dart'; |
3 | 3 | import 'package:open_authenticator/i18n/translations.g.dart'; |
4 | | -import 'package:url_launcher/url_launcher.dart'; |
| 4 | +import 'package:open_authenticator/pages/settings/entries/uri_settings_entry.dart'; |
5 | 5 |
|
6 | 6 | /// Takes the user to Github to report bugs, suggest new features, ... |
7 | | -class GithubSettingsEntryWidget extends StatelessWidget { |
| 7 | +class GithubSettingsEntryWidget extends UriSettingsEntry { |
8 | 8 | /// Creates a new Github settings entry widget instance. |
9 | | - const GithubSettingsEntryWidget({ |
| 9 | + GithubSettingsEntryWidget({ |
10 | 10 | super.key, |
11 | | - }); |
| 11 | + }) : super( |
| 12 | + icon: Icons.bug_report, |
| 13 | + title: translations.settings.about.github.title, |
| 14 | + subtitle: translations.settings.about.github.subtitle, |
| 15 | + uri: Uri.parse(App.githubRepositoryUrl), |
| 16 | + ); |
12 | 17 |
|
13 | 18 | @override |
14 | | - Widget build(BuildContext context) => ListTile( |
15 | | - leading: const Icon(Icons.bug_report), |
16 | | - title: Text(translations.settings.about.github.title), |
17 | | - subtitle: Text(translations.settings.about.github.subtitle), |
18 | | - onTap: () async { |
19 | | - Uri uri = Uri.parse(App.githubRepositoryUrl); |
20 | | - Uri withFragment = Uri( |
21 | | - scheme: uri.scheme, |
22 | | - host: uri.host, |
23 | | - path: uri.path, |
24 | | - fragment: 'report-bugs-or-suggest-new-features', |
25 | | - ); |
26 | | - if (await canLaunchUrl(withFragment)) { |
27 | | - launchUrl(withFragment); |
28 | | - } |
29 | | - }, |
30 | | - ); |
| 19 | + Uri get uri { |
| 20 | + Uri uri = super.uri; |
| 21 | + return Uri( |
| 22 | + scheme: uri.scheme, |
| 23 | + host: uri.host, |
| 24 | + path: uri.path, |
| 25 | + fragment: 'report-bugs-or-suggest-new-features', |
| 26 | + ); |
| 27 | + } |
31 | 28 | } |
0 commit comments