import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';

class InfoFragment extends StatelessWidget {
  WorkListResponseModel? workListData;
  List<POHeader> poHeaderList;
  List<GetStampMsNotificationBodyList>? getStampMsNotifications;
  List<GetStampNsNotificationBodyList>? getStampNsNotifications;
  List<ItemCreationHeader> itemCreationHeader;
  List<GetEitCollectionNotificationBodyList>? getEitCollectionNotificationBodyList;
  List<GetPhonesNotificationBodyList>? getPhonesNotificationBodyList;
  List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList;
  List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList;
  GetContactNotificationBodyList? getContactNotificationBodyList;
  GetPrNotificationBodyList? getPrNotificationBodyList;

  InfoFragment(
      {this.workListData,
      this.poHeaderList = const <POHeader>[],
      this.itemCreationHeader = const <ItemCreationHeader>[],
      this.getStampMsNotifications,
      this.getStampNsNotifications,
      this.getEitCollectionNotificationBodyList,
      this.getPhonesNotificationBodyList,
      this.getBasicDetNtfBodyList,
      this.getAbsenceCollectionNotificationBodyList,
      this.getContactNotificationBodyList,
      this.getPrNotificationBodyList});

  double itemHeight = 0;
  double itemWidth = 0;

  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;
    itemHeight = (size.height - kToolbarHeight - 24) / 9;
    itemWidth = size.width / 2;

    List<Widget> uiList = [
      if ((workListData?.iTEMTYPE ?? "") == "INVMOA")
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: [
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""),
              ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""),
            ),
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""),
              ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""),
            ),
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""),
              ItemDetailViewCol(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""),
            ),
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.subject.tr(), workListData!.sUBJECT ?? ""),
              Container(),
              isItLast: true,
            ),
          ],
        ).objectContainerView(),
      if (getPrNotificationBodyList != null) getPRNotificationBodyListWidget(getPrNotificationBodyList!),
      if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []),
      if (getStampNsNotifications?.isNotEmpty ?? false) getStampNsNotificationsListView(getStampNsNotifications ?? []),
      if (poHeaderList.isNotEmpty) getPoNotificationsListView(),
      if (itemCreationHeader.isNotEmpty) getItemCreationHeaderView(),
      if (getEitCollectionNotificationBodyList?.isNotEmpty ?? false) getEitNotificationsListView(getEitCollectionNotificationBodyList ?? []),
      if (getPhonesNotificationBodyList?.isNotEmpty ?? false) getPhonesNotificationBodyListWidget(getPhonesNotificationBodyList ?? []).objectContainerView(title: "Mobile Numbers"),
      if (getBasicDetNtfBodyList?.isNotEmpty ?? false) getBasicDetNtfBodyListWidget(getBasicDetNtfBodyList ?? []).objectContainerView(title: "Basic Information"),
      if (getAbsenceCollectionNotificationBodyList?.isNotEmpty ?? false) getAbsenceCollectionNotificationBodyListWidget(getAbsenceCollectionNotificationBodyList ?? []),
      if (getContactNotificationBodyList != null) getContactNotificationBodyListWidget(getContactNotificationBodyList ?? GetContactNotificationBodyList()).objectContainerView(),
    ];
    return Container(
      width: double.infinity,
      height: double.infinity,
      child: uiList.isEmpty
          ? LocaleKeys.noDataAvailable.tr().toText16().center
          : ListView(
              padding: const EdgeInsets.all(21),
              children: uiList,
            ),
    );
  }

  Widget getPoNotificationsListView() {
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (cxt, index) => Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                Column(
                  children: [
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.description.tr(), workListData!.fROMUSER ?? ""),
                      ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""),
                      ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""),
                      ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.supplier.tr(), poHeaderList[index].vENDORNAME ?? ""),
                      ItemDetailViewCol(LocaleKeys.site.tr(), poHeaderList[index].vENDORSITECODE ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.buyer.tr(), poHeaderList[index].bUYER ?? ""),
                      ItemDetailViewCol(LocaleKeys.preparer.tr(), poHeaderList[index].pREPARER ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.creationDate.tr(), poHeaderList[index].cREATIONDATE ?? ""),
                      ItemDetailViewCol(LocaleKeys.shipToLocation.tr(), poHeaderList[index].sHIPTOLOCATIONNAME ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.quotationNumber.tr(), poHeaderList[index].qUOTATIONNUMBER ?? ""),
                      ItemDetailViewCol(LocaleKeys.quotationDate.tr(), poHeaderList[index].qUOTATIONDATE ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.paymentTerms.tr(), poHeaderList[index].pAYMENTTERMS ?? ""),
                      ItemDetailViewCol(LocaleKeys.currency.tr(), poHeaderList[index].cURRENCYNAME ?? ""),
                      isItLast: true,
                    ),
                  ],
                ).objectContainerView(title: LocaleKeys.infoDetail.tr()),
                12.height,
                Column(
                  children: [
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.grossAmount.tr(), poHeaderList[index].gROSSAMOUNT?.toString() ?? ""),
                      ItemDetailViewCol(LocaleKeys.discountAmount.tr(), poHeaderList[index].dISCOUNTAMOUNT?.toString() ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.customDuty.tr(), poHeaderList[index].cUSTOMDUTY?.toString() ?? ""),
                      ItemDetailViewCol(LocaleKeys.shipHandle.tr(), poHeaderList[index].sHIPHANDLE?.toString() ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""),
                      ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""),
                    ),
                    ItemDetailGrid(
                      ItemDetailViewCol(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""),
                      Container(),
                      isItLast: true,
                    ),
                  ],
                ).objectContainerView(title: LocaleKeys.amount_detail.tr()),
              ],
            ),
        separatorBuilder: (cxt, index) => 4.height,
        itemCount: poHeaderList.length);
  }

  // Widget getAbsenceCollectionNotificationsListView(List<GetAbsenceCollectionNotificationBodyList> list) {
  //   List<CollectionNotificationAbsence> dataList = list.isEmpty ? [] : (list.first.collectionNotification ?? []);
  //   return ListView.separated(
  //       shrinkWrap: true,
  //       physics: const NeverScrollableScrollPhysics(),
  //       itemBuilder: (cxt, index) => ItemDetailView(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!),
  //       separatorBuilder: (cxt, index) => 4.height,
  //       itemCount: dataList.length);
  // }

  Widget getStampMsNotificationsListView(List<GetStampMsNotificationBodyList> list) {
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (cxt, index) => Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()),
                  ItemDetailViewCol(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()),
                  ItemDetailViewCol(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.shiftType.tr(), list[index].sHTTYPEDESC.toString()),
                  ItemDetailViewCol(LocaleKeys.shift.tr(), list[index].sHTNAME.toString()),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.breakText.tr(), list[index].bREAKNAME.toString()),
                  ItemDetailViewCol(LocaleKeys.actualSwipeStart.tr(), list[index].sHTACTUALSTARTTIME.toString()),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.actualSwipeEnd.tr(), list[index].sHTACTUALENDTIME.toString()),
                  ItemDetailViewCol(LocaleKeys.approvedSwipeStart.tr(), list[index].aPPROVEDSTARTTIME.toString()),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.approvedSwipeStartReason.tr(), list[index].aPPROVEDSTARTREASON.toString()),
                  ItemDetailViewCol(LocaleKeys.approvedSwipeEnd.tr(), ""),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()),
                  Container(),
                  isItLast: true,
                ),
              ],
            ).objectContainerView(),
        separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
        itemCount: list.length);
  }

  Widget getStampNsNotificationsListView(List<GetStampNsNotificationBodyList> list) {
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (cxt, index) => Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()),
                  ItemDetailViewCol(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()),
                  ItemDetailViewCol(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)),
                  isItLast: true,
                ),
              ],
            ).objectContainerView(),
        separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
        itemCount: list.length);
  }

  Widget getItemCreationHeaderView() {
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (cxt, index) => Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), itemCreationHeader[index].oPERATINGUNIT?.toString() ?? ""),
                  ItemDetailViewCol(LocaleKeys.category.tr(), itemCreationHeader[index].cATEGORY?.toString() ?? ""),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.requester.tr(), itemCreationHeader[index].rEQUESTER?.toString() ?? ""),
                  ItemDetailViewCol(LocaleKeys.analyzedBy.tr(), itemCreationHeader[index].aNALYZEDBY?.toString() ?? ""),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.approvedDate.tr(), itemCreationHeader[index].aPPROVEDDATE?.toString() ?? ""),
                  ItemDetailViewCol(LocaleKeys.itemType.tr(), itemCreationHeader[index].iTEMTYPE?.toString() ?? ""),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.relatedTo.tr(), itemCreationHeader[index].rELATEDTO?.toString() ?? ""),
                  ItemDetailViewCol(LocaleKeys.requestDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(itemCreationHeader[index].rEQUESTDATE.toString()), false)),
                ),
                ItemDetailGrid(
                  ItemDetailViewCol(LocaleKeys.analyzedDate.tr(), itemCreationHeader[index].aNALYZEDDATE?.toString() ?? ""),
                  ItemDetailViewCol(LocaleKeys.urgent.tr(), itemCreationHeader[index].uRGENTFLAGDISP?.toString() ?? ""),
                ),
              ],
            ).objectContainerView(),
        separatorBuilder: (cxt, index) => 18.height,
        itemCount: itemCreationHeader.length);
  }

  //HR multiple type requests
  Widget getEitNotificationsListView(List<GetEitCollectionNotificationBodyList> list) {
    return ListView.separated(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (cxt, index) {
        List<CollectionNotificationEit> dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []);
        dataList = dataList.where((o) => o.displayFlag == "Y").toList();
        bool isOdd = false;
        if (dataList.length % 2 != 0) {
          isOdd = true;
          dataList.add(new CollectionNotificationEit());
        }
        return GridView.builder(
          itemCount: dataList.length,
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemBuilder: (context, index) => ItemDetailViewGridItem(
            index,
            dataList[index].segmentPrompt,
            dataList[index].segmentValueDsp,
            isNeedToShowEmptyDivider: (dataList.length == index + 1)
                ? isOdd
                    ? true
                    : false
                : false,
          ),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            childAspectRatio: (itemWidth / itemHeight),
          ),
        ).objectContainerView();
      },
      separatorBuilder: (cxt, index) => 12.height,
      itemCount: list.length,
    );
  }

  Widget getPhonesNotificationBodyListWidget(List<GetPhonesNotificationBodyList> list) {
    bool isOdd = false;
    if (list.length % 2 != 0) {
      isOdd = true;
      list.add(new GetPhonesNotificationBodyList());
    }
    return GridView.builder(
      itemCount: list.length,
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (context, index) => ItemDetailViewGridItem(
        index,
        LocaleKeys.subject.tr(),
        list[index].proposedPhoneNumber ?? "",
        isNeedToShowEmptyDivider: (list.length == index + 1)
            ? isOdd
                ? true
                : false
            : false,
      ),
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 2,
        childAspectRatio: (itemWidth / itemHeight),
      ),
    );
    return Container(
      color: Colors.yellow,
      child: ListView.separated(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemBuilder: (cxt, index) => ItemDetailViewCol(LocaleKeys.subject.tr(), list[index].proposedPhoneNumber ?? ""),
          separatorBuilder: (cxt, index) => 4.height,
          itemCount: list.length),
    );
  }

  Widget getBasicDetNtfBodyListWidget(List<GetBasicDetNtfBodyList> list) {
    bool isOdd = false;
    if (list.length % 2 != 0) {
      isOdd = true;
      list.add(new GetBasicDetNtfBodyList());
    }
    return GridView.builder(
      itemCount: list.length,
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (context, index) => ItemDetailViewGridItem(
        index,
        list[index].segmentPrompt,
        list[index].segmentValueDsp,
        isNeedToShowEmptyDivider: (list.length == index + 1)
            ? isOdd
                ? true
                : false
            : false,
      ),
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 2,
        childAspectRatio: (itemWidth / itemHeight),
      ),
    );
    return Container(
      color: Colors.pink,
      child: ListView.separated(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemBuilder: (cxt, index) => ItemDetailViewCol(list[index].segmentPrompt!, list[index].segmentValueDsp!),
          separatorBuilder: (cxt, index) => 4.height,
          itemCount: list.length),
    );
  }

  Widget getAbsenceCollectionNotificationBodyListWidget(List<GetAbsenceCollectionNotificationBodyList> list) {
    return ListView.separated(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (cxt, index) {
        List<CollectionNotificationAbsence> dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []);
        dataList = dataList.where((o) => o.dISPLAYFLAG == "Y").toList();
        bool isOdd = false;
        if (dataList.length % 2 != 0) {
          isOdd = true;
          dataList.add(new CollectionNotificationAbsence());
        }

        return GridView.builder(
          itemCount: dataList.length,
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemBuilder: (context, index) => ItemDetailViewGridItem(
            index,
            dataList[index].sEGMENTPROMPT,
            dataList[index].sEGMENTVALUEDSP,
            isNeedToShowEmptyDivider: (dataList.length == index + 1)
                ? isOdd
                    ? true
                    : false
                : false,
          ),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            childAspectRatio: (itemWidth / itemHeight),
          ),
        ).objectContainerView();
        return ListView.separated(
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                itemBuilder: (cxt, index) => dataList[index].dISPLAYFLAG == "Y" ? ItemDetailViewCol(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!) : Container(),
                separatorBuilder: (cxt, index) => dataList[index].dISPLAYFLAG == "Y" ? 4.height : 0.height,
                itemCount: dataList.length)
            .objectContainerView();
      },
      separatorBuilder: (cxt, index) => 12.height,
      itemCount: list.length,
    );
  }

  Widget getPRNotificationBodyListWidget(GetPrNotificationBodyList getPrNotificationBodyList) {
    return Column(
      children: [
        getPrNotificationBodyList.pINFORMATION != null ? getPrNotificationBodyList.pINFORMATION.toString().toText14(color: MyColors.textMixColor).objectContainerView() : Container(),
        12.height,
        Column(
          children: [
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""),
              ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""),
            ),
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""),
              ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""),
            ),
            ItemDetailGrid(
              ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""),
              ItemDetailViewCol(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""),
            ),
            Column(
              children: getPRHeaderValues(),
            )
          ],
        ).objectContainerView(),
      ],
    );
  }

  List<Widget> getPRHeaderValues() {
    List<Widget> pRHeaders = [];
    getPrNotificationBodyList!.pRHeader!.forEach((element) {
      pRHeaders.add(ItemDetailGrid(ItemDetailViewCol(element.hDRATTRIBUTENAME!, element.hDRATTRIBUTEVALUE!), Container()));
    });
    return pRHeaders;
  }

  Widget getContactNotificationBodyListWidget(GetContactNotificationBodyList data) {
    bool isOdd = false;
    try {
      if (data.contactNotificationBody!.length % 2 != 0) {
        isOdd = true;
        data.contactNotificationBody!.add(new ContactNotificationBody());
      }
    } catch (e) {}

    return GridView.builder(
      itemCount: data.contactNotificationBody!.length,
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (context, index) => ItemDetailViewGridItem(
        index,
        data.contactNotificationBody![index].segmentPrompt,
        data.contactNotificationBody![index].segmentValueDsp,
        isNeedToShowEmptyDivider: (data.contactNotificationBody!.length == index + 1)
            ? isOdd
                ? true
                : false
            : false,
      ),
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 2,
        childAspectRatio: (itemWidth / itemHeight),
      ),
    ).objectContainerView();
    return Container(
      color: Colors.orange,
      child: ListView.separated(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemBuilder: (cxt, index) => ItemDetailViewCol(data.contactNotificationBody![index].segmentPrompt!, data.contactNotificationBody![index].segmentValueDsp!),
          separatorBuilder: (cxt, index) => 4.height,
          itemCount: data.contactNotificationBody!.length),
    );
  }
}
