overlay method

Stack overlay({
  1. required Widget overlayWidget,
  2. AlignmentGeometry alignment = Alignment.center,
  3. StackFit fit = StackFit.loose,
  4. Clip clipBehavior = Clip.none,
})

Adds an overlay widget on top of the current widget.

overlayWidget The widget that will appear on top of the current widget. alignment Optional parameter to specify the alignment of the overlay widget within the stack. fit Optional parameter to specify how the overlay widget should fit inside the stack. clipBehavior Optional parameter to specify how the stack clips its children.

Implementation

Stack overlay({
  required Widget overlayWidget,
  AlignmentGeometry alignment = Alignment.center,
  StackFit fit = StackFit.loose,
  Clip clipBehavior = Clip.none,
}) {
  return Stack(
    alignment: alignment,
    fit: fit,
    clipBehavior: clipBehavior,
    children: [
      this,
      overlayWidget,
    ],
  );
}