initial links page

This commit is contained in:
2024-09-06 20:43:35 -04:00
parent fb38a3f313
commit 36b2d21ae1
3 changed files with 99 additions and 2 deletions

44
lib/EasyLinkWidget.dart Normal file
View File

@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:ything_radio/EasyLink.dart';
class EasyLinkWidget extends StatelessWidget {
final EasyLink linkInfo;
const EasyLinkWidget({super.key, required this.linkInfo});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
_launchUrl();
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
FittedBox(
child: Center(
child: Icon(linkInfo.icon),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: 8.0,
),
child: Text(linkInfo.displayText),
),
),
],
),
),
);
}
Future<void> _launchUrl() async {
if (!await launchUrl(Uri.parse(linkInfo.uri))) {
throw Exception('Could not launch url');
}
}
}