SheetState constructor

SheetState(
  1. _SheetExtent? _extent, {
  2. required double extent,
  3. required bool isLaidOut,
  4. required double maxExtent,
  5. required double minExtent,
})

A data class containing state information about the SlidingSheet at the time this state was emitted.

Implementation

SheetState(
  this._extent, {
  required this.extent,
  required this.isLaidOut,
  required this.maxExtent,
  required double minExtent,
  // On Bottomsheets it is possible for min and maxExtents to be the same (when you only set one snap).
  // Thus we have to account for this and set the minExtent to be zero.
})  : minExtent = minExtent != maxExtent ? minExtent : 0.0,
      progress = isLaidOut
          ? ((extent - minExtent) / (maxExtent - minExtent)).clamp(0.0, 1.0)
          : 0.0,
      isExpanded = toPrecision(extent) >= toPrecision(maxExtent),
      isCollapsed = toPrecision(extent) <= toPrecision(minExtent),
      isAtTop = _extent?.isAtTop ?? true,
      isAtBottom = _extent?.isAtBottom ?? false,
      isHidden = extent <= 0.0,
      isShown = extent > 0.0,
      scrollOffset = _extent?.scrollOffset ?? 0.0;