Skip to content
On this page

CollisionAware

A positioning utility that accounts for surrounding bounds.

CollisionAware in FluttyUICollisionAware in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

CollisionAware

const CollisionAware({
  super.key,
  required this.anchorKey,
  required this.child,
  this.placement = CollisionPlacement.bottom,
  this.alignment = CollisionAlignment.start,
  this.width,
  this.matchAnchorWidth = false,
  this.maxWidth = double.infinity,
  this.maxHeight = double.infinity,
  this.offset = 8,
  this.collisionPadding = 8,
  this.allowPerpendicular = true,
  this.overlapAnchor = false,
});
ParameterTypeRequiredDefault
keyKey?Nonull
anchorKeyGlobalKeyYes—
childWidgetYes—
placementCollisionPlacementNoCollisionPlacement.bottom
alignmentCollisionAlignmentNoCollisionAlignment.start
widthdouble?Nonull
matchAnchorWidthboolNofalse
maxWidthdoubleNodouble.infinity
maxHeightdoubleNodouble.infinity
offsetdoubleNo8
collisionPaddingdoubleNo8
allowPerpendicularboolNotrue
overlapAnchorboolNofalse

Rect viewportBounds

static Rect viewportBounds(
  BuildContext context, {
  required RenderBox overlay,
  double padding = 8,
});

Rect fitRect

static Rect fitRect(Rect rect, Rect bounds, {Alignment alignment = Alignment.topLeft});

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/utilities/collision_aware/collision_aware.dart

This reference is generated from the CollisionAware declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI