所有一级页面和不分二级页面
This commit is contained in:
118
lib/features/v2/my/presentation/widgets/menu_item_card.dart
Normal file
118
lib/features/v2/my/presentation/widgets/menu_item_card.dart
Normal file
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/my/domain/entities/my_entities.dart';
|
||||
|
||||
/// 菜单项卡片组件(100% 还原设计稿)
|
||||
class MenuItemCard extends StatelessWidget {
|
||||
const MenuItemCard({
|
||||
super.key,
|
||||
required this.item,
|
||||
this.onTap,
|
||||
this.onSwitchChanged,
|
||||
});
|
||||
|
||||
final MenuItemEntity item;
|
||||
final VoidCallback? onTap;
|
||||
final ValueChanged<bool>? onSwitchChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 56,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// 图标
|
||||
Icon(
|
||||
_getIconData(item.icon),
|
||||
size: 20,
|
||||
color: const Color(0xFF4E5969),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// 标题
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 副标题或开关
|
||||
if (item.subTitle != null) ...[
|
||||
Text(
|
||||
item.subTitle!,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
if (item.hasSwitch) ...[
|
||||
Transform.scale(
|
||||
scale: 0.85,
|
||||
child: Switch(
|
||||
value: item.switchValue,
|
||||
onChanged: onSwitchChanged,
|
||||
activeColor: const Color(0xFF165DFF),
|
||||
activeTrackColor: const Color(0xFF165DFF).withOpacity(0.3),
|
||||
inactiveThumbColor: const Color(0xFFC9CDD4),
|
||||
inactiveTrackColor: const Color(0xFFE5E6EB),
|
||||
),
|
||||
),
|
||||
],
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: const Color(0xFFC9CDD4),
|
||||
size: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 分割线
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 48),
|
||||
child: Divider(
|
||||
height: 1,
|
||||
thickness: 0.5,
|
||||
color: const Color(0xFFF0F0F0),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 根据字符串获取 IconData
|
||||
IconData _getIconData(String iconName) {
|
||||
switch (iconName) {
|
||||
case 'person':
|
||||
return Icons.person_outline;
|
||||
case 'notifications':
|
||||
return Icons.notifications_outlined;
|
||||
case 'cloud_download':
|
||||
return Icons.cloud_download_outlined;
|
||||
case 'dark_mode':
|
||||
return Icons.dark_mode_outlined;
|
||||
case 'settings':
|
||||
return Icons.settings_outlined;
|
||||
case 'help':
|
||||
return Icons.help_outline;
|
||||
case 'info':
|
||||
return Icons.info_outline;
|
||||
default:
|
||||
return Icons.label_outline;
|
||||
}
|
||||
}
|
||||
}
|
||||
122
lib/features/v2/my/presentation/widgets/quick_action_card.dart
Normal file
122
lib/features/v2/my/presentation/widgets/quick_action_card.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/my/presentation/constants/my_constants.dart';
|
||||
|
||||
/// 用户信息卡片组件(100% 还原设计稿)
|
||||
class UserProfileCard extends StatelessWidget {
|
||||
const UserProfileCard({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.role,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String role;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(20, 70, 20, 50),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Color(0xFF165DFF),
|
||||
Color(0xFF0E42CC),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// 头像
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/app_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
size: 32,
|
||||
color: const Color(0xFF165DFF),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
// 用户信息
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
role,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.white.withOpacity(0.85),
|
||||
letterSpacing: 0.3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 箭头
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
size: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user