BalloonTapDelegator class
BalloonTapDelegator resolves the issue where tap events are not handled
when displaying a Balloon using PositionedBalloon.
When a Balloon is displayed over a child element using PositionedBalloon,
events that need to be handled within the Balloon (e.g., button presses)
may not be processed due to the limited area of the child element.
By wrapping a parent widget that has a larger hit test area than PositionedBalloon.child
with the BalloonTapDelegator widget,
you can forward tap events from that area into the Balloon,
allowing them to be handled appropriately.
BalloonTapDelegator( // Place this widget at a level with a larger size than `Balloon.child`
child: Scaffold( // in this case, the Scaffold widget has a larger size than the `FloatingActionButton` which is `PositionedBalloon.child`
floatingActionButton: PositionedBalloon(
show: isVisible,
balloon: Balloon(
child: Button(
label: 'Close',
onTap: () {
setState(() => isVisible = false);
})),
child: FloatingActionButton(onPressed: () {
setState(() => isVisible = !isVisible);
}))));
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- BalloonTapDelegator
Constructors
- BalloonTapDelegator({Key? key, required Widget child})
-
const
Properties
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