GlassScrollEdgeEffect class
A widget that fades or blurs scroll content at the top and/or bottom edges.
Matches iOS 26's .scrollEdgeEffectStyle(_:for:) modifier. Places gradient
blur or overlay masks at the specified edges, creating the effect of content
smoothly dissolving into navigation bars or bottom bars rather than clipping
sharply.
How it works
GlassScrollEdgeStyle.soft (default, iOS 26 parity): Inside GlassPage, automatically captures the page background texture and paints it over the scroll edges with a gradient alpha mask. Outside GlassPage, falls back to a solid-colour gradient overlay using fadeColor.
GlassScrollEdgeStyle.hard: Like GlassScrollEdgeStyle.soft, but applies a 50% height zone and steeper alpha curve for a crisper structural edge.
GlassScrollEdgeStyle.blur (opt-in GPU enhancement): Uses ProgressiveBlur to apply a hardware-accelerated 2-pass Gaussian blur directly over live scrolling content. The content remains visible underneath the bar while high frequencies melt away, protecting navigation buttons and titles.
Usage
GlassScrollEdgeEffect(
topFadeHeight: 100,
bottomFadeHeight: 80,
absorbPointer: true,
child: ListView.builder(
itemBuilder: (_, i) => ListTile(title: Text('Item $i')),
),
)
With GlassAppBar
Scaffold(
extendBodyBehindAppBar: true,
appBar: GlassAppBar(title: Text('Messages')),
body: GlassScrollEdgeEffect(
topFadeHeight: MediaQuery.paddingOf(context).top + 44 + 50,
bottomFadeHeight: 60 + MediaQuery.paddingOf(context).bottom,
child: ListView(...),
),
)
The topFadeHeight should typically cover the safe area + app bar height
- a buffer zone so content fades before reaching the navigation buttons.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassScrollEdgeEffect
- Available extensions
Constructors
- GlassScrollEdgeEffect({Key? key, required Widget child, double topFadeHeight = 100.0, double bottomFadeHeight = 60.0, bool fadeTop = true, bool fadeBottom = true, bool absorbPointer = false, GlassScrollEdgeStyle style = GlassScrollEdgeStyle.soft, double maxSigma = 18.0, Color? fadeColor})
-
Creates a scroll edge effect that blurs or fades content at the edges.
const
Properties
- absorbPointer → bool
-
Whether the fade overlays absorb pointer events instead of passing them
through to child. Defaults to
false.final - bottomFadeHeight → double
-
The height of the bottom fade zone in logical pixels.
final
- child → Widget
-
The scrollable content to apply edge fading to.
final
- fadeBottom → bool
-
Whether to fade content at the bottom edge.
final
- fadeColor → Color?
-
Fallback colour used when no background texture is available.
final
- fadeTop → bool
-
Whether to fade content at the top edge.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxSigma → double
-
Maximum blur sigma for GlassScrollEdgeStyle.blur at the strongest edge.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → GlassScrollEdgeStyle
-
The edge effect style.
final
- topFadeHeight → double
-
The height of the top fade zone in logical pixels.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassScrollEdgeEffect> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
-
glassContextMenu(
{Key? key, required List< Widget> actions, WidgetBuilder? previewBuilder, bool enabled = true, bool enableHaptics = true, double borderRadius = 32.0, double? previewBorderRadius, double rowBorderRadius = 16.0, BorderRadius? rowCorners, Color? originSlotColor, Color? backgroundColor, LiquidGlassSettings? settings, GlassQuality? quality, double backdropBlur = 0.0, Color? barrierColor, VoidCallback? onOpened, VoidCallback? onDismissed, Duration longPressDuration = const Duration(milliseconds: 700)}) → Widget -
Available on Widget, provided by the GlassContextMenuExtension extension
Wraps this widget in a GlassContextMenu displayingactionson long-press or right-click. -
glassFullScreenCover(
{required bool isPresented, VoidCallback? onDismiss, required WidgetBuilder content, bool enableSwipeToDismiss = true, double dismissThreshold = 140.0, LiquidGlassSettings? settings, GlassQuality? quality}) → Widget -
Available on Widget, provided by the GlassFullScreenCoverExtension extension
Presents a full-viewport modal cover wheneverisPresentedis true. -
Available on Widget, provided by the GlassNavigationTitleExtension extension
Annotates this widget with a navigation title that drives enclosing or descendant GlassAppBar / GlassAppBar.pinned bars (when their explicittitleis null) as well as header accessibility semantics. -
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