mirror of
https://github.com/seemoo-lab/openhaystack.git
synced 2026-05-18 22:46:41 +00:00
32 lines
717 B
Dart
32 lines
717 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class Hyperlink extends StatelessWidget {
|
|
/// The target url to open.
|
|
String target;
|
|
/// The display text of the hyperlink. Default is [target].
|
|
String _text;
|
|
|
|
/// Displays a hyperlink that can be opened by a tap.
|
|
Hyperlink({
|
|
Key? key,
|
|
required this.target,
|
|
text,
|
|
}) : _text = text ?? target, super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
child: Text(_text,
|
|
style: const TextStyle(
|
|
color: Colors.blue,
|
|
decoration: TextDecoration.underline,
|
|
),
|
|
),
|
|
onTap: () {
|
|
launch(target);
|
|
},
|
|
);
|
|
}
|
|
}
|