/*
 * @Author       : WuWei
 * @LastEditors: wuwei
 * @Date         : 2021-05-14 11:53:35
 * @LastEditTime: 2023-12-21 10:47:53
 * @FilePath: /wisdom-huiguanjia-app/task_package/lib/src/pages/detail/components/info.dart
 * @Description  : 任务详情-任务人员信息
 */
part of '../index.dart';

///详情模块
class _BuildInfo extends StatelessWidget {
  const _BuildInfo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivateTaskDetailStore>(context, listen: true);
    final data = store.data;

    return SliverToBoxAdapter(
      child: Wisdom.column(
        color: Colors.white,
        padding: EdgeInsets.symmetric(horizontal: 15.pt),
        margin: EdgeInsets.only(bottom: 5.pt, right: 15.pt, left: 15.pt),
        borderRadius: BorderRadius.circular(10.pt),
        boxShadow: [
          BoxShadow(
            offset: Offset(0, 2.pt),
            color: Color(0x08000000),
            blurRadius: 10.pt,
            spreadRadius: 2.5.pt,
          ),
        ],
        children: [
          Wisdom.row(
            onTap: () => store.callCreater(),
            padding: EdgeInsets.only(top: 15.pt, bottom: 5.pt),
            children: <Widget>[
              WisText(
                '执行人',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              Wisdom.row(
                children: <Widget>[
                  WisText(
                    data?.operator ?? '--',
                    color: Color(0xFF9FA5B7),
                    size: 14.pt,
                  ),
                ],
              ),
            ],
          ),
          Wisdom.row(
            padding: EdgeInsets.symmetric(vertical: 5.pt),
            children: <Widget>[
              WisText(
                '添加人',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              Wisdom.row(
                children: <Widget>[
                  WisText(
                    data?.createdBy ?? '--',
                    color: Color(0xFF9FA5B7),
                    size: 14.pt,
                  ),
                ],
              ),
            ],
          ),
          Wisdom.row(
            padding: EdgeInsets.symmetric(vertical: 5.pt),
            children: <Widget>[
              WisText(
                '发布时间',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              WisText(
                data?.createdAt ?? '--',
                color: Color(0xFF9FA5B7),
                size: 14.pt,
              ),
            ],
          ),
          Wisdom.row(
            padding: EdgeInsets.symmetric(vertical: 5.pt),
            children: <Widget>[
              WisText(
                '更新时间',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              WisText(
                data?.updatedAt ?? '--',
                color: Color(0xFF9FA5B7),
                size: 14.pt,
              ),
            ],
          ),
          Wisdom.row(
            padding: EdgeInsets.symmetric(vertical: 5.pt),
            children: <Widget>[
              WisText(
                '监督人',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              WisText(
                data?.supervisorName ?? '--',
                color: Color(0xFF9FA5B7),
                size: 14.pt,
              ),
            ],
          ),
          Wisdom.row(
            padding: EdgeInsets.symmetric(vertical: 5.pt),
            children: <Widget>[
              WisText(
                '抄送人',
                size: 14.pt,
                color: Color(0xFF616178),
              ).asExpanded(),
              WisText(
                data?.mailFrom != null && data?.mailFrom != ''
                    ? data?.mailFrom ?? '--'
                    : '--',
                color: Color(0xFF9FA5B7),
                size: 14.pt,
              ),
            ],
          ),
          /// 去除类型限制 2023.12.21 预设类型才有标签
          if (data?.preset == true) ...[
            Wisdom.row(
              padding: EdgeInsets.only(top: 5.pt, bottom: 15.pt),
              children: <Widget>[
                Wisdom(
                  margin: EdgeInsets.only(right: 10.pt),
                  child: WisText(
                    '标签',
                    size: 14.pt,
                    color: Color(0xFF616178),
                  ),
                ),
                WisText(
                  store.labelName == '' ? '--' : store.labelName,
                  textAlign: TextAlign.end,
                  color: Color(0xFF9FA5B7),
                  size: 14.pt,
                ).asExpanded(),
              ],
            ),
          ]
        ],
      ),
    );
  }
}
