Curtains constructor
- Key? key,
- Axis scrollDirection = Axis.vertical,
- Decoration? startCurtain,
- Decoration? endCurtain,
- double spread = 0.0,
- Sensitivity sensitivity = Sensitivity.none,
- bool startInitVisible = false,
- bool endInitVisible = true,
- AlignmentGeometry? alignment,
- TextDirection? textDirection,
- Clip clipBehavior = Clip.hardEdge,
- required Widget child,
- Duration? duration = _350ms,
- Curve? curve = Curves.easeOut,
Wraps a scrollable child with scrim decorations while not at the start or end, alluding to unrevealed content. |
---|
Construct animated 📜 Curtains
that require a scrollable child
and allow for Decoration
startCurtain and endCurtain customization
as well as duration & curve for morphing state changes.
- Leaving a
Curtain
parameternull
will render no curtain in that position.
Parameter scrollDirection defaults to Axis.vertical like ListView.
- Initialize this property to match the child's
scrollDirection
.
Parameter textDirection defaults to Directionality.of(context)
,
but may be overridden.
With non-negative Sensitivity, the scrims of this 📜 Curtains
will change state before the scrollable reaches a min/max extent.
sensitivity.start
defines startCurtain tolerance to min extent.sensitivity.end
defines endCurtain tolerance to max extent.
Optionally define spread for "girthier" scrims, allowing, for example, BoxDecoration.gradient.
See Curtains.elevated constructor for simpler syntax double elevation
,
or see Curtains.instant to eliminate animation support.
To use double elevation
and the related Material Elevation shadow
conversions like a simple 📜 Curtains.elevated
, elect to employ
👥 package:shadows
's Elevation.asBoxShadows
when constructing the startCurtain or endCurtain.
- Before any scrolling occurs endCurtain initializes visible, even if
this 📜Curtains
wraps a scrollable not long enough to scroll.- If this does not fit the situation, consider endInitVisible.
- Also available is startInitVisible. Defaults
false
.
See class documentation for full examples: 📜 Curtains.
Implementation
// Wraps a scrollable [child] with scrim decorations while
// not at the start or end, alluding to unrevealed content.
///
/// Construct animated 📜 `Curtains` that require a scrollable [child] \
/// and allow for `Decoration` [startCurtain] and [endCurtain] customization \
/// as well as [duration] & [curve] for morphing state changes.
/// - Leaving a `Curtain` parameter `null` will render no curtain
/// in that position.
///
/// ---
/// Parameter [scrollDirection] defaults to [Axis.vertical]
/// like [ListView].
/// - Initialize this property to match the child's `scrollDirection`.
///
/// Parameter [textDirection] defaults to `Directionality.of(context)`, \
/// but may be overridden.
///
/// With non-negative [Sensitivity], the scrims of this 📜 `Curtains` \
/// will change state before the scrollable reaches a min/max extent.
/// - `sensitivity.start` defines [startCurtain] tolerance to min extent.
/// - `sensitivity.end` defines [endCurtain] tolerance to max extent.
///
/// Optionally define [spread] for "girthier" scrims,
/// allowing, for example, [BoxDecoration.gradient].
///
/// ---
/// See [Curtains.elevated] constructor for simpler syntax `double elevation`, \
/// or see [Curtains.instant] to eliminate animation support.
///
/// To use `double elevation` and the related Material [Elevation] shadow \
/// conversions like a simple 📜 `Curtains.elevated`, elect to employ
/// 👥 [`package:shadows`](https://pub.dev/packages/shadows)'s [Elevation.asBoxShadows] \
/// when constructing the [startCurtain] or [endCurtain].
///
/// ---
/// - Before any scrolling occurs [endCurtain] initializes visible, even if \
/// this 📜 `Curtains` wraps a scrollable not long enough to scroll.
/// - If this does not fit the situation, consider [endInitVisible].
/// - Also available is [startInitVisible]. Defaults `false`.
///
/// See class documentation for full examples: 📜 [Curtains].
const Curtains({
Key? key,
this.scrollDirection = Axis.vertical,
this.startCurtain,
this.endCurtain,
this.spread = 0.0,
this.sensitivity = Sensitivity.none,
this.startInitVisible = false,
this.endInitVisible = true,
this.alignment,
this.textDirection,
this.clipBehavior = Clip.hardEdge,
required this.child,
this.duration = _350ms,
this.curve = Curves.easeOut,
}) : _isDrawn = false,
elevation = null,
color = null,
super(key: key);