Able to post article

This commit is contained in:
LittleSheep 2024-07-30 16:53:13 +08:00
parent fc77c8693f
commit bb77b74356
3 changed files with 27 additions and 3 deletions

View File

@ -83,6 +83,7 @@ abstract class AppRouter {
reply: arguments?.reply,
repost: arguments?.repost,
realm: arguments?.realm,
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
);
},
),

View File

@ -136,11 +136,25 @@ class PostCreatePopup extends StatelessWidget {
final List<dynamic> actionList = [
(
icon: const Icon(Icons.edit_square),
icon: const Icon(Icons.post_add),
label: 'postEditorModeStory'.tr,
onTap: () {
Navigator.pop(context);
AppRouter.instance.pushNamed('postEditor').then((val) {
AppRouter.instance.pushNamed('postEditor', queryParameters: {
'mode': 0.toString(),
}).then((val) {
if (val != null && onCreated != null) onCreated!();
});
},
),
(
icon: const Icon(Icons.description),
label: 'postEditorModeArticle'.tr,
onTap: () {
Navigator.pop(context);
AppRouter.instance.pushNamed('postEditor', queryParameters: {
'mode': 1.toString(),
}).then((val) {
if (val != null && onCreated != null) onCreated!();
});
},

View File

@ -29,6 +29,7 @@ class PostPublishScreen extends StatefulWidget {
final Post? reply;
final Post? repost;
final Realm? realm;
final int mode;
const PostPublishScreen({
super.key,
@ -36,6 +37,7 @@ class PostPublishScreen extends StatefulWidget {
this.reply,
this.repost,
this.realm,
required this.mode,
});
@override
@ -79,6 +81,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
}
void syncWidget() {
_editorController.mode.value = widget.mode;
if (widget.edit != null) {
_editorController.editTarget = widget.edit;
}
@ -108,7 +111,13 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
child: Scaffold(
appBar: AppBar(
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle('postEditorModeStory'.tr),
title: Obx(
() => AppBarTitle(
_editorController.mode.value == 0
? 'postEditorModeStory'.tr
: 'postEditorModeArticle'.tr,
),
),
centerTitle: false,
toolbarHeight: SolianTheme.toolbarHeight(context),
actions: [