@@ -12,7 +12,7 @@ class MarkdownFormField extends StatefulWidget {
12
12
this .style,
13
13
this .emojiConvert = false ,
14
14
this .onTap,
15
- this .enableToolBar = false ,
15
+ this .enableToolBar = true ,
16
16
this .autoCloseAfterSelectEmoji = true ,
17
17
this .textCapitalization = TextCapitalization .sentences,
18
18
this .readOnly = false ,
@@ -23,7 +23,8 @@ class MarkdownFormField extends StatefulWidget {
23
23
this .maxLines,
24
24
this .minLines,
25
25
this .expands = false ,
26
- this .decoration = const InputDecoration (hintText: 'Type here...' ),
26
+ this .decoration =
27
+ const InputDecoration (hintText: 'Type here...' , isDense: true ),
27
28
this .padding = const EdgeInsets .all (8 ),
28
29
}) : super (key: key);
29
30
@@ -162,20 +163,21 @@ class _MarkdownFormFieldState extends State<MarkdownFormField> {
162
163
_internalController = widget.controller ?? TextEditingController ();
163
164
_internalFocus = widget.focusNode ?? FocusNode ();
164
165
165
- _internalFocus.addListener (_requestFocused);
166
+ // _internalFocus.addListener(_requestFocused);
166
167
167
168
super .initState ();
168
169
}
169
170
170
- void _requestFocused () {
171
- if (_internalFocus.hasFocus) {
172
- _focused = true ;
173
- } else {
174
- _focused = false ;
175
- }
171
+ // void _requestFocused() {
172
+ // if (_internalFocus.hasFocus) {
173
+ // _focused = true;
174
+ // } else {
175
+ // _focused = false;
176
+ // }
177
+ // // print('Focus Changed.. $_focused');
176
178
177
- setState (() {});
178
- }
179
+ // setState(() {});
180
+ // }
179
181
180
182
@override
181
183
Widget build (BuildContext context) {
@@ -187,11 +189,14 @@ class _MarkdownFormFieldState extends State<MarkdownFormField> {
187
189
_internalFocus.requestFocus ();
188
190
setState (() {});
189
191
},
190
- child: MarkdownParseBody (
191
- key: const ValueKey <String >("zmarkdown-parse-body" ),
192
- data: _internalController.text == ""
193
- ? "Type here. . ."
194
- : _internalController.text,
192
+ child: Align (
193
+ alignment: Alignment .centerLeft,
194
+ child: MarkdownParseBody (
195
+ key: const ValueKey <String >("zmarkdown-parse-body" ),
196
+ data: _internalController.text == ""
197
+ ? "Type here. . ."
198
+ : _internalController.text,
199
+ ),
195
200
),
196
201
);
197
202
}
@@ -201,6 +206,7 @@ class _MarkdownFormFieldState extends State<MarkdownFormField> {
201
206
? _editor ()
202
207
: Column (
203
208
mainAxisSize: MainAxisSize .min,
209
+ crossAxisAlignment: CrossAxisAlignment .start,
204
210
children: [
205
211
_editor (),
206
212
@@ -213,10 +219,12 @@ class _MarkdownFormFieldState extends State<MarkdownFormField> {
213
219
autoCloseAfterSelectEmoji:
214
220
widget.autoCloseAfterSelectEmoji,
215
221
isEditorFocused: (bool status) {
222
+ // print('isEditorFocused...');
216
223
_focused = status;
217
224
setState (() {});
218
225
},
219
226
onPreviewChanged: () {
227
+ // print('onPreviewChanged');
220
228
_focused = _focused ? false : true ;
221
229
FocusScope .of (context).unfocus ();
222
230
setState (() {});
@@ -232,10 +240,12 @@ class _MarkdownFormFieldState extends State<MarkdownFormField> {
232
240
autoCloseAfterSelectEmoji:
233
241
widget.autoCloseAfterSelectEmoji,
234
242
isEditorFocused: (bool status) {
243
+ // print('isEditorFocused...');
235
244
_focused = status;
236
245
setState (() {});
237
246
},
238
247
onPreviewChanged: () {
248
+ // print('onPreviewChanged');
239
249
_focused = _focused ? false : true ;
240
250
FocusScope .of (context).unfocus ();
241
251
setState (() {});
0 commit comments