Skip to content

Commit

Permalink
Re-enable pull-to-dismiss action in cupertino modal heet tutorial (#57)
Browse files Browse the repository at this point in the history
Added changes that should have been included in #41.
  • Loading branch information
fujidaiti authored Feb 28, 2024
1 parent 564e3c6 commit 0dc0fcb
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cookbook/lib/tutorial/cupertino_modal_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ class _HalfScreenSheet extends StatelessWidget {
Widget build(BuildContext context) {
// `CupertinoStackedTransition` won't start the transition animation until
// the visible height of a modal sheet (the extent) exceeds 50% of the screen height.
return const DraggableSheet(
initialExtent: Extent.proportional(0.5),
minExtent: Extent.proportional(0.5),
physics: StretchingSheetPhysics(
parent: SnappingSheetPhysics(),
return const SheetDismissible(
child: DraggableSheet(
initialExtent: Extent.proportional(0.5),
minExtent: Extent.proportional(0.5),
physics: StretchingSheetPhysics(
parent: SnappingSheetPhysics(),
),
child: _SheetContent(),
),
child: _SheetContent(),
);
}
}
Expand All @@ -80,8 +82,12 @@ class _FullScreenSheet extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const DraggableSheet(
child: _SheetContent(),
// Wrap the sheet with `SheetDismissible` to
// enable the pull-to-dismiss action.
return const SheetDismissible(
child: DraggableSheet(
child: _SheetContent(),
),
);
}
}
Expand Down

0 comments on commit 0dc0fcb

Please sign in to comment.