spotube/lib/components/Shared/Hyperlink.dart
Kingkor Roy Tirtho 9129c4d2b1 Linux package deps updated
pub asset images not found fix
2022-07-09 00:11:33 +06:00

38 lines
900 B
Dart

import 'package:flutter/material.dart';
import 'package:spotube/components/Shared/AnchorButton.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class Hyperlink extends StatelessWidget {
final String text;
final TextStyle style;
final TextAlign? textAlign;
final TextOverflow? overflow;
final String url;
const Hyperlink(
this.text,
this.url, {
Key? key,
this.textAlign,
this.overflow,
this.style = const TextStyle(),
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AnchorButton(
text,
onTap: () async {
await launchUrlString(
url,
mode: LaunchMode.externalApplication,
);
},
key: key,
overflow: overflow,
style: style.copyWith(color: Colors.blue),
textAlign: textAlign,
);
}
}