Skip to content

Commit

Permalink
Merge pull request #613 from poppingmoon/page-content-nullable
Browse files Browse the repository at this point in the history
一部のページが開けない問題を修正
  • Loading branch information
shiosyakeyakini-info authored Oct 14, 2024
2 parents 366d2d2 + d2bbe37 commit 5b5869c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/view/misskey_page_page/misskey_page_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class PageContent extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final content = this.content;
if (content is misskey.PageText) {
if (content case misskey.PageText(:final text?)) {
final account = AccountScope.of(context);
final nodes = const MfmParser().parse(content.text);
final nodes = const MfmParser().parse(text);
return Column(
children: [
MfmText(
Expand All @@ -143,12 +143,11 @@ class PageContent extends ConsumerWidget {
],
);
}
if (content is misskey.PageImage) {
final url = page.attachedFiles
.firstWhereOrNull((e) => e.id == content.fileId)
?.url;
if (content case misskey.PageImage(:final fileId?)) {
final url =
page.attachedFiles.firstWhereOrNull((e) => e.id == fileId)?.url;
final thumbnailUrl = page.attachedFiles
.firstWhereOrNull((e) => e.id == content.fileId)
.firstWhereOrNull((e) => e.id == fileId)
?.thumbnailUrl;
if (url != null) {
return GestureDetector(
Expand All @@ -162,14 +161,14 @@ class PageContent extends ConsumerWidget {
return const SizedBox.shrink();
}
}
if (content is misskey.PageNote) {
if (content case misskey.PageNote(note: final noteId?)) {
return FutureBuilder(
future: (() async {
final account = AccountScope.of(context);
final note = await ref
.read(misskeyProvider(account))
.notes
.show(misskey.NotesShowRequest(noteId: content.note));
.show(misskey.NotesShowRequest(noteId: noteId));
ref.read(notesProvider(account)).registerNote(note);
return note;
})(),
Expand Down

0 comments on commit 5b5869c

Please sign in to comment.