SelectionTransformer class

Original version: https://github.com/flutter/flutter/issues/104548#issuecomment-1683714851 Next version: https://gist.github.com/Schwusch/edf778492423db42a0ad11efd5bc8727 This version: https://gist.github.com/bryantwilliam/62a2b4cbd390a0e62612b3ea85c7f5e9 A widget that transforms the text selection when copied.

This uses the SelectionContainer with a custom SelectionContainerDelegate to override the getSelectedContent method with a custom implementation.

Use this by wrapping a subtree under SelectionArea, e.g:

SelectionArea(
  child: SelectionTransformer.separated(
    child: Column(children: [
      Text("Hello"),
      Text("World"),
    ]),
  ),
)
Inheritance

Constructors

SelectionTransformer({Key? key, required SelectionTransform transform, required Widget child})
const
SelectionTransformer.markdownWidget({Key? key, required Widget child})
A SelectionTransformer that formats the markdown widget selections.
SelectionTransformer.separated({Key? key, String separator = '\n', required Widget child})
A SelectionTransformer that adds a separator string between each child selections.
SelectionTransformer.tabular({Key? key, required int columns, required Widget child})
A SelectionTransformer that lays out the child selection in a tabular layout.

Properties

child Widget
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
transform SelectionTransform
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
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

Operators

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