From af9b4892b2beb133bf449091c36ded75534a796c Mon Sep 17 00:00:00 2001 From: egortabula Date: Tue, 28 May 2024 12:46:54 +0300 Subject: [PATCH 1/2] added showDragHandle param --- lib/get_navigation/src/bottomsheet/bottomsheet.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/get_navigation/src/bottomsheet/bottomsheet.dart b/lib/get_navigation/src/bottomsheet/bottomsheet.dart index b1f9357c..9f154333 100644 --- a/lib/get_navigation/src/bottomsheet/bottomsheet.dart +++ b/lib/get_navigation/src/bottomsheet/bottomsheet.dart @@ -17,6 +17,7 @@ class GetModalBottomSheetRoute extends PopupRoute { this.modalBarrierColor, this.isDismissible = true, this.enableDrag = true, + this.showDragHandle, required this.isScrollControlled, super.settings, this.enterBottomSheetDuration = const Duration(milliseconds: 250), @@ -35,6 +36,7 @@ class GetModalBottomSheetRoute extends PopupRoute { final Clip? clipBehavior; final Color? modalBarrierColor; final bool isDismissible; + final bool? showDragHandle; final bool enableDrag; // final String name; final Duration enterBottomSheetDuration; @@ -105,6 +107,8 @@ class GetModalBottomSheetRoute extends PopupRoute { clipBehavior: clipBehavior, isScrollControlled: isScrollControlled, enableDrag: enableDrag, + showDragHandle: showDragHandle ?? + (enableDrag && (sheetTheme.showDragHandle ?? false)), ), ), ); @@ -124,6 +128,7 @@ class _GetModalBottomSheet extends StatefulWidget { this.isScrollControlled = false, this.enableDrag = true, this.isPersistent = false, + this.showDragHandle, }); final bool isPersistent; final GetModalBottomSheetRoute? route; @@ -133,6 +138,7 @@ class _GetModalBottomSheet extends StatefulWidget { final ShapeBorder? shape; final Clip? clipBehavior; final bool enableDrag; + final bool? showDragHandle; @override _GetModalBottomSheetState createState() => _GetModalBottomSheetState(); @@ -187,6 +193,7 @@ class _GetModalBottomSheetState extends State<_GetModalBottomSheet> { shape: widget.shape, clipBehavior: widget.clipBehavior, enableDrag: widget.enableDrag, + showDragHandle: widget.showDragHandle, ) : Scaffold( bottomSheet: BottomSheet( @@ -203,6 +210,7 @@ class _GetModalBottomSheetState extends State<_GetModalBottomSheet> { shape: widget.shape, clipBehavior: widget.clipBehavior, enableDrag: widget.enableDrag, + showDragHandle: widget.showDragHandle, ), )), ), @@ -223,6 +231,7 @@ class _GetPerModalBottomSheet extends StatefulWidget { this.clipBehavior, this.isScrollControlled = false, this.enableDrag = true, + this.showDragHandle, }); final bool? isPersistent; final GetModalBottomSheetRoute? route; @@ -232,6 +241,7 @@ class _GetPerModalBottomSheet extends StatefulWidget { final ShapeBorder? shape; final Clip? clipBehavior; final bool enableDrag; + final bool? showDragHandle; @override // ignore: lines_longer_than_80_chars @@ -290,6 +300,7 @@ class _GetPerModalBottomSheetState shape: widget.shape, clipBehavior: widget.clipBehavior, enableDrag: widget.enableDrag, + showDragHandle: widget.showDragHandle, ) : Scaffold( bottomSheet: BottomSheet( @@ -306,6 +317,7 @@ class _GetPerModalBottomSheetState shape: widget.shape, clipBehavior: widget.clipBehavior, enableDrag: widget.enableDrag, + showDragHandle: widget.showDragHandle, ), )), ), From ead7c6947b57ce710a33094511c353204b671268 Mon Sep 17 00:00:00 2001 From: egortabula Date: Tue, 28 May 2024 13:01:42 +0300 Subject: [PATCH 2/2] Add documentation for `showDragHandle` parameter --- lib/get_navigation/src/bottomsheet/bottomsheet.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/get_navigation/src/bottomsheet/bottomsheet.dart b/lib/get_navigation/src/bottomsheet/bottomsheet.dart index 9f154333..a4925025 100644 --- a/lib/get_navigation/src/bottomsheet/bottomsheet.dart +++ b/lib/get_navigation/src/bottomsheet/bottomsheet.dart @@ -36,6 +36,16 @@ class GetModalBottomSheetRoute extends PopupRoute { final Clip? clipBehavior; final Color? modalBarrierColor; final bool isDismissible; + + /// A parameter to control the visibility of a drag handle in the bottom sheet. + /// + /// When `showDragHandle` is set to `true`, a drag handle will be displayed at the top + /// of the bottom sheet, allowing users to easily identify and interact with the sheet + /// by dragging it. This is particularly useful for enhancing the user experience in + /// applications where intuitive UI interactions are important. + /// + /// When `showDragHandle` is set to `false`, the drag handle will be hidden. By default, + /// the drag handle is hidden to maintain backward compatibility with existing implementations. final bool? showDragHandle; final bool enableDrag; // final String name;