DevicePreviewPlugin class

A plugin definition for device preview.

It allows to add a dedicate button in the tool bar (with the icon and name). When the user taps the icon, a window of windowSize is opened and its content is built with the builder.

The plugin can have preferences data that is saved with the other preferences with the configured DevicePreviewStorage.

The windows can contain an inner navigation since it has a Navigator.

To define a custom plugin, instead of instantiating a DevicePreviewPlugin, the class can be inherited and the buildData overriden.

See also :

Implementers

Constructors

DevicePreviewPlugin({required String identifier, required String name, required IconData icon, Size windowSize = const Size(280, 300), DevicePreviewPluginWidgetBuilder? builder})
Create a new plugin definition.
const

Properties

builder DevicePreviewPluginWidgetBuilder?
The window content builder.
final
hashCode int
The hash code for this object.
no setterinherited
icon IconData
The icon of the plugin that is displayed in the button and the window name.
final
identifier String
The unique identifier of the plugin.
final
name String
The name of the plugin that is displayed in the button and the window name.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
windowSize Size
The size of the window that is opened when the user taps on the plugin button from the toolbar.
final

Methods

build(BuildContext context) Widget
Build the window content by observing the plugin's data in storage and calling buildData.
buildData(BuildContext context, Map<String, dynamic> data, DevicePreviewPluginDataUpdater updateData) Widget
Build the window content with the given plugin's data and the updateData method that saves new data and triggers a new build.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited