forked from shiosyakeyakini-info/miria
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d3aa4de
commit 4a93614
Showing
2 changed files
with
55 additions
and
5 deletions.
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,42 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:miria/providers.dart'; | ||
import 'package:miria/view/common/account_scope.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 ChannelHighlight extends ConsumerWidget { | ||
final String channelId; | ||
const ChannelHighlight({ | ||
super.key, | ||
required this.channelId, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final account = AccountScope.of(context); | ||
return PushableListView<Note>( | ||
initializeFuture: () async { | ||
final response = await ref | ||
.read(misskeyProvider(account)) | ||
.notes | ||
.featured(NotesFeaturedRequest(channelId: channelId)); | ||
ref.read(notesProvider(account)).registerAll(response); | ||
return response.toList(); | ||
}, | ||
nextFuture: (lastItem, _) async { | ||
final response = | ||
await ref.read(misskeyProvider(account)).notes.featured( | ||
NotesFeaturedRequest( | ||
channelId: channelId, | ||
untilId: lastItem.id, | ||
), | ||
); | ||
ref.read(notesProvider(account)).registerAll(response); | ||
return response.toList(); | ||
}, | ||
itemBuilder: (context, note) => MisskeyNote(note: note), | ||
); | ||
} | ||
} |