EscapablePadding class

A widget that allows its child or children to escape the constraints of a parent's padding.

This widget provides two modes:

Default Constructor:

  • Used for multiple children.
  • Applies padding around each child unless it is wrapped in an Escaped widget.
  • Requires padding, children, and a builder.

Lite Constructor:

  • Used for a single child to escape horizontal constraints.
  • Requires height and child.

Example

Default Usage:

EscapablePadding(
  padding: const EdgeInsets.all(16),
  children: [
    const Text('Normal padded child'),
    Escaped(
      child: Container(
        color: Colors.red,
        child: const Text('No padding here!'),
      ),
    ),
  ],
  builder: (context, children) => Column(children: children),
)

Lite Usage:

Padding(
  padding: const EdgeInsets.symmetric(horizontal: 24),
  child: EscapablePadding.lite(
    height: 100,
    child: Container(
      width: 500,
      color: Colors.blue,
      child: const Text('Escaping horizontal padding!'),
    ),
  ),
)
Inheritance

Constructors

EscapablePadding({Key? key, required EdgeInsets? padding, required List<Widget>? children, required Widget builder(BuildContext context, List<Widget> children)?})
Default constructor for multiple children and padding.
const
EscapablePadding.lite({Key? key, required double? height, required Widget? child})
Lite constructor for single child that escapes horizontal constraints.
const

Properties

builder → Widget Function(BuildContext context, List<Widget> children)?
Builder function to construct a widget using padded children.
final
child → Widget?
Single child used in lite mode.
final
children → List<Widget>?
List of children. Required in default constructor.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
Height for lite mode (used with OverflowBox).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
padding → EdgeInsets?
Padding to apply around each child in default mode.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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