Skip to content
On this page

Preview

A contextual preview overlay with coordinated presentation motion.

Preview in FluttyUIPreview in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

Preview

const Preview({
  super.key,
  required this.child,
  required this.previewBuilder,
  this.items = const [],
  this.controller,
  this.onTap,
  this.onOpen,
  this.onSelected,
  this.onOpenChanged,
  this.enabled = true,
  this.closeOnSelect = true,
  this.dismissOnTapOutside = true,
  this.openHaptic = HapticType.heavy,
  this.width = 360,
  this.height = 420,
  this.menuWidth = 280,
  this.gap = 12,
  this.viewportPadding = 16,
  this.backgroundColor,
  this.scrimColor,
  this.borderRadius,
  this.backdropBlur = 12,
  this.semanticLabel = 'Preview',
  this.size,
  this.isCompact = false,
  this.motion,
});
ParameterTypeRequiredDefault
keyKey?Nonull
childWidgetYes—
previewBuilderWidgetBuilderYes—
itemsList<MenuItem>Noconst []
controllerPreviewController?Nonull
onTapVoidCallback?Nonull
onOpenVoidCallback?Nonull
onSelectedValueChanged<String>?Nonull
onOpenChangedValueChanged<bool>?Nonull
enabledboolNotrue
closeOnSelectboolNotrue
dismissOnTapOutsideboolNotrue
openHapticHapticTypeNoHapticType.heavy
widthdoubleNo360
heightdoubleNo420
menuWidthdoubleNo280
gapdoubleNo12
viewportPaddingdoubleNo16
backgroundColorColor?Nonull
scrimColorColor?Nonull
borderRadiusdouble?Nonull
backdropBlurdoubleNo12
semanticLabelStringNo'Preview'
sizeComponentSize?Nonull
isCompactboolNofalse
motionComponentMotion?Nonull

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/overlays/preview/preview.dart

This reference is generated from the Preview declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI