Skip to content

Commit

Permalink
Merge pull request #280 from poppingmoon/fix-pushable-listview
Browse files Browse the repository at this point in the history
PushableListViewの読み込み件数が0のときアイコンを表示しない
  • Loading branch information
shiosyakeyakini-info authored Jul 14, 2024
2 parents 690f997 + 4a11c42 commit 8edb699
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/view/common/pushable_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class PushableListView<T> extends HookConsumerWidget {
final bool shrinkWrap;
final ScrollPhysics? physics;
final bool showAd;
final bool hideIsEmpty;

const PushableListView({
required this.initializeFuture,
Expand All @@ -29,6 +30,7 @@ class PushableListView<T> extends HookConsumerWidget {
this.physics,
this.additionalErrorInfo,
this.showAd = true,
this.hideIsEmpty = false,
});

@override
Expand Down Expand Up @@ -99,6 +101,14 @@ class PushableListView<T> extends HookConsumerWidget {
if (isFinalPage.value) {
return Container();
}
if (items.isEmpty && !widget.hideIsEmpty) {
return const Center(
child: Padding(
padding: EdgeInsets.all(10),
child: Text("なんもないで"),
),
);
}

if (ref.read(
generalSettingsRepositoryProvider
Expand Down
1 change: 1 addition & 0 deletions lib/view/note_create_page/drive_file_select_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class DriveFileSelectDialog extends HookConsumerWidget
child: Column(
children: [
PushableListView(
hideIsEmpty: true,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
showAd: false,
Expand Down
1 change: 1 addition & 0 deletions lib/view/note_detail_page/note_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class NoteDetailPage extends ConsumerWidget implements AutoRouteWrapper {
AsyncData(:final value) => ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
hideIsEmpty: true,
itemCount: value.length,
itemBuilder: (context, index) {
return MisskeyNote(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class FolderSelectDialogState extends ConsumerState<FolderSelectDialog> {
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(
Expand Down

0 comments on commit 8edb699

Please sign in to comment.