bottleneckcrm/mobile/lib/widgets/common/menu_row.dart
Ashwin 01ca6da166 Add unit tests for custom fields and macros functionality
- Implemented comprehensive tests for custom fields, covering key validation, draft validation, payload creation, and parsing.
- Added tests for macros, including permission checks, removal actions, draft validation, and payload structure.
- Established a fake HTTP client to simulate API responses for testing purposes.
- Ensured that all edge cases and expected behaviors are thoroughly validated in both custom fields and macros.
2026-08-07 20:11:01 +05:30

74 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../core/theme/theme.dart';
/// One tappable row in a menu list: icon, label, optional description, chevron.
///
/// Lives here rather than privately in `more_screen.dart` because the settings
/// hub is a second list of exactly these, and two copies would drift on the
/// first change to the row height or the divider.
///
/// The whole row is the tap target and it is 48pt tall at the smallest, so a
/// thumb finds it without aiming.
class MenuRow extends StatelessWidget {
const MenuRow({
super.key,
required this.icon,
required this.label,
this.description,
required this.onTap,
});
final IconData icon;
final String label;
final String? description;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
decoration: BoxDecoration(
color: AppColors.surface,
border: Border(bottom: BorderSide(color: AppColors.gray100)),
),
child: Row(
children: [
Icon(icon, size: 22, color: AppColors.textSecondary),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: AppTypography.body.copyWith(
fontWeight: FontWeight.w500,
),
),
if (description != null) ...[
const SizedBox(height: 2),
Text(
description!,
style: AppTypography.caption.copyWith(
color: AppColors.textSecondary,
),
),
],
],
),
),
Icon(
LucideIcons.chevronRight,
size: 20,
color: AppColors.textTertiary,
),
],
),
),
);
}
}