/*
 * @Author       : WuWei
 * @LastEditors: ChenYaJin
 * @Date         : 2021-11-09 09:53:10
 * @LastEditTime: 2023-11-02 17:39:45
 * @Description  : Do not edit
 */
part of '../index.dart';

class _BuildPreList extends StatelessWidget {
  const _BuildPreList({Key? key}) : super(key: key);

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

    /// 预存款缴费
    return Column(
      children: [
        WSearch(
          hintText: '请输入资产名称搜索',
          onSubmitted: (value) => store.toPreSearchList(value),
          onCancel: () => store.toPreSearchList(''),
          moonlight: false,
          padding:
              EdgeInsets.only(top: 10.pt, bottom: list.length > 0 ? 0 : 10.pt),
          isDark: false,
          initValue: store.preSearchWord,
        ),
        WisScrollView(
          key: store.indexScrollViewKey1,
          onRefresh: () => store.getPreList(isLoad: false),
          onInit: () => store.getPreList(isLoad: false),
          onLoad: () => store.getPreList(isLoad: true),
          slivers: <Widget>[
            WisSliverList.childBuilder(
                childCount: list.length,
                builder: (_, i) {
                  var item = list[i];
                  return ListItem(
                    toDetail: () => store.routeToDetail(item),
                    item: item,
                    isLast: i == (store.paylist1.length - 1) ? true : false,
                  );
                }),
          ],
        ).asExpanded(),
      ],
    );
  }
}
