/*
 * @Author       : WuWei
 * @LastEditors: wjc
 * @Date         : 2021-10-15 14:51:40
 * @LastEditTime: 2022-12-02 11:09:57
 * @Description  : 任务列表--我转派的
 */
part of '../index.dart';

class _TransferTaskList extends StatefulWidget {
  _TransferTaskList({Key? key}) : super(key: key);

  @override
  __TransferTaskListState createState() => __TransferTaskListState();
}

class __TransferTaskListState extends State<_TransferTaskList> {
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<IndexStore>(context);
    return SafeArea(
      top: false,
      bottom: false,
      child: Builder(
        builder: (BuildContext context) {
          return NotificationListener<ScrollNotification>(
            onNotification: (ScrollNotification scrollInfo) {
              if (store.tabIndex == 4) {
                store.handleScrollEvent(scrollInfo);
              }
              return true;
            },
            child: CustomScrollView(
              slivers: <Widget>[
                SliverPadding(
                  padding: const EdgeInsets.all(15.0),
                  sliver: SliverToBoxAdapter(
                    child: Observer(builder: (_) {
                      return Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          for (var item in store.taskTransferList)
                            Column(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                TaskItem(
                                  onClick: (item) =>
                                      store.toTaskDetail(item.id, item.isChild),
                                  item: item,
                                  isMine: true,
                                ),
                                SizedBox(height: 10.pt),
                              ],
                            ),
                          if (store.isLast == true && store.isEmpty == false) ...[
                            LastText(),
                          ],
                          if (store.isEmpty == true) ...[
                            WEmptyWidget(text: WisText('暂无数据'))
                          ],
                          SizedBox(height: 34.pt),
                        ],
                      );
                    }),
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
