AnyLinkPreview class

Inheritance

Constructors

AnyLinkPreview({Key? key, required String link, Duration cache = const Duration(days: 1), TextStyle? titleStyle, TextStyle? bodyStyle, UIDirection displayDirection = UIDirection.uiDirectionVertical, bool showMultimedia = true, Color? backgroundColor = const Color.fromRGBO(235, 235, 235, 1), int bodyMaxLines = 3, TextOverflow bodyTextOverflow = TextOverflow.ellipsis, Widget? placeholderWidget, Widget? errorWidget, String? errorBody, String? errorImage, String? errorTitle, double? borderRadius, List<BoxShadow>? boxShadow, bool removeElevation = false, String? proxyUrl, Map<String, String>? headers, void onTap()?, double? previewHeight, LaunchMode urlLaunchMode = LaunchMode.platformDefault})
AnyLinkPreview.builder({Key? key, required String link, required Widget itemBuilder(BuildContext, Metadata, ImageProvider<Object>?, SvgPicture?)?, Duration cache = const Duration(days: 1), Widget? placeholderWidget, Widget? errorWidget, String? proxyUrl, Map<String, String>? headers})

Properties

backgroundColor Color?
Customize background colour Defaults to Color.fromRGBO(235, 235, 235, 1)
final
bodyMaxLines int
Give the limit to body text (Description) Defaults to 3
final
bodyStyle TextStyle?
Customize body TextStyle
final
bodyTextOverflow TextOverflow
Give the overflow type for body text (Description) Deaults to TextOverflow.ellipsis
final
borderRadius double?
BorderRadius for the card. Deafults to 12
final
boxShadow List<BoxShadow>?
Box shadow for the card. Deafults to [BoxShadow(blurRadius: 3, color: Colors.grey)]
final
cache Duration
Cache result time, default cache 1 day Pass null to disable or to fetch latest
final
displayDirection UIDirection
Display direction. One among uiDirectionVertical, uiDirectionHorizontal By default it is uiDirectionVertical
final
errorBody String?
Body that need to be shown if something goes wrong Defaults to Oops! Unable to parse the url. We have sent feedback to our developers & we will try to fix this in our next release. Thanks!
final
errorImage String?
Image that will be shown if something goes wrong & when multimedia enabled & no meta data is available Defaults to A semi-soccer ball image that looks like crying
final
errorTitle String?
Title that need to be shown if something goes wrong Defaults to Something went wrong!
final
errorWidget Widget?
Widget that need to be shown if something goes wrong Defaults to plain container with given background colour If the issue is know then we will show customized UI Other options of error params are used
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Headers to be added in the HTTP request to the link
final
itemBuilder → (Widget Function(BuildContext, Metadata, ImageProvider<Object>?, SvgPicture?)?)
Function only in AnyLinkPreview.builder allows to build a custom Widget from the Metadata and either ImageProvider or SvgPicture fetched
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
Web address (Url that need to be parsed) For IOS & Web, only HTTP and HTTPS are support For Android, all url's are supported
final
onTap → (void Function()?)
Function that needs to be called when user taps on the card. If not given then given URL will be launched. To disable, Pass empty function.
final
placeholderWidget Widget?
Widget that need to be shown when plugin is trying to fetch metadata If not given anything then default one will be shown
final
previewHeight double?
Height of the preview card. Defaults to (MediaQuery.of(context).size.height) * 0.15 in case of horizontal and (MediaQuery.of(context).size.height) * 0.25 in case of vertical
final
proxyUrl String?
Proxy URL to pass that resolve CORS issues on web. For example, https://cors-anywhere.herokuapp.com/ .
final
removeElevation bool
To remove the card elevation set it to true Default value is false
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showMultimedia bool
Show or Hide image if available defaults to true
final
titleStyle TextStyle?
Customize body TextStyle
final
urlLaunchMode → LaunchMode
Parameter to choose how you'd like the app to handle the link Default is LaunchMode.platformDefault
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() AnyLinkPreviewState
Creates the mutable state for this widget at a given location in the tree.
override
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}) 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

Static Methods

getMetadata({required String link, String? proxyUrl = '', Duration? cache = const Duration(days: 1), Map<String, String>? headers}) Future<Metadata?>
Method to fetch metadata directly
Method to verify if the link is valid or not