This commit is contained in:
Phuoc Nguyen
2025-11-18 17:59:27 +07:00
parent 0dda402246
commit fc4711a18e
8 changed files with 568 additions and 285 deletions

View File

@@ -12,6 +12,7 @@ import 'package:worker/core/theme/colors.dart';
///
/// Shows address details with name, phone, address text, default badge,
/// and action buttons (edit/delete).
/// Supports selection mode with radio button.
class AddressCard extends StatelessWidget {
final String name;
final String phone;
@@ -20,6 +21,9 @@ class AddressCard extends StatelessWidget {
final VoidCallback? onEdit;
final VoidCallback? onDelete;
final VoidCallback? onSetDefault;
final bool showRadio;
final bool isSelected;
final VoidCallback? onRadioTap;
const AddressCard({
super.key,
@@ -30,6 +34,9 @@ class AddressCard extends StatelessWidget {
this.onEdit,
this.onDelete,
this.onSetDefault,
this.showRadio = false,
this.isSelected = false,
this.onRadioTap,
});
@override
@@ -61,6 +68,21 @@ class AddressCard extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Radio Button (Selection Mode)
if (showRadio)
GestureDetector(
onTap: onRadioTap,
child: Padding(
padding: const EdgeInsets.only(right: 12, top: 2),
child: Radio<bool>(
value: true,
groupValue: isSelected,
onChanged: (_) => onRadioTap?.call(),
activeColor: AppColors.primaryBlue,
),
),
),
// Address Content
Expanded(
child: Column(
@@ -111,7 +133,9 @@ class AddressCard extends StatelessWidget {
),
decoration: BoxDecoration(
border: Border.all(
color: AppColors.primaryBlue.withValues(alpha: 0.3),
color: AppColors.primaryBlue.withValues(
alpha: 0.3,
),
),
borderRadius: BorderRadius.circular(4),
),