xLayout_CellWidget method

Container xLayout_CellWidget(
  1. XCol xCol,
  2. dynamic item,
  3. BuildContext context
)

BUILDER DEI WIDGET NON EDITABILI///

Implementation

Container xLayout_CellWidget(XCol xCol, dynamic item, BuildContext context) {
  if (xCol.colKey.startsWith("li")) return Container();
  late Widget _widgetForCell;
  if (xCol.dataType == DateTime) {
    _widgetForCell = xSch_TextFormField_Builder(
      context: context,
      xCol: xCol,
      multiLines: xCol.multilines,
      editable: xCol.allowEditing,
      hintText: "",
      onBefore_Edit: () {},
      value: XUtils.dateToString(item[xCol.colKey] != null ? item[xCol.colKey] : DateTime(1900, 01, 01), noDateLabel: ""),
      onChanged: (value) {},
    );
  } else if (xCol.dataType == bool) {
    _widgetForCell = Container(
        child: XCheckBoxWidget(
      verticalCheckBoxWidget: false,
      label: xCol.colCaption,
      label_Color: xCol.xmodelXprop.col_Color != Colors.black ? xCol.xmodelXprop.col_Color : XColors.foregroundLight,
      activeColor: xCol.xmodelXprop.col_Color != Colors.black ? xCol.xmodelXprop.col_Color : XColors.foregroundLight,
      checkColor: Colors.black,
      value: (item[xCol.colKey] ?? false),
    ));
  } else {
    if (xCol.colKey.startsWith("avanz")) {
      _widgetForCell = Stack(alignment: Alignment.center, children: [
        LinearProgressIndicator(
          value: (item[xCol.colKey] / 100) ?? 0.0,
          minHeight: 20.0,
          backgroundColor: Colors.grey[300],
          valueColor: AlwaysStoppedAnimation<Color>(xCol.xmodelXprop.col_Color),
        ),
        Text('${(item[xCol.colKey] as double).roundToDouble()}%', style: XStyles.xStyTextForLabel(textColor: Colors.black, activeBold: true)),
      ]);
    } else {
      _widgetForCell = xSch_TextFormField_Builder(
        context: context,
        xCol: xCol,
        editable: xCol.allowEditing,
        multiLines: xCol.multilines,
        hintText: "",
        onBefore_Edit: () {},
        value: item[xCol.colKey] == null ? "" : item[xCol.colKey].toString(),
        onChanged: (value) {},
      );
    }
  }

  //Se la colonna è Width FLEX
  if (xCol.resizeStyle == 0) {
    return Container(constraints: BoxConstraints.tightForFinite(height: XSchedaState.heightOfEntryField), child: Container(margin: EdgeInsets.symmetric(horizontal: 4), child: _widgetForCell));
  }
  //Se la colonna è Width PROPORTIONAL
  else if (xCol.resizeStyle == 1) {
    return Container(width: xCol.width, constraints: BoxConstraints(minHeight: widget.xCell_MinHeight, maxHeight: double.infinity, minWidth: xCol.width * .9, maxWidth: xCol.width * 1.2), margin: EdgeInsets.symmetric(horizontal: 4), child: _widgetForCell);
  }
  //Se la colonna è Width FIX
  else {
    return Container(constraints: BoxConstraints(minHeight: widget.xCell_MinHeight, maxHeight: double.infinity), width: xCol.width, margin: EdgeInsets.symmetric(horizontal: 4), child: _widgetForCell);
  }
}