buildXItem<T extends XFDataItem, H extends XFDataItem?> method

dynamic buildXItem<T extends XFDataItem, H extends XFDataItem?>(
  1. T item,
  2. void parentSetState(
    1. void ()
    ), {
  3. List? liChildrens,
  4. Widget dettItem(
    1. dynamic
    )?,
  5. dynamic onLongPress_MainItem(
    1. T
    )?,
  6. dynamic BTNadd_cmdAdd(
    1. T
    )?,
  7. dynamic BTN_cmdEdit(
    1. T
    )?,
  8. String? BTNadd_label,
  9. Widget? mainWidget,
  10. Color? backGround_Color,
  11. Color? backGround_Color_ItemSel,
  12. Color? border_Color,
  13. Widget dettWidget(
    1. dynamic
    )?,
  14. EdgeInsetsGeometry? margin,
  15. List<XPopUpMenuItem>? liPopUpMenu_Items,
  16. bool border_Visible = false,
  17. bool title_InMainWidget_Visible = false,
  18. XView? xView_Scheda,
  19. XView? xView_Elenco,
  20. XView? xViewDett,
  21. List<Widget>? titleLiWidgets,
  22. bool viewDett_Data = false,
  23. bool showXMedia_Always = false,
  24. bool viewXMediaUI = false,
  25. bool bottomWidgets_WithMainWidget = false,
  26. BorderRadiusGeometry? borderRadius_Item,
  27. List<XAction>? listWidgets_BTNactions,
  28. List<Widget>? listWidgets_bottomMainWidget,
  29. List<Widget>? listWidgets_TopLeft,
})

Build dell'XItemComplex per la visualizzazione di Media o Dati a Tree nidificati

Implementation

buildXItem<T extends XFDataItem, H extends XFDataItem?>(
  T item,
  void Function(void Function()) parentSetState, {
  List<dynamic>? liChildrens,
  Widget Function(dynamic)? dettItem,
  Function(T)? onLongPress_MainItem,
  Function(T)? BTNadd_cmdAdd,
  dynamic Function(T)? BTN_cmdEdit,
  String? BTNadd_label,
  Widget? mainWidget,
  Color? backGround_Color,
  Color? backGround_Color_ItemSel,
  Color? border_Color,
  Widget Function(dynamic)? dettWidget,
  EdgeInsetsGeometry? margin,
  List<XPopUpMenuItem>? liPopUpMenu_Items,
  bool border_Visible = false,
  bool title_InMainWidget_Visible = false,
  XView? xView_Scheda,
  XView? xView_Elenco,
  XView? xViewDett,
  List<Widget>? titleLiWidgets,
  bool viewDett_Data = false,
  bool showXMedia_Always = false,
  bool viewXMediaUI = false,
  bool bottomWidgets_WithMainWidget = false,
  BorderRadiusGeometry? borderRadius_Item,
  List<XAction>? listWidgets_BTNactions,
  List<Widget>? listWidgets_bottomMainWidget,
  List<Widget>? listWidgets_TopLeft,
}) {
  if (widget.item_Widget_BuildXItem_XMedias != null) {
    mainWidget = widget.item_Widget_BuildXItem_XMedias!(item as K);
  }
  xRoundedStyle_Active ? borderRadius_Item = BorderRadius.circular(20) : null;
  xLayout_XItem_BackgoundColor(item) != null ? backGround_Color = xLayout_XItem_BackgoundColor(item) : null;
  return StatefulBuilder(
    builder: (context, setState) {
      listWidgets_TopLeft = List<Widget>.empty(growable: true);
      List<XAction>? _xActionsLi_LEFT = List<XAction>.empty(growable: true);
      List<XAction>? _xActionsLi_RIGHT = List<XAction>.empty(growable: true);
      List<XAction>? _xActionsLi_FAST = List<XAction>.empty(growable: true);
      GlobalKey<PopupMenuButtonState> popUp_Key = GlobalKey<PopupMenuButtonState>();
      liPopUpMenu_ActionOnItem.clear();
      if (xActionLi_RIGHT!.any((element) => element.key == "BTN_Edit").not() || xActionLi_LEFT!.any((element) => element.key == "BTN_Edit").not() || xActionLi_LEFT!.any((element) => element.key == "BTN_Edit").not()) {
        liPopUpMenu_ActionOnItem.add(XPopUpMenuItem(
            title: "Modifica",
            color: Colors.yellow,
            icon: Icons.edit,
            toolTip_Message: XfxToolTips.BTN_Modifica,
            onPressed: BTN_cmdEdit != null
                ? (context, obj) async {
                    var res = await BTN_cmdEdit(obj);
                    if (res != null) {
                      return res;
                    } else {
                      return null;
                    }
                  }
                : (context, obj) async {
                    if (xView_Elenco != null) {
                      var res = await xPreview_Dialog(widget.xView_ForEditItem ?? xView_Elenco, obj);
                      if (res != null) {
                        // item = res.getCloneFull() as T;
                        obj.isModified = true;
                        print(widget.rootItemEdited);
                        // print(widget.itemEdited);
                        widget.rootItemEdited != null ? widget.rootItemEdited!(obj) : null;
                        // widget.itemEdited != null ? widget.itemEdited!(obj) : null;
                        return obj;
                      } else {
                        return null;
                      }
                    } else
                      return obj;
                  }));
      }

      listWidgets_TopLeft!.addAll(xLayout_xItemComplex_ListWidgets_TopLeft(item));

      if (liPopUpMenu_Items != null) liPopUpMenu_ActionOnItem.addAll(liPopUpMenu_Items);

      if (listWidgets_BTNactions != null) xActionLi_FAST!.addAll(listWidgets_BTNactions);

      //Aggiungo alla lista delle XActionsRight quelle fisse a livello di xelenco
      if (xActionLi_RIGHT != null) _xActionsLi_RIGHT.addAll(xActionLi_RIGHT!.toList());

      if (xActions_RIGHT_ForItem(item) != null) {
        xActions_RIGHT_ForItem(item)!.forEach((xActionRight) {
          if (xActionRight != null) _xActionsLi_RIGHT.add(xActionRight);
        });
      }

      //Aggiungo alla lista delle XActionsLeft quelle fisse a livello di xelenco
      if (xActionLi_LEFT != null) _xActionsLi_LEFT.addAll(xActionLi_LEFT!.toList());

      //Aggiungo le altre XAction Left a livello di Item dell'elenco
      if (xActions_LEFT_ForItem(item) != null) {
        xActions_LEFT_ForItem(item)!.forEach((xActionLeft) {
          if (xActionLeft != null) _xActionsLi_LEFT.add(xActionLeft);
        });
      }

      xActionLi_FAST!.where((element) => element.idx! < 900 && element.fastAction.not()).forEach((element) {
        liPopUpMenu_ActionOnItem.add(XPopUpMenuItem(
          title: element.label ?? "",
          iconImage: element.icon_Image != null ? Image.memory(element.icon_Image!, width: 40, height: 40) : null,
          icon: element.icon,
          color: element.label_Color,
          toolTip_Message: element.toolTip ?? "",
          onPressed: (p0, p1) async => element.cmd != null ? await element.cmd!(p1, parentSetState, context) : null,
        ));
      });

      if (xActionLi_FAST != null) _xActionsLi_FAST.addAll(xActionLi_FAST!);
      //Aggiungo le altre XAction Left a livello di Item dell'elenco
      if (xActions_FAST_ForItem(item) != null) {
        xActions_FAST_ForItem(item)!.forEach((xActionFast) {
          if (xActionFast != null) _xActionsLi_FAST.add(xActionFast);
        });
      }
      xMedia_Empty(item)
          ? null
          : (kIsWeb ? _xActionsLi_LEFT : _xActionsLi_RIGHT).add(XAction(
              XActionsBase.addXMedia.key,
              1,
              "",
              cmd: (p0, parentSetState, context) async => await xCMD_XMedia_GetMedia(parentSetState, item).then((value) => parentSetState(() {})),
              icon_Color: XActionsBase.addXMedia.icon_Color,
              icon: XActionsBase.addXMedia.icon,
            ));
      xActionLi_FAST != null && xActionLi_FAST!.isNotEmpty
          ? _xActionsLi_RIGHT.add(XAction(
              "BTN_Edit",
              2,
              "",
              cmd: BTN_cmdEdit != null
                  ? (p0, parentSetState, context) async {
                      var res = await BTN_cmdEdit(p0 as T);
                      calcRow(res);
                      return res;
                    }
                  : (p0, parentSetState, context) async {
                      if (xView_Elenco != null) {
                        var res = await xPreview_Dialog(widget.xView_ForEditItem ?? xView_Elenco, p0);
                        if (res != null) {
                          calcRow(res);
                          p0!.isModified = true;
                          widget.itemEdited != null ? widget.itemEdited!(p0) : null;
                        }
                        return p0;
                      } else
                        return p0;
                    },
              icon_Color: Colors.yellow,
              icon: Icons.edit,
            ))
          : null;
      // listWidgets_bottomMainWidget = List<Widget>.empty(growable: true);
      // if (xView_Elenco != null) {
      //   xView_Elenco.cols.where((xcol) => xcol.colKey.startsWith("li").not()).forEach((element) {
      //     if (item[element.colKey] is String && item[element.colKey] != "") {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     } else if (item[element.colKey] is double && item[element.colKey] != 0.0 && element.colKey.startsWith("avanz").not()) {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     } else if (item[element.colKey] is int && item[element.colKey] != 0) {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     } else if (item[element.colKey] is DateTime) {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     } else if (item[element.colKey] is bool) {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     } else if (element.colKey.startsWith("avanz")) {
      //       listWidgets_bottomMainWidget!.add(xLayout_Item_RowWidgets(element, item));
      //     }
      //   });
      // }
      return Container(
          margin: EdgeInsets.only(bottom: 2),
          padding: EdgeInsets.symmetric(vertical: 0),
          child: DragTarget<XFDataItem>(onWillAccept: (data) {
            var res = xOnDrop_BeforeAccept(data!, item);
            parentSetState(() {
              if (res)
                item.isSel = true;
              else
                item.isSel = false;
            });
            return res;
          }, onAccept: (data) async {
            await xOnDrop_Accept(data, item);
            parentSetState(() => item.isSel = false);
          }, onLeave: (data) {
            xOnDrop_Leave(data!);
            parentSetState(() => item.isSel = false);
          }, builder: (context, candidateData, rejectedData) {
            return XElencoItem(setState, item, context, xView_Scheda!,
                xViewDetts: xViewDett,
                liXActions_LEFT: _xActionsLi_LEFT,
                liXActions_RIGHT: _xActionsLi_RIGHT,
                liXActions_FAST: _xActionsLi_FAST,
                xActions_RIGHT_HorizontalAxis: xActions_RIGHT_HorizontalAxis,
                xActions_LEFT_HorizontalAxis: xActions_LEFT_HorizontalAxis,
                xActions_LEFT_widthArea: xActions_LEFT_widthArea,
                xActions_RIGHT_widthArea: xActions_RIGHT_widthArea,
                visible_EmptyCells: widget.isEditable,
                widgetOnStackOfItems: xLayout_WidgetOverItems(item),
                onLongTapItem: () => onLongPress_MainItem!(item),
                margin: margin ?? EdgeInsets.only(left: 1, right: 1, bottom: 1),
                changeStatoWithTap: false,
                funct: () => widget.itemEdited!(item),
                onTapItem: () async {
                  if ((liChildrens == null || liChildrens.isEmpty) && xMedia_Empty(item)) {
                  } else {
                    if (dettItem == null) {
                      if (BTN_cmdEdit != null) {
                        var res = await BTN_cmdEdit(item);
                        calcRow(item);
                      } else {
                        var res = await liPopUpMenu_ActionOnItem.first.onPressed!(context, item);
                        calcRow(res);
                      }
                    } else {
                      parentSetState(() => item.isShowDetails = item.isShowDetails.not());
                    }
                  }
                },
                showTrailingArrow: false,
                decorationBackGroundContainer: widget.xApp!.state.xBox_Decoration(
                  item,
                  backGround_Color: backGround_Color,
                  border_Color: border_Color,
                  border_Visible: border_Visible,
                  backGround_Color_ItemSel: backGround_Color_ItemSel,
                ),
                showingDetails: item.isShowDetails,
                showMainWithDetails: true,
                childMain: DragTarget<T>(
                    onWillAccept: (data) => xOnDrop_BeforeAccept(data!, item),
                    onAccept: (data) async => await xOnDrop_Accept(data, item),
                    builder: (context, candidateData, rejectedData) {
                      return Column(mainAxisSize: MainAxisSize.min, children: [
                        InkWell(
                            onLongPress: () {
                              onLongPress_MainItem!(item);
                            },
                            onTap: () async {
                              if (dettItem == null) {
                                if (BTN_cmdEdit != null) {
                                  var res = await BTN_cmdEdit(item);
                                  calcRow(item);
                                } else {
                                  var res = await liPopUpMenu_ActionOnItem.first.onPressed!(context, item);
                                  calcRow(res);
                                }
                              } else {
                                setState(() => item.isShowDetails = item.isShowDetails.not());
                              }
                            },
                            child: Row(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [
                              //Icona di Expand della riga
                              Column(children: [
                                BTNadd_cmdAdd == null || (mainWidget != null || (liChildrens == null || liChildrens.isEmpty))
                                    ? Container(width: 0, height: 0) //
                                    : Container(
                                        width: 30,
                                        margin: EdgeInsets.only(right: 4),
                                        child: Icon(
                                            (item.isShowDetails)
                                                ? Icons.arrow_upward_rounded //
                                                : Icons.account_tree_outlined,
                                            color: XColors.foregroundLight)),
                                Column(children: listWidgets_TopLeft!.map((e) => e).toList()),
                              ]),

                              kIsWeb.not()
                                  ? Container()
                                  : Container(
                                      width: 40,
                                      child: InkWell(
                                          onTap: () {
                                            if (dettItem == null) {
                                              if (BTN_cmdEdit != null) {
                                                BTN_cmdEdit(item);
                                              } else {
                                                setState(() => liPopUpMenu_ActionOnItem.first.onPressed!(context, item));
                                              }
                                            } else {
                                              setState(() => item.isShowDetails = item.isShowDetails.not());
                                            }
                                          },
                                          child: Wrap(
                                              direction: Axis.vertical,
                                              children: _xActionsLi_FAST
                                                  .where((element) => BTNadd_cmdAdd == null
                                                      ? element.key != XActionsBase.addDett.key &&
                                                          element.key != XActionsBase.popUpActions.key &&
                                                          (xMedia_Empty(item)
                                                              ? element.key != XActionsBase.showXMedia.key //
                                                              : element.key != XActionsBase.addXMedia.key)
                                                      : element.key != XActionsBase.popUpActions.key &&
                                                          (xMedia_Empty(item)
                                                              ? element.key != XActionsBase.showXMedia.key //
                                                              : element.key != XActionsBase.addXMedia.key))
                                                  .map((e) {
                                                if (e.key == XActionsBase.popUpActions.key) {
                                                  return liPopUpMenu_ActionOnItem.isNotEmpty
                                                      ? liPopUpMenu_ActionOnItem.length == 1
                                                          ? xActionLi_FAST!.any((element) => element.key == "BTN_Edit").not()
                                                              ? XActionWidget(
                                                                  e,
                                                                  onPressed: () async => setState(() => liPopUpMenu_ActionOnItem.first.onPressed!(context, item)),
                                                                  xApp: widget.xApp,
                                                                  icon_Color: liPopUpMenu_ActionOnItem.first.color,
                                                                  icon: liPopUpMenu_ActionOnItem.first.icon,
                                                                )
                                                              : Container()
                                                          : Container(
                                                              height: xActionsBTN_Height,
                                                              width: xActionsBTN_Width,
                                                              margin: EdgeInsets.only(top: 3, bottom: 3),
                                                              decoration: BoxDecoration(color: xActionsBTN_BackgroundColor, border: Border.all(width: 1, color: xActionsBTN_BorderColor), borderRadius: BorderRadius.all(Radius.circular(10))),
                                                              child: PopupMenuButton(
                                                                  padding: EdgeInsets.all(0),
                                                                  key: popUp_Key,
                                                                  tooltip: "Vedi azioni",
                                                                  icon: Icon(Icons.more_vert_outlined),
                                                                  itemBuilder: (context) {
                                                                    return liPopUpMenu_ActionOnItem
                                                                        .map((e) => PopupMenuItem(
                                                                            height: 40,
                                                                            child: XBtnbase(
                                                                                decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey[700]!))),
                                                                                height: 40,
                                                                                width: (e.iconImage != null || e.icon != null) ? 250 : 150,
                                                                                label: e.title,
                                                                                icon_WidthArea: 50,
                                                                                label_Style: XStyles.xStyTextForSubLabel(textColor: e.color),
                                                                                icon_Widget: e.icon != null ? null : Container(width: 50, child: e.iconImage),
                                                                                icon: e.iconImage != null ? null : e.icon,
                                                                                icon_Size: 23,
                                                                                icon_Color: e.iconImage != null ? null : e.color,
                                                                                toolTip_Message: e.toolTip_Message,
                                                                                onPressed: () {
                                                                                  Navigator.pop(context);
                                                                                  e.onPressed!(context, item);
                                                                                })))
                                                                        .toList();
                                                                  },
                                                                  iconSize: 22))
                                                      : Container();
                                                } else {
                                                  return XActionWidget(
                                                    e,
                                                    xApp: widget.xApp,
                                                    onPressed: () async {
                                                      if (e.cmd != null) {
                                                        await e.cmd!(item, setState, context);
                                                      } else {
                                                        if (e.key == XActionsBase.showXMedia.key) {
                                                          if (xMedia_Empty(item).not()) {
                                                            FocusScope.of(context).unfocus();
                                                            setState(() {
                                                              item.showXMedia = item.showXMedia.not();
                                                            });
                                                          }
                                                        } else if (e.key == XActionsBase.addXMedia.key) {
                                                          setState(() {
                                                            isBusy.value = true;
                                                            xWaiterMessage = "Caricamento Fotocamera...";
                                                          });
                                                          await xCMD_XMedia_GetMedia(setState, item).then((value) => setState(() {}));
                                                          setState(() {
                                                            isBusy.value = false;
                                                            xWaiterMessage = "";
                                                          });
                                                        } else if (e.key == XActionsBase.addDett.key) {
                                                          setState(() {
                                                            FocusScope.of(context).unfocus();
                                                            BTNadd_cmdAdd!(item);
                                                            item.isShowDetails = true;
                                                          });
                                                        } //
                                                      }
                                                    },
                                                    icon: e.key == XActionsBase.showXMedia.key
                                                        ? xMedia_Empty(item).not()
                                                            ? (showXMedia_Always || item.showXMedia)
                                                                ? Icons.visibility_off
                                                                : Icons.visibility
                                                            : Icons.visibility_off
                                                        : null,
                                                    icon_Color: e.key == XActionsBase.showXMedia.key ? (xMedia_Empty(item) ? Colors.grey[800] : Colors.purple[600]) : null,
                                                  );
                                                }
                                              }).toList()))),

                              //Area della composizione dei dati
                              mainWidget != null
                                  ? Container()
                                  : xView_Elenco != null && widget.showHead
                                      ? Expanded(
                                          child: xView_Elenco.cols.length == 1
                                              ? widget.isEditable
                                                  ? xLayout_CellWidget_Editable(xView_Elenco.cols.first, item, context, item) //
                                                  : xLayout_Item_RowWidgets(xView_Elenco.cols.first, item, flexible: true) //
                                              : Row(children: [
                                                  xView_Elenco.cols.where((xcol) => xcol.colKey.startsWith("li").not()).length == 1
                                                      ? Expanded(
                                                          child: widget.isEditable
                                                              ? xLayout_CellWidget_Editable(xView_Elenco.cols.where((xcol) => xcol.colKey.startsWith("li").not()).first, item, context, item) //
                                                              : xLayout_Item_RowWidgets(xView_Elenco.cols.where((xcol) => xcol.colKey.startsWith("li").not()).first, item)) //
                                                      : Expanded(child: Wrap(children: xLayout_RenderDett_HeadDataView(xView_Elenco, item, border_Visible: false, isForComplexItem: true, liColsToUse: xView_Elenco.cols.where((xcol) => xcol.colKey.startsWith("li").not()).toList())))
                                                ]),
                                        )
                                      : Container(),
                              mainWidget != null
                                  ? Expanded(
                                      child: Column(children: [
                                      Row(children: [Expanded(child: mainWidget)]),
                                      bottomWidgets_WithMainWidget
                                          ? Row(children: [
                                              listWidgets_bottomMainWidget != null
                                                  ? Expanded(
                                                      child: Column(
                                                      mainAxisSize: MainAxisSize.min,
                                                      children: listWidgets_bottomMainWidget!.map((e) => Row(children: [e])).toList(),
                                                    ))
                                                  : Container()
                                            ])
                                          : Container()
                                    ]))
                                  : Container(),
                              kIsWeb
                                  ? Container()
                                  : Container(
                                      width: 40,
                                      child: InkWell(
                                          onTap: () {
                                            if (dettItem == null) {
                                              if (BTN_cmdEdit != null) {
                                                BTN_cmdEdit(item);
                                              } else {
                                                setState(() => liPopUpMenu_ActionOnItem.first.onPressed!(context, item));
                                              }
                                            } else {
                                              setState(() => item.isShowDetails = item.isShowDetails.not());
                                            }
                                          },
                                          child: Wrap(
                                              direction: Axis.vertical,
                                              children: _xActionsLi_FAST
                                                  .where((element) => BTNadd_cmdAdd == null
                                                      ? element.key != XActionsBase.addDett.key &&
                                                          element.key != XActionsBase.popUpActions.key &&
                                                          (xMedia_Empty(item)
                                                              ? element.key != XActionsBase.showXMedia.key //
                                                              : element.key != XActionsBase.addXMedia.key)
                                                      : element.key != XActionsBase.popUpActions.key &&
                                                          (xMedia_Empty(item)
                                                              ? element.key != XActionsBase.showXMedia.key //
                                                              : element.key != XActionsBase.addXMedia.key))
                                                  .map((e) {
                                                if (e.key == XActionsBase.popUpActions.key) {
                                                  return liPopUpMenu_ActionOnItem.isNotEmpty
                                                      ? liPopUpMenu_ActionOnItem.length == 1
                                                          ? xActionLi_FAST!.any((element) => element.key == "BTN_Edit").not()
                                                              ? XActionWidget(
                                                                  e,
                                                                  onPressed: () async => setState(() => liPopUpMenu_ActionOnItem.first.onPressed!(context, item)),
                                                                  xApp: widget.xApp,
                                                                  icon_Color: liPopUpMenu_ActionOnItem.first.color,
                                                                  icon: liPopUpMenu_ActionOnItem.first.icon,
                                                                )
                                                              : Container()
                                                          : Container(
                                                              height: xActionsBTN_Height,
                                                              width: xActionsBTN_Width,
                                                              margin: EdgeInsets.only(top: 3, bottom: 3),
                                                              decoration: BoxDecoration(color: xActionsBTN_BackgroundColor, border: Border.all(width: 1, color: xActionsBTN_BorderColor), borderRadius: BorderRadius.all(Radius.circular(10))),
                                                              child: PopupMenuButton(
                                                                  padding: EdgeInsets.all(0),
                                                                  key: popUp_Key,
                                                                  tooltip: "Vedi azioni",
                                                                  icon: Icon(Icons.more_vert_outlined),
                                                                  itemBuilder: (context) {
                                                                    return liPopUpMenu_ActionOnItem
                                                                        .map((e) => PopupMenuItem(
                                                                            height: 40,
                                                                            child: XBtnbase(
                                                                                decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey[700]!))),
                                                                                height: 40,
                                                                                width: (e.iconImage != null || e.icon != null) ? 250 : 150,
                                                                                label: e.title,
                                                                                icon_WidthArea: 50,
                                                                                label_Style: XStyles.xStyTextForSubLabel(textColor: e.color),
                                                                                icon_Widget: e.icon != null ? null : Container(width: 50, child: e.iconImage),
                                                                                icon: e.iconImage != null ? null : e.icon,
                                                                                icon_Size: 23,
                                                                                icon_Color: e.iconImage != null ? null : e.color,
                                                                                toolTip_Message: e.toolTip_Message,
                                                                                onPressed: () {
                                                                                  Navigator.pop(context);
                                                                                  e.onPressed!(context, item);
                                                                                })))
                                                                        .toList();
                                                                  },
                                                                  iconSize: 22))
                                                      : Container();
                                                } else {
                                                  return XActionWidget(
                                                    e,
                                                    xApp: widget.xApp,
                                                    onPressed: () async {
                                                      if (e.cmd != null) {
                                                        await e.cmd!(item, setState, context);
                                                      } else {
                                                        if (e.key == XActionsBase.showXMedia.key) {
                                                          if (xMedia_Empty(item).not()) {
                                                            FocusScope.of(context).unfocus();
                                                            setState(() {
                                                              item.showXMedia = item.showXMedia.not();
                                                            });
                                                          }
                                                        } else if (e.key == XActionsBase.addXMedia.key) {
                                                          setState(() {
                                                            isBusy.value = true;
                                                            xWaiterMessage = "Caricamento Fotocamera...";
                                                          });
                                                          await xCMD_XMedia_GetMedia(setState, item).then((value) => setState(() {}));
                                                          setState(() {
                                                            isBusy.value = false;
                                                            xWaiterMessage = "";
                                                          });
                                                        } else if (e.key == XActionsBase.addDett.key) {
                                                          setState(() {
                                                            FocusScope.of(context).unfocus();
                                                            BTNadd_cmdAdd!(item);
                                                            item.isShowDetails = true;
                                                          });
                                                        } //
                                                      }
                                                    },
                                                    icon: e.key == XActionsBase.showXMedia.key
                                                        ? xMedia_Empty(item).not()
                                                            ? (showXMedia_Always || item.showXMedia)
                                                                ? Icons.visibility_off
                                                                : Icons.visibility
                                                            : Icons.visibility_off
                                                        : null,
                                                    icon_Color: e.key == XActionsBase.showXMedia.key ? (xMedia_Empty(item) ? Colors.grey[800] : Colors.purple[600]) : null,
                                                  );
                                                }
                                              }).toList())))
                            ])),
                        bottomWidgets_WithMainWidget.not()
                            ? listWidgets_bottomMainWidget != null
                                ? InkWell(
                                    onTap: () {
                                      if (dettItem == null) {
                                        if (BTN_cmdEdit != null) {
                                          BTN_cmdEdit(item);
                                        } else {
                                          setState(() => liPopUpMenu_ActionOnItem.first.onPressed!(context, item));
                                        }
                                      } else
                                        setState(() => item.isShowDetails = item.isShowDetails.not());
                                    },
                                    child: Column(
                                      mainAxisSize: MainAxisSize.min,
                                      children: listWidgets_bottomMainWidget!.map((e) => Container(margin: EdgeInsets.symmetric(vertical: 4), child: Row(children: [e]))).toList(),
                                    ))
                                : Container()
                            : Container(),
                        xMedia_Active && (showXMedia_Always || item.showXMedia)
                            ? Container(
                                child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                xMedia_Empty(item).not()
                                    ? Container(
                                        margin: EdgeInsets.all(3),
                                        decoration: BoxDecoration(border: Border.all(color: Colors.grey[700]!)),
                                        child: Stack(
                                          alignment: kIsWeb ? Alignment.topLeft : Alignment.topRight,
                                          children: [
                                            Column(children: [
                                              Row(children: [
                                                Expanded(
                                                    child: Wrap(
                                                        alignment: WrapAlignment.center,
                                                        runAlignment: WrapAlignment.center,
                                                        spacing: 5,
                                                        runSpacing: 5,
                                                        children: xMediaListOfMine(item).map((e) {
                                                          if (e.mediaType == XEnums.mediaType.audio.value) {
                                                            return xLayout_Builder_AudioDialogWidget(e, item);
                                                          } else if (e.mediaType == XEnums.mediaType.video.value) {
                                                            return xLayout_Builder_VideoWidget(e, item, setState: setState);
                                                          } else {
                                                            return xLayout_Builder_ImmaginiWidget(e, item, setState);
                                                          }
                                                        }).toList())),
                                              ])
                                            ]),
                                            Container(
                                                margin: EdgeInsets.only(left: 5),
                                                child: XActionWidget(
                                                  (kIsWeb ? _xActionsLi_LEFT : _xActionsLi_RIGHT).firstWhere((element) => element.key == XActionsBase.addXMedia.key),
                                                  // onPressed: () async {
                                                  //   setState(() {
                                                  //     isBusy.value = true;
                                                  //     xWaiterMessage = "Caricamento Fotocamera...";
                                                  //   });
                                                  //   await xCMD_XMedia_GetMedia(setState, item).then((value) => setState(() {}));
                                                  //   setState(() {
                                                  //     isBusy.value = false;
                                                  //     xWaiterMessage = "";
                                                  //   });
                                                  // },
                                                )),
                                          ],
                                        ))
                                    : Container(),
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                                //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA  //// AREA XMEDIA
                              ]))
                            : Container()
                      ]);
                    }),
                childDetails: Column(
                  children: [
                    dettWidget != null
                        ? dettWidget(item)
                        : dettItem != null
                            ? liChildrens != null
                                ? Wrap(
                                    spacing: 5,
                                    runSpacing: 5,
                                    children: liChildrens.map((xclVoce) {
                                      return dettItem(xclVoce);
                                    }).toList())
                                : Container()
                            : Container(),
                  ],
                ));
          }));
    },
  );
}