Skip to content

Commit

Permalink
結果がないことを表示する
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Nov 6, 2023
1 parent 050999b commit 6f5bad1
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 @@ -13,6 +13,7 @@ class PushableListView<T> extends ConsumerStatefulWidget {
final Object listKey;
final bool shrinkWrap;
final ScrollPhysics? physics;
final bool hideIsEmpty;

const PushableListView({
super.key,
Expand All @@ -23,6 +24,7 @@ class PushableListView<T> extends ConsumerStatefulWidget {
this.shrinkWrap = false,
this.physics,
this.additionalErrorInfo,
this.hideIsEmpty = false,
});

@override
Expand Down Expand Up @@ -115,6 +117,14 @@ class PushableListViewState<T> extends ConsumerState<PushableListView<T>> {
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();
}

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 @@ -69,6 +69,7 @@ class DriveFileSelectDialogState extends ConsumerState<DriveFileSelectDialog> {
PushableListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
hideIsEmpty: true,
initializeFuture: () async {
final misskey = ref.read(misskeyProvider(widget.account));
final response = await misskey.drive.folders.folders(
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 @@ -101,6 +101,7 @@ class NoteDetailPageState extends ConsumerState<NoteDetailPage> {
child: PushableListView(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
hideIsEmpty: true,
initializeFuture: () async {
final repliesResult = await ref
.read(misskeyProvider(widget.account))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class FolderSelectDialogState extends ConsumerState<FolderSelectDialog> {
PushableListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
hideIsEmpty: true,
initializeFuture: () async {
final misskey = ref.read(misskeyProvider(widget.account));
final response = await misskey.drive.folders.folders(
Expand Down

0 comments on commit 6f5bad1

Please sign in to comment.