Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ページ機能の実装 #399

Merged
merged 2 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/router/app_router.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:typed_data';

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Page;
import 'package:miria/model/account.dart';
import 'package:miria/model/image_file.dart';
import 'package:miria/model/tab_setting.dart';
Expand All @@ -15,6 +15,7 @@ import 'package:miria/view/explore_page/explore_role_users_page.dart';
import 'package:miria/view/favorited_note_page/favorited_note_page.dart';
import 'package:miria/view/federation_page/federation_page.dart';
import 'package:miria/view/hashtag_page/hashtag_page.dart';
import 'package:miria/view/misskey_page_page/misskey_page_page.dart';
import 'package:miria/view/note_create_page/note_create_page.dart';
import 'package:miria/view/note_detail_page/note_detail_page.dart';
import 'package:miria/view/notes_after_renote_page/notes_after_renote_page.dart';
Expand Down Expand Up @@ -94,5 +95,7 @@ class AppRouter extends _$AppRouter {
AutoRoute(page: InstanceMuteRoute.page),
AutoRoute(page: SeveralAccountGeneralSettingsRoute.page),
AutoRoute(page: SharingAccountSelectRoute.page),
// きしょ……
AutoRoute(page: MisskeyRouteRoute.page),
];
}
54 changes: 54 additions & 0 deletions lib/router/app_router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/view/common/misskey_notes/mfm_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ class MfmTextState extends ConsumerState<MfmText> {
.show(NotesShowRequest(noteId: uri.pathSegments[1]));
if (!mounted) return;
context.pushRoute(NoteDetailRoute(account: account, note: note));
} else if (uri.pathSegments.length == 3 && uri.pathSegments[1] == "pages") {
final page = await ref.read(misskeyProvider(account)).pages.show(
PagesShowRequest(
name: uri.pathSegments[2],
username: uri.pathSegments[1].substring(1)));
if (!mounted) return;
context.pushRoute(MisskeyRouteRoute(account: account, page: page));
} else if (uri.pathSegments.length == 1 &&
uri.pathSegments.first.startsWith("@")) {
await onMentionTap(uri.pathSegments.first);
Expand Down
2 changes: 1 addition & 1 deletion lib/view/common/misskey_notes/misskey_file_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/general_settings.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/misskey_notes/image_dialog.dart';
import 'package:miria/view/common/image_dialog.dart';
import 'package:misskey_dart/misskey_dart.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down
5 changes: 4 additions & 1 deletion lib/view/explore_page/explore_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:miria/model/account.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/explore_page/explore_hashtags.dart';
import 'package:miria/view/explore_page/explore_highlight.dart';
import 'package:miria/view/explore_page/explore_pages.dart';
import 'package:miria/view/explore_page/explore_role.dart';
import 'package:miria/view/explore_page/explore_server.dart';
import 'package:miria/view/explore_page/explore_users.dart';
Expand All @@ -28,7 +29,7 @@ class ExplorePageState extends ConsumerState<ExplorePage> {
return AccountScope(
account: widget.account,
child: DefaultTabController(
length: 5,
length: 6,
child: Scaffold(
appBar: AppBar(
title: const Text("みつける"),
Expand All @@ -38,6 +39,7 @@ class ExplorePageState extends ConsumerState<ExplorePage> {
Tab(text: "ハイライト"),
Tab(text: "ユーザー"),
Tab(text: "ロール"),
Tab(text: "ページ"),
Tab(text: "ハッシュタグ"),
Tab(text: "よそのサーバー"),
],
Expand All @@ -48,6 +50,7 @@ class ExplorePageState extends ConsumerState<ExplorePage> {
ExploreHighlight(),
ExploreUsers(),
ExploreRole(),
ExplorePages(),
ExploreHashtags(),
ExploreServer(),
],
Expand Down
42 changes: 42 additions & 0 deletions lib/view/explore_page/explore_pages.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mfm_renderer/mfm_renderer.dart';
import 'package:miria/providers.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/futable_list_builder.dart';
import 'package:miria/view/common/misskey_notes/mfm_text.dart';

class ExplorePages extends ConsumerStatefulWidget {
const ExplorePages({super.key});

@override
ConsumerState<ConsumerStatefulWidget> createState() => ExplorePagesState();
}

class ExplorePagesState extends ConsumerState<ExplorePages> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: FutureListView(future: () async {
final result = await ref
.read(misskeyProvider(AccountScope.of(context)))
.pages
.featured();
return result.toList();
}(), builder: (context, item) {
return ListTile(
onTap: () {
context.pushRoute(
MisskeyRouteRoute(account: AccountScope.of(context), page: item),
);
},
title: MfmText(mfmText: item.title),
subtitle: MfmText(mfmText: item.summary ?? ""),
);
}),
);
}
}
Loading
Loading