LinkPreviewGenerator class
A widget to convert your links into beautiful previews.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- LinkPreviewGenerator
Constructors
-
LinkPreviewGenerator({Key? key, required String link, Duration cacheDuration = const Duration(days: 7), TextStyle? titleStyle, TextStyle? bodyStyle, LinkPreviewStyle linkPreviewStyle = LinkPreviewStyle.large, bool showBody = true, bool showDomain = true, bool showGraphic = true, bool showTitle = true, BoxFit graphicFit = BoxFit.cover, Color backgroundColor = const Color.fromRGBO(248, 248, 248, 1.0), int? bodyMaxLines, TextOverflow bodyTextOverflow = TextOverflow.ellipsis, void onTap()?, Widget? placeholderWidget, String? proxyUrl, Widget? errorWidget, String errorBody = 'Oops! Unable to parse the url.', String errorImage = 'https://raw.githubusercontent.com/ghpranav/link_preview_generator/main/assets/giphy.gif', String errorTitle = 'Something went wrong!', double borderRadius = 12.0, List<
BoxShadow> ? boxShadow, bool removeElevation = false}) -
Creates LinkPreviewGenerator
const
Properties
- backgroundColor → Color
-
Customize the background colour.
Deaults to
Color.fromRGBO(248, 248, 248, 1.0)
.final - bodyMaxLines → int?
-
Give the limit to body text (Description).
If not provided, it will be calculated automatically.
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.0
.final -
boxShadow
→ List<
BoxShadow> ? -
Box shadow for the card.
Deafults to
[BoxShadow( spreadRadius: 1, blurRadius: 5, color: Colors.grey.withOpacity(0.5), offset: Offset(0, 3),)]
.final - cacheDuration → Duration
-
Cache result time, default cache
7 days
.final - errorBody → String
-
Body that need to be shown if parsing fails.
Deaults to
Oops! Unable to parse the url.
final - errorImage → String
-
Image URL that will be shown if parsing fails
& when multimedia enabled & no meta data is available.
Deaults to
A crying semi-soccer ball image
. https://raw.githubusercontent.com/ghpranav/link_preview_generator/main/assets/giphy.giffinal - errorTitle → String
-
Title that need to be shown if parsing fails.
Deaults to
Something went wrong!
final - errorWidget → Widget?
-
Widget that needs to be shown if parsing fails.
Defaults to plain container with given background colour.
final
- graphicFit → BoxFit
-
Adjust the box fit of the image.
Defaults to BoxFit.cover.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- link → String
-
Web address (URL that needs to be parsed/scrapped).
final
- linkPreviewStyle → LinkPreviewStyle
-
Link Preview display style. One among
large
orsmall
. Defaults to LinkPreviewStyle.large.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.
Pass empty function to disable tap.
final
- placeholderWidget → Widget?
-
Widget that needs to be shown when
package is trying to fetch metadata.
If not given anything then default widget will be shown.
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
. Defaults tofalse
.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showBody → bool
-
Show or Hide body text (Description).
Defaults to
true
.final - showDomain → bool
-
Show or Hide domain name.
Defaults to
true
.final - showGraphic → bool
-
Show or Hide image, if available.
Defaults to
true
.final - showTitle → bool
-
Show or Hide title.
Defaults to
true
.final - titleStyle → TextStyle?
-
Customize
title
TextStyle.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _LinkPreviewGeneratorState -
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