/*
 * @Author: XianKaiQun
 * @Date: 2020-04-22 14:39:09
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-04-04 15:30:18
 * @Descripttion: 
 */
part of '../index.dart';

///列表
class _ListComponent extends StatelessWidget {
  const _ListComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<_Store>(context);
    final colorScheme = WTheme.of(context).colorScheme;
    return WisSliverList.childBuilder(
      childCount: store.list.length,
      interval: 10.pt,
      padding: EdgeInsets.all(15.pt),
      builder: (_, i) {
        var item = store.list[i];
        return WisCard(
          child: InkWell(
            onTap: () => store.route2detail(item),
            child: Material(
              child: Wisdom.column(
                color: Colors.white,
                padding: EdgeInsets.all(15.pt),
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Wisdom.row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    padding: EdgeInsets.only(bottom: 15.pt),
                    children: <Widget>[
                      Row(children: [
                        Image.asset(
                          'lib/assets/icon_jiudian.png',
                          package: 'bill_package',
                          width: 22.pt,
                        ),
                        SizedBox(
                          width: 5.pt,
                        ),
                        WisText(
                          item.assetFullName ?? '',
                          size: 16.pt,
                          bold: true,
                          color: colorScheme.mainTitle,
                          overflow: TextOverflow.ellipsis,
                        ).asExpanded(),
                      ]).asFlexible(flex: 1),
                      Row(
                        children: [
                          WisText(
                            '缴费明细',
                            size: 13.pt,
                            color: colorScheme.minor,
                          ),
                          Icon(
                            Icons.chevron_right,
                            color: colorScheme.grey,
                          ),
                        ],
                      )
                    ],
                  ),
                  Wisdom.row(
                    color: colorScheme.background,
                    padding: EdgeInsets.all(15.pt),
                    borderRadius: BorderRadius.circular(8.pt),
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          WisText('欠费金额', size: 12.pt, color: colorScheme.grey),
                          WisText(
                            '￥${item.arrearsFee ?? 0}',
                            size: 21.pt,
                            color: colorScheme.red,
                            bold: true,
                          ),
                        ],
                      ).asFlexible(flex: 1),
                      Row(
                        children: [
                          Wisdom.column(
                            onTap: () => store.route2ReciptDetail(item),
                            children: <Widget>[
                              Image.asset(
                                'lib/assets/shd.png',
                                height: 19.pt,
                                package: 'bill_package',
                              ),
                              SizedBox(height: 5.pt),
                              WisText(
                                '收单',
                                size: 13.pt,
                                color: colorScheme.primary,
                              ),
                            ],
                          ),
                          Container(
                            height: 36.pt,
                            width: 0.5.pt,
                            margin: EdgeInsets.symmetric(horizontal: 15.pt),
                            color: colorScheme.divider,
                          ),
                          Wisdom.column(
                            onTap: () => QrcodeModalComponent.show(
                              context,
                              arrearsFeeTotal:
                                  item.arrearsFee?.toString() ?? '',
                              houseName: item.assetFullName ?? '',
                              communityId: store.currentCommunity?.id,
                              houseId: item.houseId,
                            ),
                            children: [
                              Image.asset(
                                'lib/assets/ewma.png',
                                height: 19.pt,
                                package: 'bill_package',
                              ),
                              SizedBox(height: 5.pt),
                              WisText(
                                '缴费',
                                size: 13.pt,
                                color: colorScheme.primary,
                              ),
                            ],
                          ),
                        ],
                      )
                    ],
                  ),
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}
