ScrollShadow class

A widget that adds shadows to the top and bottom edges of a scrollable area to visually indicate overflow content.

The ScrollShadow is designed to dynamically display shadows at the edges of a scrollable widget based on the scroll state and content size. Shadows help provide a visual cue that more content is available in a particular direction.

The visibility, padding, color, and other aspects of the shadows can be customized independently for the top and bottom edges.

Example Usage

ScrollShadow(
  topShadowVisibility: ShadowVisibility.whenScrolled,
  bottomShadowVisibility: ShadowVisibility.alwaysOn,
  topShadowColor: Colors.black45,
  bottomShadowColor: Colors.black45,
  child: ListView.builder(
    itemCount: 50,
    itemBuilder: (context, index) => ListTile(title: Text('Item $index')),
  ),
);
Inheritance

Constructors

ScrollShadow({required Widget? child, double? topRightPadding, double? topLeftPadding, Radius? topRadius, double? bottomRightPadding, double? bottomLeftPadding, Radius? bottomRadius, ShadowVisibility topShadowVisibility = ShadowVisibility.whenScrolled, ShadowVisibility bottomShadowVisibility = ShadowVisibility.whenScrolled, Color topShadowColor = Colors.black, Color bottomShadowColor = Colors.black, Color topShadowDividerColor = const Color(0xD0000000), Color bottomShadowDividerColor = const Color(0xD0000000), double? elevation, bool ifHidesShadowForNegativeScroll = false, Key? key})
A widget that adds shadows to the top and bottom edges of a scrollable area to visually indicate overflow content.
const
ScrollShadow.simple({required Widget? child, double topRightPadding = 0.0, double topLeftPadding = 0.0, Radius topRadius = Radius.zero, double bottomRightPadding = 0.0, double bottomLeftPadding = 0.0, Radius bottomRadius = Radius.zero, ShadowVisibility topShadowVisibility = ShadowVisibility.whenScrolled, ShadowVisibility bottomShadowVisibility = ShadowVisibility.whenScrolled, Color topShadowColor = Colors.black, Color bottomShadowColor = Colors.black, Color topShadowDividerColor = const Color(0xD0000000), Color bottomShadowDividerColor = const Color(0xD0000000), double? elevation, bool ifHidesShadowForNegativeScroll = false, Key? key})
const

Properties

bottomLeftPadding → double
Padding applied to the left side of the bottom shadow.
final
bottomRadius → Radius
Radius used for rounding the bottom shadow's corners.
final
bottomRightPadding → double
Padding applied to the right side of the bottom shadow.
final
bottomShadowColor → Color
The color of the bottom shadow.
final
bottomShadowDividerColor → Color
The divider color that appears along the bottom edge of the shadow.
final
bottomShadowVisibility → ShadowVisibility
Controls the visibility behavior of the bottom shadow.
final
child → Widget?
The child widget wrapped by the ScrollShadow.
final
elevation → double?
The elevation of the shadows, which determines their intensity and blur radius.
final
hashCode → int
The hash code for this object.
no setterinherited
ifHidesShadowForNegativeScroll → bool
If true, hides the shadow when the scroll position is negative (overscrolled).
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
topLeftPadding → double
Padding applied to the left side of the top shadow.
final
topRadius → Radius
Radius used for rounding the top shadow's corners.
final
topRightPadding → double
Padding applied to the right side of the top shadow.
final
topShadowColor → Color
The color of the top shadow.
final
topShadowDividerColor → Color
The divider color that appears along the top edge of the shadow.
final
topShadowVisibility → ShadowVisibility
Controls the visibility behavior of the top shadow.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ScrollShadow>
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

Constants

defaultLeftPadding → const double
Default padding applied to the left side of the shadow for top and bottom edges.
defaultRadius → const Radius
Default radius used for rounding the shadow's corners.
defaultRightPadding → const double
Default padding applied to the right side of the shadow for top and bottom edges.