content: import 'package:eshop/core/extension/string_extension.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter_bloc/flutter_bloc.dart';
  import 'package:shimmer/shimmer.dart';
  
  import '../../domain/entities/user/delivery_info.dart';
  import '../blocs/delivery_info/delivery_info_action/delivery_info_action_cubit.dart';
  import '../views/main/other/delivery_info/delivery_info.dart';
  import 'outline_label_card.dart';
  
  class DeliveryInfoCard extends StatelessWidget {
    final DeliveryInfo? deliveryInformation;
    final bool isSelected;
    const DeliveryInfoCard(
        {super.key, this.deliveryInformation, this.isSelected = false});
  
    @override
    Widget build(BuildContext context) {
      if (deliveryInformation != null) {
        return Padding(
          padding: const EdgeInsets.only(bottom: 10),
          child: InkWell(
            onTap: () {
              context.read<DeliveryInfoActionCubit>().selectDeliveryInfo(deliveryInformation!);
            },
            child: OutlineLabelCard(
              title: '',
              child: Container(
                padding: const EdgeInsets.symmetric(vertical: 12),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    const Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Icon(Icons.edit_location),
                    ),
                    const SizedBox(
                      width: 4,
                    ),
                    Expanded(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "${deliveryInformation!.firstName.capitalize()} ${deliveryInformation!.lastName}, ${deliveryInformation!.contactNumber}",
                            style: const TextStyle(
                              fontSize: 14,
                            ),
                          ),
                          Text(
                            "${deliveryInformation!.addressLineOne}, ${deliveryInformation!.addressLineTwo}, ${deliveryInformation!.city}, ${deliveryInformation!.zipCode}",
                            style: const TextStyle(
                                fontSize: 14, fontWeight: FontWeight.w500),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 4),
                            child: InkWell(
                              onTap: () {
                                showModalBottomSheet<void>(
                                  context: context,
                                  isScrollControlled: true,
                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(24.0),
                                  ),
                                  builder: (BuildContext context) {
                                    return DeliveryInfoForm(
                                      deliveryInfo: deliveryInformation,
                                    );
                                  },
                                );
                              },
                              child: const Text(
                                "Edit",
                                style: TextStyle(color: Colors.blueAccent),
                              ),
                            ),
                          )
                        ],
                      ),
                    ),
                    SizedBox(
                      width: 25,
                      child: Center(
                        child: isSelected
                            ? Container(
                                width: 10,
                                height: 10,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(42),
                                  color: Colors.black87,
                                ),
                              )
                            : const SizedBox(),
                      ),
                    )
                  ],
                ),
              ),
            ),
          ),
        );
      } else {
        return Shimmer.fromColors(
          baseColor: Colors.grey.shade200,
          highlightColor: Colors.white,
          child: Padding(
            padding: const EdgeInsets.only(bottom: 10),
            child: Container(
              decoration: BoxDecoration(
                  border: Border.all(), borderRadius: BorderRadius.circular(12)),
              child: Container(
                padding: const EdgeInsets.only(top: 16, bottom: 8),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const SizedBox(
                      width: 6,
                    ),
                    const Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Icon(Icons.edit_location),
                    ),
                    const SizedBox(
                      width: 4,
                    ),
                    Expanded(
                      child: Padding(
                        padding: const EdgeInsets.only(right: 20),
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Container(
                              height: 14,
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(12),
                                color: Colors.grey,
                              ),
                            ),
                            const SizedBox(
                              height: 4,
                            ),
                            Container(
                              height: 14,
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(12),
                                color: Colors.grey,
                              ),
                            ),
                            const SizedBox(
                              height: 4,
                            ),
                            Container(
                              height: 14,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(12),
                                color: Colors.grey,
                              ),
                            ),
                            const SizedBox(
                              height: 8,
                            ),
                            Container(
                              height: 18,
                              width: 50,
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(12),
                                color: Colors.grey,
                              ),
                            ),
                            const SizedBox(
                              height: 4,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      }
    }
  }
  