2026-04-05 22:38:56 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
2026-04-05 23:58:01 +08:00
|
|
|
import '../../../../core/theme/app_theme.dart';
|
2026-04-05 22:38:56 +08:00
|
|
|
|
2026-04-08 01:47:51 +08:00
|
|
|
/// 单行菜单项:图标 + 标题 + 尾部
|
2026-04-05 22:38:56 +08:00
|
|
|
class MenuRow extends StatelessWidget {
|
2026-04-06 00:24:54 +08:00
|
|
|
final IconData icon;
|
2026-04-05 22:38:56 +08:00
|
|
|
final Color iconColor;
|
|
|
|
|
final String title;
|
|
|
|
|
final Widget? trailing;
|
|
|
|
|
final VoidCallback? onTap;
|
|
|
|
|
|
|
|
|
|
const MenuRow({
|
|
|
|
|
super.key,
|
2026-04-06 00:24:54 +08:00
|
|
|
required this.icon,
|
2026-04-05 22:38:56 +08:00
|
|
|
required this.iconColor,
|
|
|
|
|
required this.title,
|
|
|
|
|
this.trailing,
|
|
|
|
|
this.onTap,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-04-08 01:47:51 +08:00
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
|
|
2026-04-05 22:38:56 +08:00
|
|
|
return InkWell(
|
|
|
|
|
onTap: onTap,
|
2026-04-06 00:24:54 +08:00
|
|
|
child: Padding(
|
2026-04-05 22:38:56 +08:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
2026-04-08 01:47:51 +08:00
|
|
|
Icon(icon, size: 18, color: iconColor),
|
2026-04-05 22:38:56 +08:00
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
title,
|
2026-04-08 01:47:51 +08:00
|
|
|
style: AppTextStyles.bodyLarge(context).copyWith(
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
2026-04-05 22:38:56 +08:00
|
|
|
),
|
|
|
|
|
),
|
2026-04-08 01:47:51 +08:00
|
|
|
if (trailing != null) trailing!,
|
|
|
|
|
if (trailing == null)
|
2026-04-05 22:38:56 +08:00
|
|
|
Icon(
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
size: 16,
|
2026-04-08 01:47:51 +08:00
|
|
|
color: colorScheme.onSurfaceVariant,
|
2026-04-05 22:38:56 +08:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|