Popup constructor

const Popup({
  1. required Widget child,
  2. GlobalKey<State<StatefulWidget>>? parentKey,
  3. Key? key,
  4. Alignment childAlign = Alignment.topLeft,
  5. Alignment parentAlign = Alignment.bottomRight,
  6. Size? childSize,
  7. Offset offset = Offset.zero,
  8. AnimatedSwitcherTransitionBuilder? transitionBuilder,
  9. LazyWidgetBuilder? builder,
  10. Curve switchOutCurve = Curves.linear,
  11. Curve switchInCurve = Curves.linear,
  12. bool inAnimationWithController = false,
})

NOTE:- This widget uses PositionedAlign Widget, which may cause, loss of frame. For further information, look into the Documentation of PositionedAlign.

This should be returned from the builder parameter of PopupController.show.

Show this widget by firstly getting a PopupController object using PopupController.of static method. For further information look documentation of PopupController.

Also can use PopupScope to show popups localized on a widget, i.e popup will only be displayed inside that widget, using offsets local to that widget. For further information look documentation of PopupScope.

Uses PositionedAlign to align the child according to the given alignment.

For preventing frame loss, define childSize.

Create a popup, here parentKey key is important as the popup will appear according to the parent widget represented by the parentKey.

If parentKey is not provided then the popup will appear at the top-left corner of the screen or PopupScope. Use childAlign and offset parameters to add offset and align the popup.

Note:- To enable animation, Set animation from PopupController.show to true.

Implementation

const Popup({
  required this.child,
  this.parentKey,
  Key? key,
  this.childAlign = Alignment.topLeft,
  this.parentAlign = Alignment.bottomRight,
  this.childSize,
  this.offset = Offset.zero,
  this.transitionBuilder,
  this.builder,
  this.switchOutCurve = Curves.linear,
  this.switchInCurve = Curves.linear,
  this.inAnimationWithController = false,
}) : super(key: key);