game/lib/widgets/common/custom_icon_button.dart

35 lines
751 B
Dart

import 'package:flutter/material.dart';
import 'custom_icon.dart'; // Import CustomIcon
class CustomIconButton extends StatelessWidget {
final String iconPath;
final VoidCallback? onTap;
final double? size;
final bool isEnabled;
final Color? iconColor;
const CustomIconButton({
super.key,
required this.iconPath,
this.onTap,
this.size = 64.0,
this.isEnabled = true,
this.iconColor,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: isEnabled ? onTap : null,
behavior: HitTestBehavior.opaque,
child: CustomIcon(
iconPath: iconPath,
size: size,
iconColor: iconColor,
opacity: isEnabled ? 1.0 : 0.5,
),
);
}
}