🐛 Bug fixes on realm missing post editor

This commit is contained in:
LittleSheep 2024-05-07 13:06:26 +08:00
parent 0c87bbbce1
commit b3e266d564
3 changed files with 13 additions and 3 deletions

View File

@ -115,6 +115,14 @@ abstract class SolianRouter {
name: 'realms.member', name: 'realms.member',
builder: (context, state) => RealmMemberScreen(realm: state.extra as Realm), builder: (context, state) => RealmMemberScreen(realm: state.extra as Realm),
), ),
GoRoute(
path: '/realms/:realm/posts/publish/moments',
name: 'realms.posts.moments.editor',
builder: (context, state) => MomentEditorScreen(
editing: state.extra as Post?,
realm: state.pathParameters['realm']
),
),
GoRoute( GoRoute(
path: '/realms/:realm/posts/:dataset/:alias', path: '/realms/:realm/posts/:dataset/:alias',
name: 'realms.posts.details', name: 'realms.posts.details',

View File

@ -91,8 +91,8 @@ class _ExplorePostWidgetState extends State<ExplorePostWidget> {
child: const Icon(Icons.edit), child: const Icon(Icons.edit),
onPressed: () async { onPressed: () async {
final did = await SolianRouter.router.pushNamed( final did = await SolianRouter.router.pushNamed(
'posts.moments.editor', widget.realm == null ? 'posts.moments.editor' : 'realms.posts.moments.editor',
queryParameters: {'realm': widget.realm}, pathParameters: widget.realm == null ? {} : {'realm': widget.realm!},
); );
if (did == true) _pagingController.refresh(); if (did == true) _pagingController.refresh();
}, },

View File

@ -16,8 +16,9 @@ import 'package:solian/widgets/posts/attachment_editor.dart';
class MomentEditorScreen extends StatefulWidget { class MomentEditorScreen extends StatefulWidget {
final Post? editing; final Post? editing;
final String? realm;
const MomentEditorScreen({super.key, this.editing}); const MomentEditorScreen({super.key, this.editing, this.realm});
@override @override
State<MomentEditorScreen> createState() => _MomentEditorScreenState(); State<MomentEditorScreen> createState() => _MomentEditorScreenState();
@ -61,6 +62,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
'alias': _alias, 'alias': _alias,
'content': _textController.value.text, 'content': _textController.value.text,
'attachments': _attachments, 'attachments': _attachments,
'realm': widget.realm,
}); });
var res = await Response.fromStream(await auth.client!.send(req)); var res = await Response.fromStream(await auth.client!.send(req));