Browse Source

[Fix]聊天列表load more失效

zhipeng 1 year ago
parent
commit
caba222bb4
1 changed files with 15 additions and 14 deletions
  1. 15 14
      lib/module/chat/view.dart

+ 15 - 14
lib/module/chat/view.dart

@@ -75,7 +75,14 @@ class ChatPage extends BasePage<ChatController> {
             child: Container(
           padding: EdgeInsets.symmetric(horizontal: 12.w),
           child: Obx(() {
-            return SmartRefresher(
+            return NotificationListener<ScrollNotification>(
+              onNotification: (scrollNotification) {
+                if (scrollNotification is ScrollStartNotification) {
+                  FocusScope.of(context).unfocus();
+                }
+                return false;
+              },
+              child: SmartRefresher(
                 controller: controller.refreshController,
                 footer: CustomFooter(
                   loadStyle: LoadStyle.ShowWhenLoading,
@@ -99,19 +106,13 @@ class ChatPage extends BasePage<ChatController> {
                 enablePullUp: true,
                 onLoading: controller.loadMoreHistory,
                 onRefresh: controller.loadMoreHistory,
-                child: NotificationListener<ScrollNotification>(
-                  onNotification: (scrollNotification) {
-                    if (scrollNotification is ScrollStartNotification) {
-                      FocusScope.of(context).unfocus();
-                    }
-                    return false;
-                  },
-                  child: ListView.builder(
-                      reverse: true,
-                      controller: controller.listScrollController,
-                      itemBuilder: _chatItemBuilder,
-                      itemCount: controller.chatItems.length),
-                ));
+                child: ListView.builder(
+                    reverse: true,
+                    controller: controller.listScrollController,
+                    itemBuilder: _chatItemBuilder,
+                    itemCount: controller.chatItems.length),
+              ),
+            );
           }),
         )),
         Container(