From 1c19d11095f0aa0d78785ddc707c647d5ff225dc Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:31:12 +0900 Subject: [PATCH 1/2] =?UTF-8?q?PushableListView=E3=81=AE=E8=AA=AD=E3=81=BF?= =?UTF-8?q?=E8=BE=BC=E3=81=BF=E4=BB=B6=E6=95=B0=E3=81=8C0=E3=81=AE?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/common/pushable_listview.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/view/common/pushable_listview.dart b/lib/view/common/pushable_listview.dart index 9a5b278db..a48e53f85 100644 --- a/lib/view/common/pushable_listview.dart +++ b/lib/view/common/pushable_listview.dart @@ -45,11 +45,13 @@ class PushableListViewState extends ConsumerState> { isLoading = true; Future(() async { try { + final result = await widget.initializeFuture(); items ..clear() - ..addAll(await widget.initializeFuture()); + ..addAll(result); if (!mounted) return; setState(() { + isFinalPage = result.isEmpty; isLoading = false; }); scrollController.animateTo(-scrollController.position.pixels, @@ -96,10 +98,10 @@ class PushableListViewState extends ConsumerState> { isLoading = true; }); final result = await widget.nextFuture(items.last, items.length); - if (result.isEmpty) isFinalPage = true; items.addAll(result); if (!mounted) return; setState(() { + isFinalPage = result.isEmpty; isLoading = false; }); } catch (e) { From 117c934f55fb8c890abbbfbb31439248bf9e46f9 Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:51:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E7=B5=90=E6=9E=9C=E3=81=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=93=E3=81=A8=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/common/pushable_listview.dart | 10 ++++++++++ .../note_create_page/drive_file_select_dialog.dart | 1 + lib/view/note_detail_page/note_detail_page.dart | 1 + .../import_export_page/folder_select_dialog.dart | 1 + 4 files changed, 13 insertions(+) diff --git a/lib/view/common/pushable_listview.dart b/lib/view/common/pushable_listview.dart index a48e53f85..b51eedea1 100644 --- a/lib/view/common/pushable_listview.dart +++ b/lib/view/common/pushable_listview.dart @@ -15,6 +15,7 @@ class PushableListView extends ConsumerStatefulWidget { final bool shrinkWrap; final ScrollPhysics? physics; final bool showAd; + final bool hideIsEmpty; const PushableListView({ super.key, @@ -26,6 +27,7 @@ class PushableListView extends ConsumerStatefulWidget { this.physics, this.additionalErrorInfo, this.showAd = true, + this.hideIsEmpty = false, }); @override @@ -125,6 +127,14 @@ class PushableListViewState extends ConsumerState> { itemBuilder: (context, index) { if (items.length == index) { if (isFinalPage) { + if (items.isEmpty && !widget.hideIsEmpty) { + return const Center( + child: Padding( + padding: EdgeInsets.all(10), + child: Text("ありません"), + ), + ); + } return Container(); } diff --git a/lib/view/note_create_page/drive_file_select_dialog.dart b/lib/view/note_create_page/drive_file_select_dialog.dart index b035c1073..058bf6c35 100644 --- a/lib/view/note_create_page/drive_file_select_dialog.dart +++ b/lib/view/note_create_page/drive_file_select_dialog.dart @@ -70,6 +70,7 @@ class DriveFileSelectDialogState extends ConsumerState { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), showAd: false, + hideIsEmpty: true, initializeFuture: () async { final misskey = ref.read(misskeyProvider(widget.account)); final response = await misskey.drive.folders.folders( diff --git a/lib/view/note_detail_page/note_detail_page.dart b/lib/view/note_detail_page/note_detail_page.dart index dd54266fa..44b2218d1 100644 --- a/lib/view/note_detail_page/note_detail_page.dart +++ b/lib/view/note_detail_page/note_detail_page.dart @@ -102,6 +102,7 @@ class NoteDetailPageState extends ConsumerState { child: PushableListView( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, + hideIsEmpty: true, initializeFuture: () async { final repliesResult = await ref .read(misskeyProvider(widget.account)) diff --git a/lib/view/settings_page/import_export_page/folder_select_dialog.dart b/lib/view/settings_page/import_export_page/folder_select_dialog.dart index 231481ada..4bf7e0de6 100644 --- a/lib/view/settings_page/import_export_page/folder_select_dialog.dart +++ b/lib/view/settings_page/import_export_page/folder_select_dialog.dart @@ -64,6 +64,7 @@ class FolderSelectDialogState extends ConsumerState { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), showAd: false, + hideIsEmpty: true, initializeFuture: () async { final misskey = ref.read(misskeyProvider(widget.account)); final response = await misskey.drive.folders.folders(