saminsohag

Bug fixes

@@ -395,7 +395,7 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex @@ -395,7 +395,7 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
395 ), 395 ),
396 if (writingMod) 396 if (writingMod)
397 ConstrainedBox( 397 ConstrainedBox(
398 - constraints: const BoxConstraints(maxHeight: 200), 398 + constraints: const BoxConstraints(maxHeight: 400),
399 child: Padding( 399 child: Padding(
400 padding: const EdgeInsets.all(8.0), 400 padding: const EdgeInsets.all(8.0),
401 child: TextField( 401 child: TextField(
@@ -68,7 +68,7 @@ class GptMarkdownConfig { @@ -68,7 +68,7 @@ class GptMarkdownConfig {
68 ); 68 );
69 } 69 }
70 70
71 - getRich(InlineSpan span) { 71 + Text getRich(InlineSpan span) {
72 return Text.rich( 72 return Text.rich(
73 span, 73 span,
74 textDirection: textDirection, 74 textDirection: textDirection,
@@ -12,8 +12,8 @@ abstract class MarkdownComponent { @@ -12,8 +12,8 @@ abstract class MarkdownComponent {
12 RadioButtonMd(), 12 RadioButtonMd(),
13 CheckBoxMd(), 13 CheckBoxMd(),
14 HrLine(), 14 HrLine(),
  15 + LatexMathMultiLine(),
15 IndentMd(), 16 IndentMd(),
16 - LatexMathMultyLine(),  
17 LatexMath(), 17 LatexMath(),
18 ImageMd(), 18 ImageMd(),
19 HighlightedText(), 19 HighlightedText(),
@@ -145,9 +145,10 @@ abstract class BlockMd extends MarkdownComponent { @@ -145,9 +145,10 @@ abstract class BlockMd extends MarkdownComponent {
145 text, 145 text,
146 config, 146 config,
147 ); 147 );
  148 + length = min(length, 4);
148 if (length > 0) { 149 if (length > 0) {
149 child = UnorderedListView( 150 child = UnorderedListView(
150 - spacing: length.toDouble() * 6, 151 + spacing: length * 6.0,
151 child: child, 152 child: child,
152 ); 153 );
153 } 154 }
@@ -306,7 +307,7 @@ class RadioButtonMd extends BlockMd { @@ -306,7 +307,7 @@ class RadioButtonMd extends BlockMd {
306 class IndentMd extends InlineMd { 307 class IndentMd extends InlineMd {
307 @override 308 @override
308 RegExp get exp => 309 RegExp get exp =>
309 - RegExp(r"^(\ +)(((?!\n\n).)+)$", dotAll: true, multiLine: true); 310 + RegExp(r"^(\ +)(((?!(\n\n|\n\ )).)+)$", dotAll: true, multiLine: true);
310 311
311 @override 312 @override
312 InlineSpan span( 313 InlineSpan span(
@@ -317,7 +318,7 @@ class IndentMd extends InlineMd { @@ -317,7 +318,7 @@ class IndentMd extends InlineMd {
317 var match = exp.firstMatch(text); 318 var match = exp.firstMatch(text);
318 int spaces = (match?[1] ?? "").length; 319 int spaces = (match?[1] ?? "").length;
319 var data = "${match?[2]}".trim(); 320 var data = "${match?[2]}".trim();
320 - data.replaceAll(RegExp(r'\n\ *'), '\n').trim(); 321 + data = data.replaceAll(RegExp(r'\n\ {' '$spaces' '}'), '\n').trim();
321 var child = TextSpan( 322 var child = TextSpan(
322 children: MarkdownComponent.generate( 323 children: MarkdownComponent.generate(
323 context, 324 context,
@@ -330,17 +331,16 @@ class IndentMd extends InlineMd { @@ -330,17 +331,16 @@ class IndentMd extends InlineMd {
330 } 331 }
331 return TextSpan( 332 return TextSpan(
332 children: [ 333 children: [
333 - const TextSpan(text: '\n'),  
334 WidgetSpan( 334 WidgetSpan(
335 - child: UnorderedListView(  
336 - bulletColor: config.style?.color,  
337 - padding: spaces * 5,  
338 - bulletSize: 0,  
339 - textDirection: config.textDirection,  
340 - child: Text.rich(child), 335 + child: Row(
  336 + children: [
  337 + const SizedBox(
  338 + width: 20,
  339 + ),
  340 + Expanded(child: config.getRich(child)),
  341 + ],
341 ), 342 ),
342 ), 343 ),
343 - const TextSpan(text: '\n'),  
344 ], 344 ],
345 ); 345 );
346 } 346 }
@@ -520,7 +520,7 @@ class ItalicMd extends InlineMd { @@ -520,7 +520,7 @@ class ItalicMd extends InlineMd {
520 } 520 }
521 } 521 }
522 522
523 -class LatexMathMultyLine extends BlockMd { 523 +class LatexMathMultiLine extends BlockMd {
524 @override 524 @override
525 String get expString => (r"\\\[(((?!\n\n).)*)\\\]|(\\begin.*?\\end{.*?})"); 525 String get expString => (r"\\\[(((?!\n\n).)*)\\\]|(\\begin.*?\\end{.*?})");
526 @override 526 @override
@@ -701,7 +701,7 @@ class SourceTag extends InlineMd { @@ -701,7 +701,7 @@ class SourceTag extends InlineMd {
701 /// Link text component 701 /// Link text component
702 class ATagMd extends InlineMd { 702 class ATagMd extends InlineMd {
703 @override 703 @override
704 - RegExp get exp => RegExp(r"\[([^\s\*][^\n]*?[^\s]?)?\]\(([^\s\*]+)?\)"); 704 + RegExp get exp => RegExp(r"\[([^\s\*][^\n]*?[^\s]?)?\]\(([^\s\*]+?)?\)");
705 705
706 @override 706 @override
707 InlineSpan span( 707 InlineSpan span(
@@ -731,7 +731,7 @@ class ATagMd extends InlineMd { @@ -731,7 +731,7 @@ class ATagMd extends InlineMd {
731 /// Image component 731 /// Image component
732 class ImageMd extends InlineMd { 732 class ImageMd extends InlineMd {
733 @override 733 @override
734 - RegExp get exp => RegExp(r"\!\[([^\s][^\n]*[^\s]?)?\]\(([^\s]+)\)"); 734 + RegExp get exp => RegExp(r"\!\[([^\s][^\n]*[^\s]?)?\]\(([^\s]+?)\)");
735 735
736 @override 736 @override
737 InlineSpan span( 737 InlineSpan span(