1
0
Fork 0
mrtiboute/lib/widgets/components/link.dart

23 lines
579 B
Dart
Raw Normal View History

2022-03-30 21:37:32 +02:00
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class Link extends StatelessWidget {
2022-03-30 23:45:27 +02:00
const Link({Key? key, required this.uri, this.label}) : super(key: key);
2022-03-30 21:37:32 +02:00
final String uri;
2022-03-30 23:45:27 +02:00
final String? label;
2022-03-30 21:37:32 +02:00
@override
Widget build(BuildContext context) {
2022-03-30 21:44:38 +02:00
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
2022-03-30 23:45:27 +02:00
child: Text(label ?? uri,
2022-03-30 21:44:38 +02:00
style: const TextStyle(decoration: TextDecoration.underline)),
onTap: () {
launch(uri);
}),
);
2022-03-30 21:37:32 +02:00
}
}