FlintImage class
A versatile image widget in Flint UI, designed for rendering images in multiple formats including HTML (for emails and web) and plain text.
The FlintImage class provides flexible styling options such as margins, padding, borders, shadows, captions, and lazy-loading support.
It can optionally wrap the image inside a link or display a caption below
it, using semantic HTML elements like <a> and <figure>.
Example:
FlintImage(
src: 'https://flintdart.dev/logo.png',
alt: 'Flint Dart Logo',
width: 120,
caption: 'Powered by Flint Dart',
lazyLoading: true,
)
This will render as an HTML image with a caption underneath and lazy loading enabled.
- Inheritance
-
- Object
- FlintWidget
- FlintImage
Constructors
- FlintImage({required String src, String? alt, double? width, double? height, EdgeInsets? margin, EdgeInsets? padding, String? alignment, BoxBorder? border, BorderRadius? borderRadius, BoxShadow? shadow, ImageStyle style = const ImageStyle(), String? caption, bool lazyLoading = false, String? linkUrl})
- Creates a FlintImage widget.
Properties
- alignment → String?
-
The image alignment, represented as a string (e.g.,
"left","center","right").final - alt → String?
-
The alternative text for the image, used for accessibility
and when the image fails to load.
final
- border → BoxBorder?
-
The border style of the image, defined using BoxBorder.
final
- borderRadius → BorderRadius?
-
The radius of the image corners.
final
- caption → String?
-
A text caption displayed below the image.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The explicit height of the image in pixels.
final
- id → String
-
finalinherited
- lazyLoading → bool
-
Whether to enable native browser lazy-loading for the image.
final
- linkUrl → String?
-
An optional hyperlink URL that wraps the image.
final
- margin → EdgeInsets?
-
The margin applied outside the image container.
final
- padding → EdgeInsets?
-
The padding applied inside the image container.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- script → FlintScript?
-
finalinherited
- shadow → BoxShadow?
-
The shadow applied to the image.
final
- src → String
-
The source URL or path of the image.
final
- style → ImageStyle
-
Additional visual options for the image, defined via ImageStyle.
final
- width → double?
-
The explicit width of the image in pixels.
final
Methods
-
buildTemplate(
) → FlintWidget -
Since FlintImage is a leaf widget (it cannot contain child widgets),
this method simply returns itself.
override
-
copyWith(
{String? src, String? alt, double? width, double? height, EdgeInsets? margin, EdgeInsets? padding, String? alignment, BoxBorder? border, BorderRadius? borderRadius, BoxShadow? shadow, ImageStyle? style, String? caption, bool? lazyLoading, String? linkUrl}) → FlintImage - Creates a copy of this image with updated properties.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renderScriptAttributes(
) → String -
Render attached script to HTML attributes
inherited
-
toHtml(
) → String -
Converts this image into an HTML representation.
override
-
toJson(
) → Map< String, dynamic> -
Serializes this image into a JSON-compatible map.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
toText(
) → String -
Converts this image into a plain-text description.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited