11import 'package:acter/common/themes/colors/color_scheme.dart' ;
22import 'package:acter/common/toolkit/buttons/primary_action_button.dart' ;
33import 'package:acter/common/toolkit/html_editor/html_editor.dart' ;
4+ import 'package:acter/common/utils/utils.dart' ;
45import 'package:appflowy_editor/appflowy_editor.dart' ;
56import 'package:flutter/material.dart' ;
67import 'package:acter/l10n/generated/l10n.dart' ;
@@ -14,11 +15,20 @@ void showEditHtmlDescriptionBottomSheet({
1415 required Function (WidgetRef , String , String ) onSave,
1516}) {
1617 showModalBottomSheet (
17- showDragHandle: true ,
18+ showDragHandle: false ,
19+ isDismissible: false ,
20+ enableDrag: false ,
1821 useSafeArea: true ,
1922 context: context,
20- isDismissible: true ,
2123 isScrollControlled: true ,
24+ shape: const RoundedRectangleBorder (
25+ borderRadius: BorderRadius .only (
26+ topLeft: Radius .circular (16 ),
27+ topRight: Radius .circular (16 ),
28+ bottomLeft: Radius .circular (0 ),
29+ bottomRight: Radius .circular (0 ),
30+ ),
31+ ),
2232 builder: (context) {
2333 return EditHtmlDescriptionSheet (
2434 bottomSheetTitle: bottomSheetTitle,
@@ -56,29 +66,48 @@ class _EditHtmlDescriptionSheetState
5666 @override
5767 void initState () {
5868 super .initState ();
59- textEditorState = ActerEditorStateHelpers .fromContent (
60- widget.descriptionMarkdownValue ?? '' ,
61- widget.descriptionHtmlValue,
62- );
69+
70+ final hasValidContent = hasValidEditorContent (
71+ plainText: widget.descriptionMarkdownValue ?? '' ,
72+ html: widget.descriptionHtmlValue ?? '' );
73+
74+ if (hasValidContent) {
75+ // Use existing content
76+ textEditorState = ActerEditorStateHelpers .fromContent (
77+ widget.descriptionMarkdownValue ?? '' ,
78+ widget.descriptionHtmlValue,
79+ );
80+ } else {
81+ // Use blank editor with initial text for empty state
82+ textEditorState = EditorState .blank (withInitialText: true );
83+ }
6384 }
6485
6586 @override
6687 Widget build (BuildContext context) {
6788 final lang = L10n .of (context);
6889 return Padding (
69- padding: MediaQuery . of (context).viewInsets ,
90+ padding: const EdgeInsets . symmetric (horizontal : 20 , vertical : 20 ) ,
7091 child: Column (
7192 mainAxisSize: MainAxisSize .min,
7293 children: [
73- Text (widget.bottomSheetTitle ?? lang.editDescription),
74- const SizedBox (height: 20 ),
94+ Text (
95+ widget.bottomSheetTitle ?? lang.editDescription,
96+ style: Theme .of (context).textTheme.titleMedium,
97+ ),
98+ const SizedBox (height: 10 ),
7599 Container (
100+ padding: const EdgeInsets .all (20 ),
76101 height: 200 ,
77102 decoration: BoxDecoration (
78103 border: Border .all (color: brandColor),
79104 borderRadius: BorderRadius .circular (10.0 ),
80105 ),
81- child: HtmlEditor (editorState: textEditorState, editable: true ),
106+ child: HtmlEditor (
107+ editorState: textEditorState,
108+ editable: true ,
109+ hintText: lang.addDescription,
110+ ),
82111 ),
83112 const SizedBox (height: 20 ),
84113 Row (
@@ -106,7 +135,7 @@ class _EditHtmlDescriptionSheetState
106135 ),
107136 ],
108137 ),
109- const SizedBox (height: 100 ),
138+ const SizedBox (height: 20 ),
110139 ],
111140 ),
112141 );
0 commit comments