Images
Images support both block-level figures and inline runs, with drag-to-resize handles, crop/rotation/flip transforms, editable captions, clickable hyperlinks, and inline or floating text-wrap placement around surrounding prose.
- Included in:
notesConfiguration,documentConfiguration(or installImageDocumentExtensionon any configuration) - Pure-Dart import:
package:vyuh_document_elements/image.dartorpackage:vyuh_document_elements/vyuh_document_elements.dart - Flutter extension:
ImageDocumentExtension+ supplyDocumentEditor.assetResolverfor custom storage/CDN/auth fetches - Action namespace:
ImageActions
Quick example
dart
import 'package:vyuh_document/vyuh_document.dart';
import 'package:vyuh_document_elements/vyuh_document_elements.dart';
final doc = Document.of(notesConfiguration, [
Image(
const AssetId('hero-architecture'),
altText: 'System architecture diagram',
width: 480,
height: 270,
),
]);What you can configure
| Property | Type / Values | Purpose |
|---|---|---|
assetId, mediaType | AssetId, ImageMediaType | Canonical asset identifier resolved by the host's assetResolver (PNG, JPEG, WebP, GIF, SVG) |
altText | String? | Accessibility description exported to HTML alt, DOCX descr, and PDF semantics |
width, height, sizingMode | double?, sizing mode | Explicit dimensions, fit-to-width, or intrinsic aspect-ratio sizing |
alignment | Horizontal alignment (left, center, right) | Placement of block images within the text column |
beforeSpacing, afterSpacing | double (points) | Vertical margin above and below the figure |
rotationDegrees, flipHorizontal, flipVertical | double, bool | Non-destructive rotation and mirroring transforms |
crop, fit, fillRectangle | Crop rect, ImageFit, ImageFillRectangle | Non-destructive cropping and aspect-fill framing |
caption | Editable caption story | Optional caption rendered below the image |
linkUrl | String? | Makes the image a clickable hyperlink |
floatingGeometry | Floating anchor & wrap mode | Square, tight, top-and-bottom, behind-text, or in-front-of-text wrap in paginated mode |
Actions & commands
| Action ID | Effect |
|---|---|
ImageActions.insertFromFile, ImageActions.insertFromUrl | Insert an inline or block image from file picker or URL |
ImageActions.insertBlockFromFile, ImageActions.insertBlockFromUrl | Insert a block-level figure from file or URL |
ImageActions.alignLeft, alignCenter, alignRight, fitWidth | Align or fit image to column width |
ImageActions.addCaption, ImageActions.removeCaption | Add or remove the editable image caption |
ImageActions.options, ImageActions.delete | Open image properties or delete the selected image |
- Typed commands:
ResizeImage,SetAltText.
Restricting usage
- Remove images:
notesConfiguration.withoutElements([Image.element]) - Disallow external URLs (allow uploads only): Expose
ImageActions.insertFromFilewhile omitting/gatingImageActions.insertFromUrlinDocumentPolicy, and validate URLs inside yourassetResolver.
Format parity
| DOCX | HTML | Markdown | |
|---|---|---|---|
Native DrawingML <w:drawing> (inline & anchored wrap, crop, rotation, alt text, links) | Embedded image bytes with exact crop, rotation, and wrap geometry | <figure><img src="..." alt="..."><figcaption> |  |