xLayout_Render_HeadView method

List<Widget> xLayout_Render_HeadView(
  1. XView xview, {
  2. bool border_Visible = true,
})

Override per cambiare widget dell'HeadView dell'Elenco

Implementation

List<Widget> xLayout_Render_HeadView(XView xview, {bool border_Visible = true}) {
  xLayout_maxRowLen = 0; //resetto
  var grps = widget.view!.cols
      . //
      groupListsBy((element) => element.originY)
      .entries
      .toList();
  var lastY = grps.last.key;
  double avgColsInY = 0;
  grps.map((e) => avgColsInY += e.value.length).toList();
  avgColsInY = avgColsInY / grps.length;
  var r = grps.map(
    (e) {
      //x ogni Y
      //x orgni sottoROW/grp
      double rowLen = 0;
      var child = xLayout_Render_HeadView_Widget_forY(
          e,
          e.value.map((xCol) {
            var xwidgt = Container(
                padding: EdgeInsets.symmetric(horizontal: 2, vertical: widget.pageMode_Active ? 2 : 5),
                decoration: BoxDecoration(
                  color: (xCol.xmodelXprop.col_Color == Color(0xff000000) ? XColors.foregroundLight : xCol.xmodelXprop.col_Color).withAlpha(40),
                  border: Border.all(width: 1, color: xCol.xmodelXprop.col_Color == Color(0xff000000) ? XColors.foregroundLight.withAlpha(150) : xCol.xmodelXprop.col_Color.withAlpha(150)),
                ),
                width: xItem_cellIsFlexible
                    ? (xCol.width * (widget.xApp!.KforScale + (kIsWeb ? 0.6 : 0))) //
                    : (xCol.width * (widget.xApp!.KforScale + (kIsWeb ? 0.6 : 0))),
                // constraints: BoxConstraints(minWidth: xItem_cellIsFlexible ? (xCol.width * XUtils.kforScale) : xCol.width, maxWidth: xItem_cellIsFlexible ? (xCol.width * XUtils.kforScale) : xCol.width),
                child: InkWell(
                    onTap: () async {
                      //Tap per gestire il sort delle colonne
                      await xOnTapHeaderCell(xCol);
                    },
                    child: Text(
                      (xCol.sorted == null
                              ? ""
                              : (xCol.sorted ?? false).not()
                                  ? " ⇧ "
                                  : " ⇩ ") +
                          xCol.colCaption,
                      style: widget.xCells_Item_TextStyle != null ? widget.xCells_Item_TextStyle!(xCol, null, xCol.xmodelXprop.col_Color) : XStyles.xStyTextForSubLabel(textColor: xCol.xmodelXprop.col_Color == Color(0xff000000) ? XColors.foregroundLight : xCol.xmodelXprop.col_Color),
                      textAlign: TextAlign.center,
                    )));
            rowLen += 10 + 5 + xwidgt.constraints!.minWidth;
            return xwidgt;
          }).toList(),
          lastY,
          avgColsInY > 3);
      if (rowLen > xLayout_maxRowLen) xLayout_maxRowLen = rowLen;
      return child;
    },
  ).toList();

  return r;
}