/*
 * @Author: XianKaiQun
 * @Date: 2020-08-03 14:48:33
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-12 09:33:07
 * @Description: 
 */
part of '../index.dart';

///记录列表
class _RecordListComponent extends StatelessWidget {
  const _RecordListComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivateRepairDetailStore>(context);
//final style = WTheme.of(context);final colorScheme = style.colorScheme;
//final theme = Theme.of(context);
//final textTheme = theme.textTheme;
    final list = store.data?.opreateRecordsInfo ?? [];
    return WisSliverList.childBuilder(
      padding: EdgeInsets.all(15.pt),
      childCount: list.length,
      builder: (_, i) {
        final item = list[i];
        return WisCard(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.vertical(
              top: Radius.circular(i == 0 ? 5.pt : 0),
              bottom: Radius.circular(i == list.length - 1 ? 5.pt : 0),
            ),
          ),
          child: WisCell(
            onTap: ['equipment_add', 'equipment_scrap'].indexOf(item.type!) == -1
                ? () => store.route2detailItem(item.id)
                : null,
            padding: EdgeInsets.all(10.pt),
            bottomDivider: i == list.length - 1
                ? WisCellDivider.none
                : WisCellDivider.fill,
            title: Text('${item.typeName}'),
            subtitle: Text('${item.createdAt}'),
            trailing:
                ['equipment_add', 'equipment_scrap'].indexOf(item.type!) == -1
                    ? Row(
                        children: <Widget>[
                          Text('详情'),
                          Icon(Icons.chevron_right),
                        ],
                      )
                    : null,
          ),
        );
      },
    );
  }
}
