TF-2362 Automatically detect that the screen is not fully filled to load more emails

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 73c36be3a5c972c2da1a04d09e3eb493e0732f6e)
This commit is contained in:
dab246
2024-01-19 13:37:52 +07:00
committed by Dat H. Pham
parent c53ffd4a15
commit 26843f18f8
3 changed files with 69 additions and 15 deletions
@@ -423,19 +423,11 @@ class ThreadView extends GetWidget<ThreadController>
scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent &&
!controller.loadingMoreStatus.value.isRunning
) {
_handleLoadMoreEmailsRequest();
controller.handleLoadMoreEmailsRequest();
}
return false;
}
void _handleLoadMoreEmailsRequest() {
if (controller.isSearchActive) {
controller.searchMoreEmails();
} else {
controller.loadMoreEmails();
}
}
Widget _buildLoadMoreButton(BuildContext context, LoadingMoreStatus loadingMoreStatus) {
if (((controller.canLoadMore && !controller.isSearchActive) ||
(controller.canSearchMore && controller.isSearchActive)) &&
@@ -445,7 +437,7 @@ class ThreadView extends GetWidget<ThreadController>
style: OutlinedButton.styleFrom(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
),
onPressed: _handleLoadMoreEmailsRequest,
onPressed: controller.handleLoadMoreEmailsRequest,
child: Text(
AppLocalizations.of(context).loadMore,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(