瀏覽代碼

Added onTap() for ChipButton

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

+ 25 - 20
lib/ui/components/buttons/chip_button_widget.dart

@@ -4,34 +4,39 @@ import "package:photos/theme/ente_theme.dart";
 class ChipButtonWidget extends StatelessWidget {
 class ChipButtonWidget extends StatelessWidget {
   final String label;
   final String label;
   final IconData? leadingIcon;
   final IconData? leadingIcon;
+  final VoidCallback? onTap;
   const ChipButtonWidget(
   const ChipButtonWidget(
     this.label, {
     this.label, {
     this.leadingIcon,
     this.leadingIcon,
+    this.onTap,
     super.key,
     super.key,
   });
   });
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    return Padding(
-      padding: const EdgeInsets.all(8.0),
-      child: Row(
-        mainAxisAlignment: MainAxisAlignment.center,
-        children: [
-          leadingIcon != null
-              ? Icon(
-                  leadingIcon,
-                  size: 17,
-                )
-              : const SizedBox.shrink(),
-          const SizedBox(width: 4),
-          Padding(
-            padding: const EdgeInsets.symmetric(horizontal: 4),
-            child: Text(
-              label,
-              style: getEnteTextTheme(context).smallBold,
-            ),
-          )
-        ],
+    return GestureDetector(
+      onTap: onTap?.call,
+      child: Padding(
+        padding: const EdgeInsets.all(8.0),
+        child: Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: [
+            leadingIcon != null
+                ? Icon(
+                    leadingIcon,
+                    size: 17,
+                  )
+                : const SizedBox.shrink(),
+            const SizedBox(width: 4),
+            Padding(
+              padding: const EdgeInsets.symmetric(horizontal: 4),
+              child: Text(
+                label,
+                style: getEnteTextTheme(context).smallBold,
+              ),
+            )
+          ],
+        ),
       ),
       ),
     );
     );
   }
   }