CupertinoPopupSurface class

An iOS-style component for creating modal overlays like dialogs and action sheets.

By default, CupertinoPopupSurface generates a rounded rectangle surface that applies two effects to the background content:

  1. Background filter: Saturates and then blurs content behind the surface.
  2. Overlay color: Covers the filtered background with a transparent surface color. The color adapts to the CupertinoTheme's brightness: light gray when the ambient CupertinoTheme brightness is Brightness.light, and dark gray when Brightness.dark.

The blur strength can be changed by setting blurSigma to a positive value, or removed by setting the blurSigma to 0.

The saturation effect can be removed for debugging by setting debugIsVibrancePainted to false. The saturation effect is not supported on web with the skwasm renderer and will not be applied regardless of the value of debugIsVibrancePainted.

The surface color can be disabled by setting isSurfacePainted to false, which is useful for more complicated layouts, such as rendering divider gaps in CupertinoAlertDialog or rendering custom surface colors.

This sample shows how to use a CupertinoPopupSurface. The CupertinoPopupSurface shows a modal popup from the bottom of the screen. Toggle the switch to configure its surface color.
link

To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoPopupSurface.1 mysample

See also:

Inheritance

Constructors

CupertinoPopupSurface({Key? key, double blurSigma = defaultBlurSigma, bool isSurfacePainted = true, required Widget child})
Creates an iOS-style rounded rectangle popup surface.
const

Properties

blurSigma double
The strength of the gaussian blur applied to the area beneath this surface.
final
child Widget
The widget below this widget in the tree.
final
hashCode int
The hash code for this object.
no setterinherited
isSurfacePainted bool
Whether or not to paint a translucent white on top of this surface's blurred background. isSurfacePainted should be true for a typical popup that contains content without any dividers. A popup that requires dividers should set isSurfacePainted to false and then paint its own surface area.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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

Static Properties

debugIsVibrancePainted bool
Whether or not the area beneath this surface should be saturated with a ColorFilter.
getter/setter pair

Constants

defaultBlurSigma → const double
The default strength of the blur applied to widgets underlying a CupertinoPopupSurface.