-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:hooks_riverpod/hooks_riverpod.dart"; | ||
import "package:miria/providers.dart"; | ||
import "package:miria/view/common/misskey_notes/misskey_note.dart"; | ||
import "package:miria/view/common/pushable_listview.dart"; | ||
import "package:misskey_dart/misskey_dart.dart"; | ||
|
||
class ChannelNoteHighlight extends ConsumerWidget { | ||
final String channelId; | ||
const ChannelNoteHighlight({ | ||
required this.channelId, | ||
super.key, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
return PushableListView( | ||
initializeFuture: () async { | ||
final response = await ref | ||
.read(misskeyGetContextProvider) | ||
.notes | ||
.featured(NotesFeaturedRequest(channelId: channelId)); | ||
|
||
ref.read(notesWithProvider).registerAll(response); | ||
return response.toList(); | ||
}, | ||
nextFuture: (item, index) async { | ||
final response = | ||
await ref.read(misskeyGetContextProvider).notes.featured( | ||
NotesFeaturedRequest( | ||
offset: index, | ||
untilId: item.id, | ||
channelId: channelId, | ||
), | ||
); | ||
|
||
ref.read(notesWithProvider).registerAll(response); | ||
return response.toList(); | ||
}, | ||
itemBuilder: (context, item) => MisskeyNote(note: item), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters