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

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

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

class __ToOtherTaskListState extends State<_ToOtherTaskList> {
  @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 == 6) {
                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.taskOtherList)
                            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),
                        ],
                      );
                    }),
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
