add noti
This commit is contained in:
125
lib/features/account/presentation/widgets/account_menu_item.dart
Normal file
125
lib/features/account/presentation/widgets/account_menu_item.dart
Normal file
@@ -0,0 +1,125 @@
|
||||
/// Account Menu Item Widget
|
||||
///
|
||||
/// A reusable menu item component for the account page.
|
||||
/// Displays an icon, title, optional subtitle, and trailing widget with tap interaction.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:worker/core/constants/ui_constants.dart';
|
||||
import 'package:worker/core/theme/colors.dart';
|
||||
|
||||
/// Account Menu Item Widget
|
||||
///
|
||||
/// Creates a list item with:
|
||||
/// - Circular icon background on the left
|
||||
/// - Title and optional subtitle in the center
|
||||
/// - Trailing widget (default: chevron right) on the right
|
||||
/// - Tap ripple effect
|
||||
class AccountMenuItem extends StatelessWidget {
|
||||
/// Icon to display
|
||||
final IconData icon;
|
||||
|
||||
/// Title text (required)
|
||||
final String title;
|
||||
|
||||
/// Optional subtitle text
|
||||
final String? subtitle;
|
||||
|
||||
/// Tap callback
|
||||
final VoidCallback onTap;
|
||||
|
||||
/// Optional custom trailing widget (defaults to chevron right arrow)
|
||||
final Widget? trailing;
|
||||
|
||||
/// Icon background color (defaults to light blue)
|
||||
final Color? iconBackgroundColor;
|
||||
|
||||
/// Icon color (defaults to primary blue)
|
||||
final Color? iconColor;
|
||||
|
||||
const AccountMenuItem({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
required this.onTap,
|
||||
this.trailing,
|
||||
this.iconBackgroundColor,
|
||||
this.iconColor,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
vertical: AppSpacing.md,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: AppColors.grey100,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Icon with circular background
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: iconBackgroundColor ?? AppColors.lightBlue.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 20,
|
||||
color: iconColor ?? AppColors.primaryBlue,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.md),
|
||||
|
||||
// Title and subtitle
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey900,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle!,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Trailing widget (default: chevron)
|
||||
trailing ??
|
||||
const Icon(
|
||||
Icons.chevron_right,
|
||||
size: 20,
|
||||
color: AppColors.grey500,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user