Add functionality to Help buttons for opening URLs.
This commit is contained in:
parent
dec343af09
commit
9f7773f724
@ -42,5 +42,10 @@
|
|||||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain"/>
|
||||||
</intent>
|
</intent>
|
||||||
|
<!-- Allow opening of web URLs -->
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:scheme="https" />
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
|
// Flutter
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
|
_launchSite(String url) async {
|
||||||
|
try {
|
||||||
|
if (await canLaunchUrlString(url)) {
|
||||||
|
await launchUrlString(
|
||||||
|
url,
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw "System does not think it can launch '$url'.";
|
||||||
|
}
|
||||||
|
} on Exception catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class HelpPage extends StatelessWidget {
|
class HelpPage extends StatelessWidget {
|
||||||
const HelpPage({
|
const HelpPage({
|
||||||
@ -41,7 +58,9 @@ class HelpPage extends StatelessWidget {
|
|||||||
color: theme.colorScheme.onPrimary,
|
color: theme.colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
_launchSite("https://git.hyperling.com/me");
|
||||||
|
},
|
||||||
icon: Icon(Icons.code),
|
icon: Icon(Icons.code),
|
||||||
label: Text("Code Repository"),
|
label: Text("Code Repository"),
|
||||||
),
|
),
|
||||||
@ -57,7 +76,9 @@ class HelpPage extends StatelessWidget {
|
|||||||
color: theme.colorScheme.onPrimary,
|
color: theme.colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
_launchSite("https://hyperling.com");
|
||||||
|
},
|
||||||
icon: Icon(Icons.web_asset),
|
icon: Icon(Icons.web_asset),
|
||||||
label: Text("Personal Website"),
|
label: Text("Personal Website"),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user