/*
 * @Author: ChenYaJin
 * @Date: 2023-04-12 10:21:49
 * @LastEditors: ChenYaJin
 * @LastEditTime: 2023-04-25 16:44:23
 * @Description: 任务状态统计数
 */
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';
import 'package:task_package/src/view_models/work_statistic_store.dart';

class BuildTotalStatistic extends GetView<WorkStatisticStore> {
  @override
  Widget build(BuildContext context) {
    final WorkStatisticStore store = Get.find<WorkStatisticStore>();
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;

    return WisCard(
      elevation: 0,
      margin: EdgeInsets.symmetric(vertical: 10.pt, horizontal: 15.pt),
      child: Obx(
        () => Wisdom(
          height: 150,
          child: GridView.count(
            crossAxisCount: 3,
            childAspectRatio: 1 / 0.6,
            children: [
              for (var item in controller.statisticList)
                GestureDetector(
                  onTap: () => store.onToTaskList(item['code'] as String),
                  child: Container(
                    alignment: Alignment.center,
                    padding: EdgeInsets.only(top: 15.pt),
                    // height: 70.pt,
                    child: Wisdom.column(
                      children: [
                        Wisdom(
                          child: Text(
                            item['total'].toString(),
                            style: TextStyle(
                              fontSize: 18.pt,
                              fontWeight: FontWeight.w500,
                              color: controller.isFilterStatus
                                  ? colorScheme.primary
                                  : colorScheme.mainTitle,
                            ),
                          ),
                        ),
                        Wisdom(
                          margin: EdgeInsets.only(top: 5.pt),
                          child: Text(
                            item['name'] as String,
                            style: TextStyle(
                              fontSize: 14.pt,
                              // color: colorScheme.mainTitle,
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
