Curtains constructor

const Curtains({
  1. Key? key,
  2. Axis scrollDirection = Axis.vertical,
  3. Decoration? startCurtain,
  4. Decoration? endCurtain,
  5. double spread = 0.0,
  6. Sensitivity sensitivity = Sensitivity.none,
  7. bool startInitVisible = false,
  8. bool endInitVisible = true,
  9. AlignmentGeometry? alignment,
  10. TextDirection? textDirection,
  11. Clip clipBehavior = Clip.hardEdge,
  12. required Widget child,
  13. Duration? duration = _350ms,
  14. Curve? curve = Curves.easeOut,
})
images of curtains as 📜 Curtains 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'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.

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);