123 lines
3.3 KiB
Dart
123 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:maibu_satabot_v2/features/v2/my/presentation/constants/my_constants.dart';
|
|
|
|
/// 快捷入口卡片组件(我的消息、我的收藏、我的工单)
|
|
class QuickActionCard extends StatelessWidget {
|
|
const QuickActionCard({
|
|
super.key,
|
|
required this.onMessageTap,
|
|
required this.onFavoriteTap,
|
|
required this.onWorkOrderTap,
|
|
});
|
|
|
|
final VoidCallback onMessageTap;
|
|
final VoidCallback onFavoriteTap;
|
|
final VoidCallback onWorkOrderTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16),
|
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0x0D000000),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
// 我的消息
|
|
_buildQuickActionItem(
|
|
icon: Icons.notifications_outlined,
|
|
label: '我的消息',
|
|
onTap: onMessageTap,
|
|
showBadge: true,
|
|
),
|
|
// 分割线
|
|
Container(
|
|
width: 1,
|
|
height: 40,
|
|
color: const Color(0xFFF0F0F0),
|
|
),
|
|
// 我的收藏
|
|
_buildQuickActionItem(
|
|
icon: Icons.favorite_border,
|
|
label: '我的收藏',
|
|
onTap: onFavoriteTap,
|
|
),
|
|
// 分割线
|
|
Container(
|
|
width: 1,
|
|
height: 40,
|
|
color: const Color(0xFFF0F0F0),
|
|
),
|
|
// 我的工单
|
|
_buildQuickActionItem(
|
|
icon: Icons.assignment_outlined,
|
|
label: '我的工单',
|
|
onTap: onWorkOrderTap,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildQuickActionItem({
|
|
required IconData icon,
|
|
required String label,
|
|
required VoidCallback onTap,
|
|
bool showBadge = false,
|
|
}) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
behavior: HitTestBehavior.opaque,
|
|
child: SizedBox(
|
|
width: 80,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 24,
|
|
color: MyColors.primary,
|
|
),
|
|
if (showBadge)
|
|
Positioned(
|
|
right: -4,
|
|
top: -4,
|
|
child: Container(
|
|
width: 12,
|
|
height: 12,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xFFFF4D4F),
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
color: MyColors.textSecondary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|