BubbleShape class
A shape that creates speech bubble or tooltip-like containers with an arrow.
BubbleShape generates geometric paths for bubble shapes that resemble speech bubbles or tooltips. The bubble consists of a rounded rectangle with an arrow (tail) that can be positioned on any of the four sides.
The bubble's appearance can be customized with:
- Arrow position (bottom, top, left, right)
- Border radius for rounded corners
- Arrow dimensions (height and width)
- Arrow position along the edge (as a percentage)
Example usage:
// Create a bottom-positioned speech bubble
BubbleShape(
position: BubblePosition.Bottom,
borderRadius: 12.0,
arrowHeight: 10.0,
arrowWidth: 15.0,
arrowPositionPercent: 0.5,
)
// Create a left-positioned tooltip
BubbleShape(
position: BubblePosition.Left,
borderRadius: 8.0,
arrowHeight: 8.0,
arrowWidth: 12.0,
arrowPositionPercent: 0.3,
)
Constructors
- BubbleShape.new({BubblePosition position = BubblePosition.Bottom, double borderRadius = 12, double arrowHeight = 10, double arrowWidth = 10, double arrowPositionPercent = 0.5})
- Creates a new BubbleShape with customizable arrow and styling options.
Properties
- arrowHeight → double
-
The height (or length) of the arrow extending from the bubble body.
final
- arrowPositionPercent → double
-
The position of the arrow along the edge as a percentage (0.0 to 1.0).
final
- arrowWidth → double
-
The width of the base of the arrow where it connects to the bubble body.
final
- borderRadius → double
-
The radius for the rounded corners of the bubble body.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- position → BubblePosition
-
The position of the arrow relative to the bubble body.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
{Rect? rect, double? scale}) → Path -
Builds the geometric path for this bubble shape.
override
-
generatePath(
{required Rect rect}) → Path - Generates the actual path for the bubble shape including the arrow.
-
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