HyperLink class
A widget for displaying text with clickable hyperlinks.
Hyperlinks should be in the format "(link_title)link_address
". For example:
"Click here to visit (Google)https://www.google.com
".
This widget uses regular expressions to identify hyperlinks in the text and applies the linkStyle to them. The textStyle is applied to the rest of the text.
When a hyperlink is tapped, it attempts to launch the provided URL using the url_launcher package. If the URL is successfully launched, it opens the link in the default browser.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- HyperLink
Constructors
- HyperLink.new({Key? key, required String text, TextStyle? linkStyle, TextStyle? textStyle, LaunchMode mode = LaunchMode.platformDefault, WebViewConfiguration webViewConfiguration = const WebViewConfiguration(), String? webOnlyWindowName, PointerEnterEventListener? linkOnEnter, PointerExitEventListener? linkOnExit, TextAlign textAlign = TextAlign.start, TextDirection? textDirection, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, int? maxLines, Locale? locale, StrutStyle? strutStyle, TextWidthBasis textWidthBasis = TextWidthBasis.parent, TextHeightBehavior? textHeightBehavior, SelectionRegistrar? selectionRegistrar, Color? selectionColor, LinkCallBack? linkCallBack})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- linkCallBack → LinkCallBack?
-
This callback returns the link instead of opening the URL if initialized.
final
- linkOnEnter → PointerEnterEventListener?
-
Called when a pointer enters the link.
final
- linkOnExit → PointerExitEventListener?
-
Called when a pointer exits the link.
final
- linkStyle → TextStyle?
-
The style of the hyperlink text.
final
- locale → Locale?
-
The locale for this text.
final
- maxLines → int?
-
The maximum number of lines for the text to span, wrapping if necessary.
final
- mode → LaunchMode
-
The launch mode for opening URLs.
final
- overflow → TextOverflow
-
How visual overflow should be handled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionColor → Color?
-
The color to use when highlighting the text for selection.
final
- selectionRegistrar → SelectionRegistrar?
-
The registrar for text selection.
final
- softWrap → bool
-
Whether the text should break at soft line breaks.
final
- strutStyle → StrutStyle?
-
The strut style to use.
final
- text → String
-
The text to display, including hyperlinks.
final
- textAlign → TextAlign
-
The text alignment.
final
- textDirection → TextDirection?
-
The text direction.
final
- textHeightBehavior → TextHeightBehavior?
-
The height behavior to use.
final
- textStyle → TextStyle?
-
The style of the non-link text.
final
- textWidthBasis → TextWidthBasis
-
The width basis for the text layout.
final
- webOnlyWindowName → String?
-
The name of the web-only window.
final
- webViewConfiguration → WebViewConfiguration
-
The configuration for web view.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited