/*
 * @Author       : WuWei
 * @LastEditors: ChenYaJin
 * @Date         : 2021-05-10 14:20:19
 * @LastEditTime: 2023-08-16 10:00:15
 * @FilePath     : /wisdom-huiguanjia-app/task_package/lib/src/pages/statistic/components/task_row_item.dart
 * @Description  :  任务统计-任务子项
 */
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

class BuildTaskRowItem extends StatelessWidget {
  const BuildTaskRowItem({Key? key, this.item, this.inventoryId, this.onClick})
      : super(key: key);
  final item;
  final inventoryId;
  final Function? onClick;

  @override
  Widget build(BuildContext context) {
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;
    return Wisdom.row(
      padding: EdgeInsets.symmetric(
        vertical: 15.pt,
      ),
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Wisdom.column(
          onTap: () => onClick!('', inventoryId),
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            WisText.c666(
              '任务总数',
              size: 14.pt,
              weight: FontWeight.w300,
            ),
            Wisdom(
              margin: EdgeInsets.only(top: 12.pt),
              child: WisText.c222('${item?.taskTotal ?? '0'}'),
            ),
          ],
        ).asExpanded(),
        Wisdom.column(
          onTap: () => onClick!('finished', inventoryId),
          children: [
            WisText.c666(
              '已完成',
              size: 14.pt,
              weight: FontWeight.w300,
            ),
            Wisdom.row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: WisText.c222('${item?.finishedCount ?? '0'}'),
                ),
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: Text(
                    '(${item?.timeoutFinishedCount ?? '0'})',
                    style: TextStyle(
                      color: colorScheme.red,
                      fontSize: 13.pt,
                      fontWeight: FontWeight.w300,
                    ),
                  ),
                ),
              ],
            ),
          ],
        ).asExpanded(),
        Wisdom.column(
          onTap: () => onClick!('doing', inventoryId),
          children: [
            WisText.c666(
              '进行中',
              size: 14.pt,
              weight: FontWeight.w300,
            ),
            Wisdom.row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: WisText.c222('${item?.doingCount ?? '0'}'),
                ),
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: Text(
                    '(${item?.timeoutDoingCount ?? '0'})',
                    style: TextStyle(
                      color: colorScheme.red,
                      fontSize: 13.pt,
                      fontWeight: FontWeight.w300,
                    ),
                  ),
                ),
              ],
            ),
          ],
        ).asExpanded(),
        Wisdom.column(
          onTap: () => onClick!('no_open', inventoryId),
          children: [
            WisText.c666(
              '未开始',
              size: 14.pt,
              weight: FontWeight.w300,
            ),
            Wisdom.row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: WisText.c222('${item?.noOpenCount ?? '0'}'),
                ),
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: Text(
                    '(${item?.timeoutNoOpenCount ?? '0'})',
                    style: TextStyle(
                      color: colorScheme.red,
                      fontSize: 13.pt,
                      fontWeight: FontWeight.w300,
                    ),
                  ),
                ),
              ],
            ),
          ],
        ).asExpanded(),
        Wisdom.column(
          onTap: () => onClick!('overdue', inventoryId),
          children: [
            WisText.c666(
              '已逾期',
              size: 14.pt,
              weight: FontWeight.w300,
            ),
            Wisdom.row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Wisdom(
                  margin: EdgeInsets.only(top: 12.pt),
                  child: WisText.c222('${item?.overdueCount ?? '0'}'),
                ),
              ],
            ),
          ],
        ).asExpanded(),
      ],
    );
  }
}
