/*
 * @Author: ChenYaJin
 * @Date: 2023-10-20 16:16:12
 * @LastEditors: wuwei
 * @LastEditTime: 2023-12-18 14:30:24
 * @Description: 
 */
part of '../index.dart';

class _StatisticComponent extends StatelessWidget {
  const _StatisticComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final _Store store = Provider.of<_Store>(context);
    return Listener(
      onPointerUp: (e) => store.onSetExpand(false),
      child: Wisdom.column(
        margin: EdgeInsets.only(top: 10.pt),
        children: [
          Wisdom.row(
            margin: EdgeInsets.symmetric(horizontal: 15.pt),
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              for (var i = 0; i < store.treeSelectionList.length; i++) ...[
                Opacity(
                  opacity: store.currentTreeSelection ==
                          store.treeSelectionList[i]['code']
                      ? 1
                      : 0.5,
                  child: Wisdom.column(
                    onTap: () => store.onTreeSelectionChange(
                        store.treeSelectionList[i]['code']),
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    borderRadius: BorderRadius.circular(8.pt),
                    // height: 94.pt,
                    padding: EdgeInsets.symmetric(
                      horizontal: 10.pt,
                      vertical: 10.pt,
                    ),
                    color: Colors.white,
                    children: [
                      Image.asset(
                        '${store.treeSelectionList[i]['icon']}',
                        package: 'bill_package',
                        width: 20.pt,
                        height: 20.pt,
                      ),
                      SizedBox(height: 5.pt),
                      WisText(
                        '${store.treeSelectionList[i]['name']}',
                        size: 14.pt,
                        weight: FontWeight.w500,
                      ),
                    ],
                  ),
                ),
              ],
            ],
          ),
        ],
      ),
    );
  }
}
