selectItem method
void
selectItem(})
Select an item and begin the appear animation.
item — data object for the tapped item.
itemIndex — index of the tapped item in the items list.
originRect — global rect of the tapped widget.
screenSize — viewport size for rect computation.
Implementation
void selectItem(
Object item, {
required int itemIndex,
required Rect originRect,
required Size screenSize,
}) {
if (_state.phase != OverlayPhase.idle) return;
final fullRect = Rect.fromLTWH(0, 0, screenSize.width, screenSize.height);
final cRect = _computeCardRect(screenSize);
_pendingFullDismiss = false;
_verticalIntent = _VerticalIntent.none;
_overlayController.value = 0.0;
_expandController.value = 0.0;
_state = OverlayMorphState(
overlayProgress: 0.0,
expandProgress: 0.0,
phase: OverlayPhase.appearing,
currentIndex: _state.itemCount > 0
? itemIndex.clamp(0, _state.itemCount - 1)
: 0,
itemCount: _state.itemCount,
selectedItem: item,
originRect: originRect,
cardRect: cRect,
fullscreenRect: fullRect,
isAnimating: true,
);
notifyListeners();
_overlayController.animateTo(1.0, curve: appearCurve);
}