瀏覽代碼

add option to disable gesture detector for MenuItemWidget

ashilkn 2 年之前
父節點
當前提交
9854994992
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lib/ui/components/menu_item_widget.dart

+ 4 - 1
lib/ui/components/menu_item_widget.dart

@@ -21,6 +21,8 @@ class MenuItemWidget extends StatefulWidget {
   final ExpandableController? expandableController;
   final ExpandableController? expandableController;
   final bool isBottomBorderRadiusRemoved;
   final bool isBottomBorderRadiusRemoved;
   final bool isTopBorderRadiusRemoved;
   final bool isTopBorderRadiusRemoved;
+  //disable gesture detector if not used
+  final bool isGestureDetectorDisabled;
   const MenuItemWidget({
   const MenuItemWidget({
     required this.captionedTextWidget,
     required this.captionedTextWidget,
     this.isExpandable = false,
     this.isExpandable = false,
@@ -38,6 +40,7 @@ class MenuItemWidget extends StatefulWidget {
     this.expandableController,
     this.expandableController,
     this.isBottomBorderRadiusRemoved = false,
     this.isBottomBorderRadiusRemoved = false,
     this.isTopBorderRadiusRemoved = false,
     this.isTopBorderRadiusRemoved = false,
+    this.isGestureDetectorDisabled = false,
     Key? key,
     Key? key,
   }) : super(key: key);
   }) : super(key: key);
 
 
@@ -74,7 +77,7 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    return widget.isExpandable
+    return widget.isExpandable || widget.isGestureDetectorDisabled
         ? menuItemWidget(context)
         ? menuItemWidget(context)
         : GestureDetector(
         : GestureDetector(
             onTap: widget.onTap,
             onTap: widget.onTap,