/*
 * @Author: WuWei
 * @Date: 2020-08-10 11:52:33
 * @LastEditors: wjc
 * @LastEditTime: 2023-03-29 17:26:29
 * @Description:
 */
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

class ListItem extends StatelessWidget {
  const ListItem({Key? key, this.item, this.isLast, this.toDetail})
      : super(key: key);
  final item;
  final isLast;
  final Function? toDetail;

  @override
  Widget build(BuildContext context) {
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;

    return WisCard(
      margin: EdgeInsets.only(left: 15.pt, right: 15.pt, top: 10.pt),
      child: Wisdom.column(
        onTap: () => toDetail!(),
        padding: EdgeInsets.all(15.pt),
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Wisdom.row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Wisdom.row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  WTag(
                    plain: true,
                    color: item?.payWay == '线下'
                        ? Color(0xff00C78C)
                        : item?.payWay == '线上'
                            ? colorScheme.primary
                            : colorScheme.grey,
                    backgroundColor: item?.payWay == '线下'
                        ? Color(0xffeaf7e9)
                        : item?.payWay == '线上'
                            ? Color(0xffEAF3FD)
                            : colorScheme.background,
                    child: Text(item?.payWay ?? '--'),
                  ),
                  WisText(
                    item?.assetName ?? '--',
                    color: colorScheme.primary,
                    size: 16.pt,
                    weight: FontWeight.w300,
                    overflow: TextOverflow.ellipsis,
                  ).asExpanded(),
                ],
              ).asExpanded(),
              WisText(
                '￥${item?.payFee ?? '0'}',
                color: colorScheme.danger,
                weight: FontWeight.w300,
                size: 16.pt,
              )
            ],
          ),
          Wisdom.row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.center,
            margin: EdgeInsets.only(top: 10.pt),
            children: <Widget>[
              WisText(
                '缴费人：${item?.payer ?? '--'}',
                color: colorScheme.minor,
                size: 14.pt,
                weight: FontWeight.w300,
                overflow: TextOverflow.ellipsis,
              ).asExpanded(),
              WisText(
                '${item?.payAt ?? '--'}',
                color: colorScheme.minor,
                size: 14.pt,
                weight: FontWeight.w300,
              )
            ],
          ),
        ],
      ),
    );
  }
}
