import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'package:shimmer/shimmer.dart';
import '../../../../Controller/Createorder/Createordercontroller.dart';
import '../../../../Controller/Dashboard/Pickup/Tabs/Pickupcustomertabscontroller.dart';
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
import '../../../../Helper/Constants/Assetconstants.dart';
import '../../../../Helper/Constants/Colorconstants.dart';
import '../../../../Helper/Logger.dart';
import '../../../../Helper/toast.dart';
import '../../../../Helper/utility.dart';
import '../../Createorderview.dart';
import 'Allcustomers/Tenantcustomers/Tenantcustomerview.dart';
import 'Tenants/Tenantsview.dart';

// class PickupCustomerTabView extends StatelessWidget {
//   final int tabIndex;
//
//   PickupCustomerTabView({super.key, this.tabIndex = 0});
//
//   PickupCustomerTabController pickupCustomerTabController = Get.put(PickupCustomerTabController());
//    AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
//
//
//    @override
//   Widget build(BuildContext context) {
//     return GetBuilder<PickupCustomerTabController>(
//       initState: (_){
//         if (tabIndex != 0) {
//           print('tabindex ${tabIndex}');
//           pickupCustomerTabController.tabIndex =tabIndex;
//         }
//         // orderMainController.tabIndex = tabIndex;
//         pickupCustomerTabController.tabController.index = tabIndex;
//         pickupCustomerTabController.tabController.addListener(() {
//           if (!pickupCustomerTabController.tabController.indexIsChanging) {
//             // pickupCustomerTabController.update();
//             pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
//           }
//         });
//
//       },
//       builder: (controller) {
//         return Scaffold(
//           backgroundColor: Colors.grey[100],
//           appBar: AppBar(
//             leading: Padding(
//               padding: const EdgeInsets.all(5.0),
//               child:InkWell(
//                   onTap: (){
//
//                     Get.back();
//                   },
//                   child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
//             ),
//             titleSpacing: 0,
//
//             title: Row(
//               children: [
//                 Text("Pickup address",style: TextStyle(color: ColorConstants.secondaryColor)),
//                 const Spacer(),
//                 InkWell(
//                   onTap: () {
//                     addPickupCustomerController.customerFirstNameController.clear();
//                     addPickupCustomerController.customerLastNameController.clear();
//                     addPickupCustomerController.customerPhoneController.clear();
//                     addPickupCustomerController.addressController.clear() ;
//                     addPickupCustomerController.doorNoController.clear() ;
//                     addPickupCustomerController.landMarkController.clear() ;
//                     addPickupCustomerController.predictions.clear();
//                     Get.to(AddCustomerView());
//                   },
//                   child:  Column(
//                     mainAxisAlignment: MainAxisAlignment.end,
//                     children: [
//                       Padding(
//                         padding: EdgeInsets.only(bottom: 3,right: 0),
//                         child: Icon(
//                           Icons.person_add_alt_rounded,
//                           size: 35,
//                           color: Colors.white,
//                         ),
//                       ),
//                     ],
//                   ),
//                 ),
//                 const SizedBox(width: 10,)
//               ],
//             ),
//             elevation: 0,
//             backgroundColor: ColorConstants.primaryColor,
//             automaticallyImplyLeading: false,
//
//             // backwardsCompatibility: false,
//           ),
//           body: Stack(
//             children: [
//               Column(
//                 mainAxisAlignment: MainAxisAlignment.start,
//                 crossAxisAlignment: CrossAxisAlignment.start,
//                 children: [
//                   TabBar(
//                     tabs: controller.tabs,
//                     unselectedLabelColor: ColorConstants.primaryColor,
//                     indicatorColor: ColorConstants.primaryColor,
//                     indicatorSize: TabBarIndicatorSize.tab,
//                     labelColor: ColorConstants.primaryColor,
//                     controller: controller.tabController,
//                     onTap: (_){
//                       pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
//                       print("tabIndexonTap ${pickupCustomerTabController.tabIndex}");
//                     },
//                   ),
//                   Expanded(
//                     child: TabBarView(
//                       controller: controller.tabController,
//                       physics: const NeverScrollableScrollPhysics(),
//                       children: [
//                         TenantPickUpCustomerView(),
//                         TenantPickUpTenantsView(),
//                       ],
//                     ),
//                   ),
//                 ],
//               ),
//             ],
//           ),
//         );
//       }
//     );
//   }
// }


class PickupCustomerView extends StatelessWidget {
   PickupCustomerView({super.key});

   TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
   CreateOrderController createOrderController = Get.put(CreateOrderController());
   final ScrollController scrollController = ScrollController();


   @override
  Widget build(BuildContext context) {

     void onScroll() {
       double maxScroll = scrollController.position.maxScrollExtent;
       double currentScroll = scrollController.position.pixels;

       if (maxScroll == currentScroll && tenantPickupCustomerController.hasMore.value) {
         tenantPickupCustomerController.getCustomerData();
       }
     }

     scrollController.addListener(onScroll);

    return  Scaffold(
      backgroundColor: Colors.grey[100],
      appBar: AppBar(
        leading: Padding(
          padding: const EdgeInsets.all(5.0),
          child:InkWell(
              onTap: (){
                Get.back();
              },
              child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
        ),
        titleSpacing: 0,

        title: Row(
          children: [
            Text("Saved address",style: TextStyle(color: ColorConstants.secondaryColor)),
          ],
        ),
        elevation: 0,
        backgroundColor: ColorConstants.primaryColor,
        automaticallyImplyLeading: false,
        // backwardsCompatibility: false,
      ),
      body: GetBuilder<TenantPickupCustomerController>(
          initState: (_){
            tenantPickupCustomerController.shimmer.value = true;
            // tenantPickupCustomerController.getCustomerByTenantId();
            // tenantPickupCustomerController.getCustomerData();
            tenantPickupCustomerController.refreshData();

          },
        builder: (controller) {
          return Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Container(
                padding: EdgeInsets.only(top: 10,bottom: 10),
                decoration: BoxDecoration(color: ColorConstants.secondaryColor),
                child: TextField(
                  controller: controller.searchController,
                  textAlignVertical: TextAlignVertical.center,
                  // focusNode: controller.focusNode,
                  onChanged: (data){
                    var keyword = data;
                    print('keyword................${keyword}');
                    if(data.isNotEmpty) {
                      controller.shimmer.value = true;
                      controller.getSearchCustomerData(keyword);
                    }
                    else{
                      controller.shimmer.value = true;
                      controller.refreshData();
                      FocusScope.of(context).unfocus();
                    }
                    controller.update();
                  },
                  decoration: InputDecoration(
                      prefixIcon: IconButton(
                        icon: const Icon(Icons.search),
                        color: Colors.grey[500]!,
                        onPressed: () {

                        },
                      ),
                      hintText: 'Search by customer',
                      hintStyle: TextStyle(
                        color: Colors.grey[500]!,


                      ),
                      suffixIcon: controller.searchController.text.isEmpty ? const SizedBox() : IconButton(
                        icon: const Icon(Icons.cancel),
                        color: Colors.grey[500]!,
                        onPressed: () {
                          controller.shimmer.value = true;
                          controller.refreshData();
                          FocusScope.of(context).unfocus();
                        },
                      ),
                      border: InputBorder.none),
                ),
              ),
              controller.getCustomerBytenantId.isEmpty && !controller.shimmer.value
                  ? Center(
                heightFactor: 3.0,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Image(
                        height: 160,
                        width: 160,
                        image: AssetImage(AssetConstants.NoRecords),
                      ),
                      SizedBox(
                        height: 8,
                      ),
                      Text(
                        "No customers at this moment",
                        style: TextStyle(
                            color: Colors.grey[600],
                            fontSize: 18),
                      ),
                    ],
                  )):controller.shimmer.value?Center(
                  heightFactor: 15.0,
                  child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
              controller.shimmer.value?
              queueShimmerCard(context):
              Expanded(
                child:controller.searchController.text.isEmpty? ListView.builder(
                    controller: scrollController,
                    itemCount: controller.hasMore.value
                        ? controller.getCustomerBytenantId.length + 1
                        : controller.getCustomerBytenantId.length,
                    itemBuilder: (BuildContext context,int index)
                    {
                      if(index < controller.getCustomerBytenantId.length){
                        return Padding(
                          padding: const EdgeInsets.only(
                            top: 10,
                            left: 10,
                            right: 10,

                          ),
                          child: Stack(
                            children: [
                              InkWell(
                                onTap:(){
                                  createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
                                  createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
                                  createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
                                  createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
                                  createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
                                  createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
                                  createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
                                  createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
                                  createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
                                  createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;

                                  createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
                                  createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
                                  createOrderController.pickupContactNoController.text =  controller.getCustomerBytenantId[index].contactno??'';
                                  createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
                                  createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
                                  createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
                                  createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
                                  createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
                                  createOrderController.pickupPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;

                                  print('pickupCustomerIdmainpage ${createOrderController.pickupCustomerId}');

                                  logger.i (createOrderController.pickupCustomerId);
                                  logger.i (createOrderController.dropCustomerId);

                                  if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
                                    Toast.showToast('Please select different customer it already selected');
                                  }
                                  else{
                                    createOrderController.pickupSaveAddress = false;
                                    Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));

                                  }

                                },
                                child: Container(
                                  padding: const EdgeInsets.only(
                                      right: 15
                                  ),
                                  decoration: BoxDecoration(
                                    color: ColorConstants.secondaryColor,
                                    boxShadow: const [
                                      BoxShadow(color: Colors.grey)
                                    ],
                                    borderRadius:
                                    const BorderRadius.all(Radius.circular(3)),
                                  ),
                                  height: Get.height*0.15,
                                  child: Row(
                                    mainAxisAlignment:
                                    MainAxisAlignment.start,
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: [
                                      Expanded(
                                          flex: 3,
                                          child: Container(
                                            padding: const EdgeInsets.all(5),
                                            decoration: BoxDecoration(
                                              color: UtilityPromotion
                                                  .getLightColors(
                                                  controller.getCustomerBytenantId[index].firstname == '' ?'':
                                                  controller.getCustomerBytenantId[index].firstname![0]
                                                      .toString()
                                              )
                                                  .withAlpha(100),
                                              shape: BoxShape.rectangle,
                                            ),
                                            child: Column(
                                              mainAxisAlignment:
                                              MainAxisAlignment.center,
                                              crossAxisAlignment: CrossAxisAlignment.center,
                                              children: [
                                                SizedBox(height: 10,),
                                                CircleAvatar(
                                                    backgroundColor:
                                                    Colors.white70,
                                                    radius: 28,
                                                    child: Text(
                                                      controller.getCustomerBytenantId[index].firstname == '' ?'':
                                                      controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
                                                      style: const TextStyle(
                                                          color: Colors
                                                              .black54,
                                                          fontSize: 22),
                                                    )),
                                               Spacer(),
                                                Container(
                                                  padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
                                                  decoration: BoxDecoration(color: ColorConstants.secondaryColor),
                                                  child: Center(
                                                    child: Text(
                                                      '${controller.getCustomerBytenantId[index].suburb}',
                                                      style: TextStyle(
                                                          color: ColorConstants
                                                              .darkGreyColor,
                                                          fontSize: 14,
                                                          fontWeight:
                                                          FontWeight.bold),
                                                      maxLines: 1,
                                                      overflow: TextOverflow.ellipsis,
                                                    ),
                                                  ),
                                                )
                                              ],
                                            ),
                                          )),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      Expanded(
                                          flex: 8,
                                          child: Column(
                                            crossAxisAlignment:
                                            CrossAxisAlignment.start,
                                            mainAxisAlignment:
                                            MainAxisAlignment.spaceEvenly,
                                            children: [
                                              Row(
                                                children: [
                                                  Icon(
                                                    Icons.person,
                                                    color: ColorConstants
                                                        .primaryColor,
                                                    size: 20,
                                                  ),
                                                  const SizedBox(
                                                    width: 5,
                                                  ),
                                                  Row(
                                                    children: [
                                                      Text(
                                                        controller.getCustomerBytenantId[index].firstname ?? "",
                                                        style: TextStyle(
                                                            fontSize: 16,
                                                            color: Colors
                                                                .grey[600],
                                                            fontWeight:
                                                            FontWeight
                                                                .w600),
                                                      ),
                                                    ],
                                                  ),

                                                ],
                                              ),
                                              Row(
                                                children: [
                                                  Icon(
                                                    Icons.call,
                                                    color:
                                                    ColorConstants.primaryColor,
                                                    size: 20,
                                                  ),
                                                  const SizedBox(
                                                    width: 5,
                                                  ),
                                                  Text(
                                                    '${controller.getCustomerBytenantId[index].contactno}',
                                                    style: TextStyle(
                                                        color: ColorConstants
                                                            .darkGreyColor,
                                                        fontSize: 14,
                                                        fontWeight:
                                                        FontWeight.bold),
                                                  ),
                                                ],
                                              ),
                                              Row(
                                                children: [
                                                  Icon(
                                                    Icons.location_on,
                                                    color:
                                                    ColorConstants.primaryColor,
                                                    size: 20,
                                                  ),
                                                  const SizedBox(
                                                    width: 5,
                                                  ),
                                                  Expanded(
                                                    child: Text(
                                                      '${controller.getCustomerBytenantId[index].address}',
                                                      style: TextStyle(
                                                          color: ColorConstants
                                                              .darkGreyColor,
                                                          fontSize: 14,
                                                          fontWeight:
                                                          FontWeight.bold),
                                                      maxLines: 1,
                                                      overflow: TextOverflow.ellipsis,
                                                    ),
                                                  ),
                                                ],
                                              ),
                                              // SizedBox(
                                              //   height: 10,
                                              // ),
                                            ],
                                          )),
                                    ],
                                  ),
                                ),
                              ),

                            ],
                          ),
                        );
                      }
                      else{
                        return Padding(
                          padding: const EdgeInsets.all(15),
                          child: Center(
                            child: CircularProgressIndicator(
                              color: ColorConstants.primaryColor,
                            ),
                          ),
                        );
                      }
                    }
                ):
                ListView.builder(
                    itemCount: controller.getCustomerBytenantId.length,
                    itemBuilder: (BuildContext context,int index)
                    {
                      return Padding(
                        padding: const EdgeInsets.only(
                          top: 10,
                          left: 10,
                          right: 10,

                        ),
                        child: InkWell(
                          onTap: ()async{
                            createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
                            createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
                            createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
                            createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
                            createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
                            createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
                            createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
                            createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
                            createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
                            createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;

                            createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
                            createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
                            createOrderController.pickupContactNoController.text =  controller.getCustomerBytenantId[index].contactno??'';
                            createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
                            createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
                            createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
                            createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
                            createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
                            createOrderController.pickupPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;

                            logger.i (createOrderController.pickupCustomerId);
                            logger.i (createOrderController.dropCustomerId);


                            if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
                              Toast.showToast('Please select different customer it already selected');
                            }
                            else{
                              createOrderController.pickupSaveAddress = false;
                              Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));

                            }
                          },
                          child: Stack(
                            children: [
                              Container(
                                padding: const EdgeInsets.only(
                                    right: 15
                                ),
                                decoration: BoxDecoration(
                                  color: ColorConstants.secondaryColor,
                                  boxShadow: const [
                                    BoxShadow(color: Colors.grey)
                                  ],
                                  borderRadius:
                                  const BorderRadius.all(Radius.circular(3)),
                                ),
                                height: Get.height*0.15,
                                child: Row(
                                  mainAxisAlignment:
                                  MainAxisAlignment.start,
                                  crossAxisAlignment:
                                  CrossAxisAlignment.center,
                                  children: [
                                    Expanded(
                                        flex: 3,
                                        child: Container(
                                          padding: const EdgeInsets.all(5),
                                          decoration: BoxDecoration(
                                            color: UtilityPromotion
                                                .getLightColors(
                                                controller.getCustomerBytenantId[index].firstname![0]
                                                    .toString())
                                                .withAlpha(100),
                                            shape: BoxShape.rectangle,
                                          ),
                                          child: Column(
                                            mainAxisAlignment:
                                            MainAxisAlignment.center,
                                            children: [
                                              SizedBox(height: 10,),
                                              CircleAvatar(
                                                  backgroundColor:
                                                  Colors.white70,
                                                  radius: 28,
                                                  child: Text(
                                                    controller.getCustomerBytenantId[index].firstname == '' ?'':
                                                    controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
                                                    style: const TextStyle(
                                                        color: Colors
                                                            .black54,
                                                        fontSize: 22),
                                                  )),
                                              Spacer(),
                                              Container(
                                                padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
                                                decoration: BoxDecoration(color: ColorConstants.secondaryColor),
                                                child: Center(
                                                  child: Text(
                                                    '${controller.getCustomerBytenantId[index].suburb}',
                                                    style: TextStyle(
                                                        color: ColorConstants
                                                            .darkGreyColor,
                                                        fontSize: 14,
                                                        fontWeight:
                                                        FontWeight.bold),
                                                    maxLines: 1,
                                                    overflow: TextOverflow.ellipsis,
                                                  ),
                                                ),
                                              )
                                            ],
                                          ),
                                        )),
                                    const SizedBox(
                                      width: 10,
                                    ),
                                    Expanded(
                                        flex: 8,
                                        child: Column(
                                          crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                          mainAxisAlignment:
                                          MainAxisAlignment.spaceEvenly,
                                          children: [
                                            Row(
                                              children: [
                                                Icon(
                                                  Icons.person,
                                                  color: ColorConstants
                                                      .primaryColor,
                                                  size: 20,
                                                ),
                                                const SizedBox(
                                                  width: 5,
                                                ),
                                                Row(
                                                  children: [
                                                    Text(
                                                      controller.getCustomerBytenantId[index].firstname ?? "",
                                                      style: TextStyle(
                                                          fontSize: 16,
                                                          color: Colors
                                                              .grey[600],
                                                          fontWeight:
                                                          FontWeight
                                                              .w600),
                                                    ),
                                                  ],
                                                ),
                                              ],
                                            ),
                                            Row(
                                              children: [
                                                Icon(
                                                  Icons.call,
                                                  color:
                                                  ColorConstants.primaryColor,
                                                  size: 20,
                                                ),
                                                const SizedBox(
                                                  width: 5,
                                                ),
                                                Text(
                                                  '${controller.getCustomerBytenantId[index].contactno}',
                                                  style: TextStyle(
                                                      color: ColorConstants
                                                          .darkGreyColor,
                                                      fontSize: 14,
                                                      fontWeight:
                                                      FontWeight.bold),
                                                ),

                                              ],
                                            ),
                                            Row(
                                              children: [
                                                Icon(
                                                  Icons.location_on,
                                                  color:
                                                  ColorConstants.primaryColor,
                                                  size: 20,
                                                ),
                                                const SizedBox(
                                                  width: 5,
                                                ),
                                                Expanded(
                                                  child: Text(
                                                    '${controller.getCustomerBytenantId[index].address}',
                                                    style: TextStyle(
                                                        color: ColorConstants
                                                            .darkGreyColor,
                                                        fontSize: 14,
                                                        fontWeight:
                                                        FontWeight.bold),
                                                    maxLines: 1,
                                                    overflow: TextOverflow.ellipsis,
                                                  ),
                                                ),
                                              ],
                                            ),
                                            // SizedBox(
                                            //   height: 10,
                                            // ),
                                          ],
                                        )),
                                  ],
                                ),
                              ),

                            ],
                          ),
                        ),
                      );
                    }
                ),
              ),
            ],

          );
        }
      ),
    );
  }
   queueShimmerCard(BuildContext context) {
     return Expanded(
       child: ListView.builder(
           itemCount: 6,
           itemBuilder: (_, __) {
             return Padding(
               padding: const EdgeInsets.all(3.0),
               child: Shimmer.fromColors(
                 enabled: true,
                 highlightColor: ColorConstants.lightGreyBg!,
                 baseColor: Colors.grey[300]!,
                 child: Padding(
                   padding: const EdgeInsets.only(
                     top: 10,
                     left: 10,
                     right: 10,

                   ),
                   child: InkWell(
                     onTap: ()async{

                     },
                     child: Stack(
                       children: [
                         Container(
                           padding: const EdgeInsets.only(
                               right: 15
                           ),
                           decoration: BoxDecoration(
                             color: ColorConstants.secondaryColor,
                             boxShadow: const [
                               BoxShadow(color: Colors.grey)
                             ],
                             borderRadius:
                             const BorderRadius.all(Radius.circular(3)),
                           ),
                           height: Get.height*0.10,
                           child: Row(
                             mainAxisAlignment:
                             MainAxisAlignment.start,
                             crossAxisAlignment:
                             CrossAxisAlignment.center,
                             children: [
                               Expanded(
                                   flex: 2,
                                   child: Container(
                                     padding: const EdgeInsets.all(5),
                                     decoration: const BoxDecoration(
                                       color:Colors.grey,
                                       shape: BoxShape.rectangle,
                                     ),
                                     child:  Column(
                                       mainAxisAlignment:
                                       MainAxisAlignment.center,
                                       children: [
                                         CircleAvatar(
                                             backgroundColor:
                                             Colors.white70,
                                             radius: 28,
                                             child: Text(
                                               '',
                                               style: TextStyle(
                                                   color: Colors
                                                       .black54,
                                                   fontSize: 22),
                                             )),
                                       ],
                                     ),
                                   )),
                               const SizedBox(
                                 width: 10,
                               ),
                               Expanded(
                                   flex: 8,
                                   child: Column(
                                     crossAxisAlignment:
                                     CrossAxisAlignment.start,
                                     mainAxisAlignment:
                                     MainAxisAlignment.spaceEvenly,
                                     children: [
                                       Row(
                                         children: [
                                           Icon(
                                             Icons.person,
                                             color: ColorConstants
                                                 .primaryColor,
                                             size: 20,
                                           ),
                                           const SizedBox(
                                             width: 5,
                                           ),
                                           Row(
                                             children: [
                                               Text(
                                                 "",
                                                 style: TextStyle(
                                                     fontSize: 16,
                                                     color: Colors
                                                         .grey[600],
                                                     fontWeight:
                                                     FontWeight
                                                         .w600),
                                               ),
                                             ],
                                           ),
                                         ],
                                       ),
                                       Row(
                                         children: [
                                           Icon(
                                             Icons.call,
                                             color:
                                             ColorConstants.primaryColor,
                                             size: 20,
                                           ),
                                           const SizedBox(
                                             width: 5,
                                           ),
                                           Text(
                                             '',
                                             style: TextStyle(
                                                 color: ColorConstants
                                                     .darkGreyColor,
                                                 fontSize: 14,
                                                 fontWeight:
                                                 FontWeight.bold),
                                           ),
                                           const Spacer(),

                                           Text(
                                             '',
                                             style: TextStyle(
                                                 color: ColorConstants
                                                     .darkGreyColor,
                                                 fontSize: 14,
                                                 fontWeight:
                                                 FontWeight.bold),
                                           ),
                                         ],
                                       ),
                                       // SizedBox(
                                       //   height: 10,
                                       // ),
                                     ],
                                   )),
                             ],
                           ),
                         ),

                       ],
                     ),
                   ),
                 ),
               ),
             );
           }),
     );
   }

}

