🐛 Fix post editor cannot reply either repost

This commit is contained in:
LittleSheep 2024-08-04 12:55:05 +08:00
parent 0a7ccaeefa
commit 54e176e75d
2 changed files with 28 additions and 10 deletions

View File

@ -100,7 +100,7 @@ class SolianApp extends StatelessWidget {
routeInformationProvider: AppRouter.instance.routeInformationProvider, routeInformationProvider: AppRouter.instance.routeInformationProvider,
backButtonDispatcher: AppRouter.instance.backButtonDispatcher, backButtonDispatcher: AppRouter.instance.backButtonDispatcher,
translations: SolianMessages(), translations: SolianMessages(),
locale: const Locale('en', 'US'), locale: Get.deviceLocale,
fallbackLocale: const Locale('en', 'US'), fallbackLocale: const Locale('en', 'US'),
onInit: () => _initializeProviders(context), onInit: () => _initializeProviders(context),
builder: (context, child) { builder: (context, child) {

View File

@ -128,7 +128,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.edit == null) _editorController.localRead(); if (widget.edit == null && widget.reply == null && widget.repost == null) {
_editorController.localRead();
}
if (widget.reply != null) {
_editorController.replyTo.value = widget.reply;
}
if (widget.repost != null) {
_editorController.repostTo.value = widget.repost;
}
_editorController.contentController.addListener(() => setState(() {})); _editorController.contentController.addListener(() => setState(() {}));
_syncWidget(); _syncWidget();
} }
@ -219,10 +227,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
collapsedBackgroundColor: collapsedBackgroundColor:
Theme.of(context).colorScheme.surfaceContainer, Theme.of(context).colorScheme.surfaceContainer,
children: [ children: [
PostItem( Container(
constraints: const BoxConstraints(maxHeight: 280),
child: SingleChildScrollView(
child: PostItem(
item: _replyTo!, item: _replyTo!,
isReactable: false, isReactable: false,
).paddingOnly(bottom: 8), ).paddingOnly(bottom: 8),
),
),
], ],
), ),
if (_repostTo != null) if (_repostTo != null)
@ -237,10 +250,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
collapsedBackgroundColor: collapsedBackgroundColor:
Theme.of(context).colorScheme.surfaceContainer, Theme.of(context).colorScheme.surfaceContainer,
children: [ children: [
PostItem( Container(
constraints: const BoxConstraints(maxHeight: 280),
child: SingleChildScrollView(
child: PostItem(
item: _repostTo!, item: _repostTo!,
isReactable: false, isReactable: false,
).paddingOnly(bottom: 8), ).paddingOnly(bottom: 8),
),
),
], ],
), ),
Expanded( Expanded(