From 89becbfe71f00c55b72313d405ad7e9de0070b24 Mon Sep 17 00:00:00 2001
From: "Lucas.Xu" <lucas.xu@appflowy.io>
Date: Thu, 1 Dec 2022 15:08:16 +0800
Subject: [PATCH] feat: add hint text for math equation plugin

---
 .../math_equation_node_widget.dart            | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/math_ equation/math_equation_node_widget.dart b/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/math_ equation/math_equation_node_widget.dart
index dbc741852c..0baffbba47 100644
--- a/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/math_ equation/math_equation_node_widget.dart	
+++ b/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/math_ equation/math_equation_node_widget.dart	
@@ -113,17 +113,25 @@ class _MathEquationNodeWidgetState extends State<_MathEquationNodeWidget> {
   Widget _buildMathEquation(BuildContext context) {
     return Container(
       width: MediaQuery.of(context).size.width,
+      constraints: const BoxConstraints(minHeight: 50),
       padding: const EdgeInsets.symmetric(vertical: 20),
       decoration: BoxDecoration(
         borderRadius: const BorderRadius.all(Radius.circular(8.0)),
-        color: _isHover ? Colors.grey[200] : Colors.transparent,
+        color: _isHover || _mathEquation.isEmpty
+            ? Colors.grey[200]
+            : Colors.transparent,
       ),
       child: Center(
-        child: Math.tex(
-          _mathEquation,
-          textStyle: const TextStyle(fontSize: 20),
-          mathStyle: MathStyle.display,
-        ),
+        child: _mathEquation.isEmpty
+            ? Text(
+                'Add a Math Equation',
+                style: widget.editorState.editorStyle.placeholderTextStyle,
+              )
+            : Math.tex(
+                _mathEquation,
+                textStyle: const TextStyle(fontSize: 20),
+                mathStyle: MathStyle.display,
+              ),
       ),
     );
   }