diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d94792..88574e0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 更新隐藏区域卡片上的按钮样式,更明显。 - 如果帖子的评分消息中评分理由为空,不显示评分理由。 - 登录后,加载首页的时机推迟到访问首页时,而不是登录后直接加载。 +- 帖子已经加载完时不再显示toast,而是显示snack bar。 ## [0.3.0] - 2023-12-30 diff --git a/lib/features/forum/view/forum_page.dart b/lib/features/forum/view/forum_page.dart index baca3f42..2843c7b7 100644 --- a/lib/features/forum/view/forum_page.dart +++ b/lib/features/forum/view/forum_page.dart @@ -110,7 +110,7 @@ class _ForumPageState extends State if (state.currentPage >= state.totalPages) { debug('already in last page'); _refreshController.finishLoad(IndicatorResult.noMore); - await showNoMoreToast(context); + await showNoMoreSnackBar(context); return; } // Load the next page. diff --git a/lib/features/thread/widgets/post_list.dart b/lib/features/thread/widgets/post_list.dart index aabd32bb..43f7aca8 100644 --- a/lib/features/thread/widgets/post_list.dart +++ b/lib/features/thread/widgets/post_list.dart @@ -168,7 +168,7 @@ class _PostListState extends State { return; } if (!widget.canLoadMore) { - await showNoMoreToast(context); + await showNoMoreSnackBar(context); _refreshController.finishLoad(); return; } diff --git a/lib/utils/show_toast.dart b/lib/utils/show_toast.dart index a82ee603..c6b8efd6 100644 --- a/lib/utils/show_toast.dart +++ b/lib/utils/show_toast.dart @@ -1,20 +1,8 @@ -import 'package:flutter/cupertino.dart'; -import 'package:toastification/toastification.dart'; +import 'package:flutter/material.dart'; import 'package:tsdm_client/generated/i18n/strings.g.dart'; -Future showRetryToast(BuildContext context) async { - toastification.show( - context: context, - title: context.t.general.loadFailedAndRetry, - autoCloseDuration: const Duration(seconds: 3), - ); - await Future.wait([Future.delayed(const Duration(milliseconds: 400), () {})]); -} - -Future showNoMoreToast(BuildContext context) async { - toastification.show( - context: context, - title: context.t.general.noMoreData, - autoCloseDuration: const Duration(seconds: 3), - ); +Future showNoMoreSnackBar(BuildContext context) async { + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text(context.t.general.noMoreData), + )); } diff --git a/pubspec.lock b/pubspec.lock index 8d367648..f49d7cc3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -494,14 +494,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.2" - iconsax_flutter: - dependency: transitive - description: - name: iconsax_flutter - sha256: "95b65699da8ea98f87c5d232f06b0debaaf1ec1332b697e4d90969ec9a93037d" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.0" image: dependency: transitive description: @@ -710,14 +702,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" - pausable_timer: - dependency: transitive - description: - name: pausable_timer - sha256: "35b1f77eb2fb0f42e823360321fbed9b9a8b1c7043a07a58aeda17d01f84659a" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0+1" permission_handler: dependency: "direct main" description: @@ -987,14 +971,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" - toastification: - dependency: "direct main" - description: - name: toastification - sha256: "14e7f9178db0393df00509cd921de3d3db310d06c7c122e873f31d3c8d18cf4e" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.0" typed_data: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3e422788..7485a6dc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,7 +48,6 @@ dependencies: slang_flutter: ^3.28.0 stream_transform: ^2.1.0 surf_lint_rules: ^3.0.0 - toastification: ^1.1.0 universal_html: ^2.2.4 url_launcher: ^6.2.3 uuid: ^4.3.3