profile_menu_item.dart 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import 'package:flutter/material.dart';
  2. import '../../core/theme/app_colors.dart';
  3. /// Pencil Component/ProfileMenuItem — 个人中心菜单项
  4. ///
  5. /// 左侧图标(22x22, primary色)+文字(14号),右侧箭头图标。
  6. /// 高度56,圆角10,背景bgCard,padding (0,16),gap 12。
  7. class ProfileMenuItem extends StatelessWidget {
  8. final IconData icon;
  9. final String label;
  10. final String? trailing;
  11. final VoidCallback? onTap;
  12. const ProfileMenuItem({
  13. super.key,
  14. required this.icon,
  15. required this.label,
  16. this.trailing,
  17. this.onTap,
  18. });
  19. @override
  20. Widget build(BuildContext context) {
  21. return GestureDetector(
  22. onTap: onTap,
  23. child: Container(
  24. height: 56,
  25. padding: const EdgeInsets.symmetric(horizontal: 16),
  26. decoration: BoxDecoration(
  27. color: AppColors.bgCard,
  28. borderRadius: BorderRadius.circular(10),
  29. ),
  30. child: Row(
  31. children: [
  32. SizedBox(
  33. width: 22,
  34. height: 22,
  35. child: Icon(icon, size: 22, color: AppColors.primary),
  36. ),
  37. const SizedBox(width: 12),
  38. Expanded(
  39. child: Text(
  40. label,
  41. style: const TextStyle(
  42. fontSize: AppFontSizes.body,
  43. color: AppColors.textPrimary,
  44. ),
  45. ),
  46. ),
  47. if (trailing != null) ...[
  48. Text(
  49. trailing!,
  50. style: const TextStyle(
  51. fontSize: AppFontSizes.body,
  52. color: AppColors.textPlaceholder,
  53. ),
  54. ),
  55. const SizedBox(width: 4),
  56. ],
  57. const Icon(
  58. Icons.chevron_right,
  59. size: 18,
  60. color: AppColors.textPlaceholder,
  61. ),
  62. ],
  63. ),
  64. ),
  65. );
  66. }
  67. }