/*
 * @Author: WuWei
 * @Date: 2020-06-19 10:30:37
 * @LastEditors  : WuWei
 * @LastEditTime : 2021-05-28 17:51:24
 * @Description: 计划任务详情-文件
 */

part of '../index.dart';

class _FileItem extends StatelessWidget {
  const _FileItem({Key? key, this.itemData}) : super(key: key);

  final itemData;

  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PlanTaskDetailStore>(context);
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;
    final String baseUrl = APPConfig.baseURL;
    return Wisdom.row(
      margin: EdgeInsets.only(bottom: 5.pt),
      onTap: () => {
        if (itemData.type == 'file')
          {
            store.route2perview(
              baseUrl + 'file/download/' + itemData.fileId,
              itemData?.fileName,
            ),
          }
        else
          {
            store.onShowImage(itemData.fileId),
          }
      },
      children: <Widget>[
        WisText(
          itemData?.fileName,
          size: 14.pt,
          maxLines: 1,
          color: colorScheme.primary,
          overflow: TextOverflow.ellipsis,
        ).asExpanded(),
      ],
    );
  }
}
