MREImagePasteScope class Attachments

Adds image paste to a text field.

It handles the paste shortcut and the on-screen keyboard, adds a "paste image" item to the selection menu, and shows the attached images inside the field when the behavior asks for it. A normal text paste is never replaced: the shortcut pastes text when the clipboard holds text.

MRETextField uses it. Use it yourself to give your own field the same behaviour:

final field = MREImagePasteScope(
  behavior: MREImageCallbackPaste(
    onImagePasted: (image) => upload(image.bytes),
  ),
  builder: (context, hooks) => TextField(
    contentInsertionConfiguration: hooks.contentInsertionConfiguration,
    contextMenuBuilder: hooks.contextMenuBuilder,
  ),
);

With MRENoImagePaste it adds nothing around the field.

Inheritance
Available extensions

Constructors

MREImagePasteScope({Key? key, required MREImagePasteBehavior behavior, required MREImagePasteBuilder builder, bool enabled = true})
Creates a scope for behavior.
const

Properties

behavior → MREImagePasteBehavior
What to do with pasted images.
final
builder → MREImagePasteBuilder
Builds the field. Give it the MREImagePasteHooks.
final
enabled → bool
Whether user actions may change images. Existing images remain visible.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<MREImagePasteScope>
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, int wrapWidth = 65}) → 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
withTextDirection(String sample) → Widget

Available on Widget, provided by the MREDirectionalWidget extension

Wraps this widget in a Directionality that follows sample.

Operators

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