| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import '../../core/theme/app_colors.dart';
- import 'package:flutter/material.dart';
- import '../../core/theme/app_colors_extension.dart';
- /// Pencil Component/ProfileMenuItem — 个人中心菜单项
- ///
- /// 左侧图标(22x22, primary色)+文字(14号),右侧箭头图标。
- /// 高度56,圆角10,背景bgCard,padding (0,16),gap 12。
- class ProfileMenuItem extends StatelessWidget {
- final IconData icon;
- final String label;
- final String? trailing;
- final Widget? trailingWidget;
- final VoidCallback? onTap;
- const ProfileMenuItem({
- super.key,
- required this.icon,
- required this.label,
- this.trailing,
- this.trailingWidget,
- this.onTap,
- });
- @override
- Widget build(BuildContext context) {
- final colors = Theme.of(context).extension<AppColorsExtension>()!;
- return GestureDetector(
- onTap: onTap,
- child: Container(
- height: 56,
- padding: const EdgeInsets.symmetric(horizontal: 16),
- decoration: BoxDecoration(
- color: colors.bgCard,
- borderRadius: BorderRadius.circular(10),
- ),
- child: Row(
- children: [
- SizedBox(
- width: 22,
- height: 22,
- child: Icon(icon, size: 22, color: colors.primary),
- ),
- const SizedBox(width: 12),
- Expanded(
- child: Text(
- label,
- style: TextStyle(
- fontSize: AppFontSizes.body,
- color: colors.textPrimary,
- ),
- ),
- ),
- if (trailingWidget != null) ...[
- trailingWidget!,
- const SizedBox(width: 4),
- ] else if (trailing != null) ...[
- Text(
- trailing!,
- style: TextStyle(
- fontSize: AppFontSizes.body,
- color: colors.textPlaceholder,
- ),
- ),
- const SizedBox(width: 4),
- ],
- Icon(
- Icons.chevron_right,
- size: 18,
- color: colors.textPlaceholder,
- ),
- ],
- ),
- ),
- );
- }
- }
|