TF-2057 Add event hyper link detail widget
(cherry picked from commit 8974e0ab37c2fa0b9097cae638b983e8600db4b2)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
class HyperLinkWidget extends StatelessWidget {
|
||||
|
||||
final String urlString;
|
||||
|
||||
const HyperLinkWidget({Key? key, required this.urlString}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
text: urlString,
|
||||
style: const TextStyle(
|
||||
color: AppColor.primaryColor,
|
||||
fontSize: 16,
|
||||
decoration: TextDecoration.underline
|
||||
),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async {
|
||||
if (await canLaunchUrlString(urlString)) {
|
||||
launchUrlString(
|
||||
urlString,
|
||||
mode: LaunchMode.externalApplication
|
||||
);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user