Curtains.instant constructor

const Curtains.instant({
  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,
})
images of curtains as 📜 Curtains Wraps a scrollable child with scrim decorations while not at the start or end, alluding to unrevealed content.

Construct instant 📜 Curtains that require a scrollable child
and allow for Decoration startCurtain and endCurtain customization.

  • These Curtains.instant are so-named because they are not animated like new Curtains.
  • Leaving a Curtain parameter null will render no decoration 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.


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 `instant` 📜 `Curtains` that require a scrollable [child] \
/// and allow for `Decoration` [startCurtain] and [endCurtain] customization.
/// - These `Curtains.instant` are so-named because they are not animated
///   like [new Curtains].
/// - Leaving a `Curtain` parameter `null` will render no decoration
///   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].
///
/// ---
/// 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.instant({
  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,
})   : _isDrawn = false,
      elevation = null,
      color = null,
      duration = null,
      curve = null,
      super(key: key);