row method

DataRow row({
  1. bool large = false,
  2. List<double?>? widths,
  3. bool selectable = false,
  4. bool isCollapsed = false,
  5. bool isLastChild = false,
  6. Function? onSelected,
})

Implementation

DataRow row({
  bool large = false,
  List<double?>? widths,
  bool selectable = false,
  bool isCollapsed = false,
  bool isLastChild = false,
  Function? onSelected,
}) {
  return DataRow(
    selected: selected,
    onSelectChanged: onSelected != null || onSelectChanged != null
        ? (bool? value) {
            if (onSelected != null) {
              onSelected();
            }
            if (onSelectChanged != null) {
              onSelectChanged!(value);
            }
          }
        : null,
    cells: [
      if (selectable) ...[
        DataCell(
          Opacity(
            opacity: disabled ? 0.5 : 1,
            child: Container(
              padding: EdgeInsets.only(
                left: TodaySpacing.tdsSpace3.spacing,
                top: TodaySpacing.tdsSpace2.spacing,
                bottom: TodaySpacing.tdsSpace2.spacing,
              ),
              width: 28,
              child: TodayCheckbox(
                key: UniqueKey(),
                value: selected ? TodayCheckboxValue.checked : TodayCheckboxValue.unchecked,
                onChanged: (TodayCheckboxValue value) {
                  if (onChanged != null) {
                    onChanged!(value);
                  }
                },
              ),
            ),
          ),
        ),
      ],
      for (int i = 0; i < cells.length; ++i) ...[
        DataCell(
          Opacity(
            opacity: disabled ? 0.5 : 1,
            child: isGroup
                ? groupCell(
                    cell: cells[i],
                    isCollapsed: isCollapsed,
                    headerCell: i == 0,
                    width: widths?[i],
                  )
                : Container(
                    color: footer ? TodayColor.bgShade.color : Colors.transparent,
                    alignment: cells[i].cellAlignment,
                    width: widths?[i],
                    height: large ? 68 : 56,
                    padding: getPadding(
                      toLeft: cells[i].toLeft,
                      type: cells[i].type,
                      isChild: cells[i].isChild,
                      large: large,
                    ),
                    child: TodayTableCell(
                      type: cells[i].type,
                      icon: cells[i].icon,
                      rightIcon: cells[i].rightIcon,
                      iconSpacing: cells[i].iconSpacing,
                      textContent: cells[i].textContent,
                      textDescription: cells[i].textDescription,
                      shimmerDescription: cells[i].shimmerDescription,
                      customWidget: cells[i].customWidget,
                      link: cells[i].link,
                      input: cells[i].input,
                      select: cells[i].select,
                      checkbox: cells[i].checkbox,
                      tags: cells[i].tags,
                      badges: cells[i].badges,
                      textColor: cells[i].textColor,
                      toLeft: cells[i].toLeft,
                      emphasized: cells[i].emphasized,
                      isChild: cells[i].isChild,
                      isLastChild: isLastChild,
                      align: cells[i].align,
                      dropdownItems: cells[i].dropdownItems,
                      cellAlignment: cells[i].cellAlignment,
                      maxWidth: cells[i].maxWidth,
                      padding: cells[i].padding,
                      shimmerTags: cells[i].shimmerTags,
                    ),
                  ),
          ),
        ),
      ],
    ],
  );
}