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 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,
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
Constructors
- GlassScrollEdgeEffect({Key? key, required Widget child, double topFadeHeight = 100.0, double bottomFadeHeight = 60.0, bool fadeTop = true, bool fadeBottom = true, 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
- 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
-
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