FreekakeApp/lib/components/menu_button.dart
2025-05-07 13:15:34 +07:00

59 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class MenuButton extends StatelessWidget {
final String? label;
final String? icon;
final VoidCallback? onPress;
final bool? isSelected;
final double? w;
final double? h;
const MenuButton({
super.key,
this.label,
this.icon,
this.onPress,
this.isSelected,
this.w,
this.h,
});
@override
Widget build(BuildContext context) {
return Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: SvgPicture.asset(
icon ?? '',
width: w ?? 24,
height: h ?? 24,
// allowDrawingOutsideViewBox: true,
colorFilter: ColorFilter.mode(
(isSelected ?? false)
? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 255, 255, 255),
BlendMode.srcIn,
),
),
onPressed: onPress,
),
Text(
label ?? '',
style: TextStyle(
color:
(isSelected ?? false)
? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 239, 224, 232),
fontWeight: FontWeight.bold,
fontSize: 10,
),
),
],
),
);
}
}