95 lines
2.7 KiB
Dart
95 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:niogu_app/core/constants/app_font_size.dart';
|
|
import 'package:sizer/sizer.dart';
|
|
|
|
class MenuCard extends StatelessWidget {
|
|
final String title;
|
|
final IconData icon;
|
|
final Color color;
|
|
final String? badge;
|
|
final VoidCallback? onTap;
|
|
|
|
const MenuCard({
|
|
super.key,
|
|
required this.title,
|
|
required this.icon,
|
|
required this.color,
|
|
this.badge,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final bool isTablet = 100.w >= 600;
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(4.w),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.15),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.all(2.5.w),
|
|
decoration: BoxDecoration(
|
|
color: color.withOpacity(0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(icon, color: color, size: 6.w),
|
|
),
|
|
|
|
if (badge != null) ...[
|
|
SizedBox(width: 3.w),
|
|
|
|
CircleAvatar(
|
|
radius: 2.5.w,
|
|
backgroundColor: Colors.red,
|
|
child: Text(
|
|
badge!,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize:
|
|
((isTablet
|
|
? AppFontSize.medium
|
|
: AppFontSize.small) -
|
|
1.25)
|
|
.sp,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 1.h),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: AppFontSize.small.sp,
|
|
color: Colors.grey[800],
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|