✨ Live preview of post editor
This commit is contained in:
parent
e9e6f3313e
commit
7332f68d9c
@ -14,6 +14,7 @@ import 'package:solian/router.dart';
|
|||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/app_bar_title.dart';
|
import 'package:solian/widgets/app_bar_title.dart';
|
||||||
|
import 'package:solian/widgets/markdown_text_content.dart';
|
||||||
import 'package:solian/widgets/posts/post_item.dart';
|
import 'package:solian/widgets/posts/post_item.dart';
|
||||||
import 'package:badges/badges.dart' as badges;
|
import 'package:badges/badges.dart' as badges;
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
context.showErrorDialog(resp.bodyString);
|
context.showErrorDialog(resp.bodyString);
|
||||||
} else {
|
} else {
|
||||||
_editorController.localClear();
|
_editorController.localClear();
|
||||||
|
_editorController.currentClear();
|
||||||
AppRouter.instance.pop(resp.body);
|
AppRouter.instance.pop(resp.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,30 +256,51 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (_isBusy)
|
Expanded(
|
||||||
const LinearProgressIndicator().animate().scaleX(),
|
child: ListView(
|
||||||
Container(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
if (_isBusy)
|
||||||
horizontal: 16,
|
const LinearProgressIndicator().animate().scaleX(),
|
||||||
vertical: 8,
|
Container(
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: TextField(
|
horizontal: 16,
|
||||||
maxLines: null,
|
vertical: 8,
|
||||||
autofocus: true,
|
),
|
||||||
autocorrect: true,
|
child: TextField(
|
||||||
keyboardType: TextInputType.multiline,
|
maxLines: null,
|
||||||
controller: _editorController.contentController,
|
autofocus: true,
|
||||||
focusNode: _contentFocusNode,
|
autocorrect: true,
|
||||||
decoration: InputDecoration.collapsed(
|
keyboardType: TextInputType.multiline,
|
||||||
hintText: 'postContentPlaceholder'.tr,
|
controller: _editorController.contentController,
|
||||||
),
|
focusNode: _contentFocusNode,
|
||||||
onTapOutside: (_) =>
|
decoration: InputDecoration.collapsed(
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
hintText: 'postContentPlaceholder'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 120)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 120)
|
if (SolianTheme.isLargeScreen(context))
|
||||||
|
const VerticalDivider(width: 0.3, thickness: 0.3)
|
||||||
|
.paddingSymmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
),
|
||||||
|
if (SolianTheme.isLargeScreen(context))
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: MarkdownTextContent(
|
||||||
|
content: _editorController.contentController.text,
|
||||||
|
parentId: 'post-editor-preview',
|
||||||
|
).paddingOnly(top: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user