push<T extends Object?> method

Future<T?> push<T extends Object?>(
  1. Widget sheet, {
  2. required SideSheetTransitionBuilder transitionBuilder,
  3. required SideSheetPosition position,
  4. DecorationBuilder? decorationBuilder,
  5. bool dismissible = true,
  6. Duration? animationDuration,
  7. Duration? reverseAnimationDuration,
})

Push the given sheet onto the navigation stack.

Implementation

Future<T?> push<T extends Object?>(
  Widget sheet, {
  required SideSheetTransitionBuilder transitionBuilder,
  required SideSheetPosition position,
  DecorationBuilder? decorationBuilder,
  bool dismissible = true,
  Duration? animationDuration,
  Duration? reverseAnimationDuration,
}) async {
  if (!mounted || _blockGestures) return null;
  final completer = Completer<T?>();

  final newEntry = SideSheetEntry<T?>.createNewElement(
    index: _sheetEntries.length,
    transitionBuilder: transitionBuilder,
    tickerProvider: this,
    sheet: sheet,
    completer: completer,
    decorationBuilder: decorationBuilder ?? widget.decorationBuilder,
    position: position,
    dismissible: dismissible,
    animationDuration: _setSettleDuration(animationDuration),
    reverseDuration: _setReverseSettleDuration(reverseAnimationDuration),
  );
  _sheetEntries.add(newEntry);
  _notifyStateChange();

  if (_scrimAnimationController.value == 0) {
    _scrimAnimationController.forward();
  }

  return completer.future;
}