Skip to content

Commit 3b29e2b

Browse files
committed
added hintText feature
1 parent 1a87747 commit 3b29e2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/widgets/markdown_auto_preview.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/services.dart';
33
import 'package:flutter_markdown/flutter_markdown.dart';
4+
45
import '../src/constants.dart';
56
import '../src/emoji_input_formatter.dart';
67
import '../src/toolbar.dart';
@@ -28,6 +29,7 @@ class MarkdownAutoPreview extends StatefulWidget {
2829
this.readOnly = false,
2930
this.expands = false,
3031
this.decoration = const InputDecoration(isDense: true),
32+
this.hintText,
3133
});
3234

3335
/// Markdown syntax to reset the field to
@@ -37,6 +39,9 @@ class MarkdownAutoPreview extends StatefulWidget {
3739
///
3840
final String? markdownSyntax;
3941

42+
/// Hint text to show when the field is empty
43+
final String? hintText;
44+
4045
/// For enable toolbar options
4146
///
4247
/// if false, toolbar widget will not display
@@ -269,7 +274,7 @@ class _MarkdownAutoPreviewState extends State<MarkdownAutoPreview> {
269274
child: MarkdownBody(
270275
key: const ValueKey<String>("zmarkdown-parse-body"),
271276
data: _internalController.text == ""
272-
? "_Markdown text_"
277+
? widget.hintText ?? "_Markdown text_"
273278
: _internalController.text,
274279
),
275280
),

0 commit comments

Comments
 (0)