119 lines
3.9 KiB
Dart
119 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:niogu_app/core/constants/app_font_size.dart';
|
|
import 'package:sizer/sizer.dart';
|
|
|
|
class MenuItemCard extends StatelessWidget {
|
|
final String title;
|
|
final IconData icon;
|
|
final Color color;
|
|
final String? firstBadge;
|
|
final String? secondBadge;
|
|
final VoidCallback? onTap;
|
|
|
|
const MenuItemCard({
|
|
super.key,
|
|
required this.title,
|
|
required this.icon,
|
|
required this.color,
|
|
this.firstBadge,
|
|
this.secondBadge,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final bool isTablet = 100.w >= 600;
|
|
return Container(
|
|
padding: EdgeInsets.all(3.w),
|
|
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: InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.all(2.5.w),
|
|
decoration: BoxDecoration(
|
|
color: color.withOpacity(0.1),
|
|
borderRadius: BorderRadius.circular(2.75.w),
|
|
),
|
|
child: Icon(icon, color: color, size: 6.w),
|
|
),
|
|
SizedBox(width: 3.w),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (firstBadge != null)
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(bottom: 0.5.h),
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 1.5.w,
|
|
vertical: 0.2.h,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
borderRadius: BorderRadius.circular(1.w),
|
|
),
|
|
child: Text(
|
|
firstBadge!,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: (AppFontSize.small - 2).sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
|
|
if (secondBadge != null)
|
|
CircleAvatar(
|
|
radius: 2.5.w,
|
|
backgroundColor: Colors.red,
|
|
child: Text(
|
|
secondBadge!,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize:
|
|
((isTablet
|
|
? AppFontSize.medium
|
|
: AppFontSize.small) -
|
|
1.25)
|
|
.sp,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
title.replaceAll('\n', ' '),
|
|
style: TextStyle(
|
|
fontSize: AppFontSize.small.sp,
|
|
fontWeight: FontWeight.w500,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|