Showing
4 changed files
with
16 additions
and
14 deletions
@@ -178,8 +178,8 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex | @@ -178,8 +178,8 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex | ||
178 | debugPrint(url); | 178 | debugPrint(url); |
179 | debugPrint(title); | 179 | debugPrint(title); |
180 | }, | 180 | }, |
181 | - // maxLines: 3, | ||
182 | - // overflow: TextOverflow.ellipsis, | 181 | + maxLines: 7, |
182 | + overflow: TextOverflow.ellipsis, | ||
183 | textAlign: TextAlign.justify, | 183 | textAlign: TextAlign.justify, |
184 | // textScaler: const TextScaler.linear(1.3), | 184 | // textScaler: const TextScaler.linear(1.3), |
185 | textScaler: const TextScaler.linear(1), | 185 | textScaler: const TextScaler.linear(1), |
@@ -58,4 +58,15 @@ class GptMarkdownConfig { | @@ -58,4 +58,15 @@ class GptMarkdownConfig { | ||
58 | overflow: overflow ?? this.overflow, | 58 | overflow: overflow ?? this.overflow, |
59 | ); | 59 | ); |
60 | } | 60 | } |
61 | + | ||
62 | + getRich(InlineSpan span) { | ||
63 | + return Text.rich( | ||
64 | + span, | ||
65 | + textDirection: textDirection, | ||
66 | + textScaler: textScaler, | ||
67 | + textAlign: textAlign, | ||
68 | + maxLines: maxLines, | ||
69 | + overflow: overflow, | ||
70 | + ); | ||
71 | + } | ||
61 | } | 72 | } |
@@ -194,7 +194,7 @@ class HTag extends BlockMd { | @@ -194,7 +194,7 @@ class HTag extends BlockMd { | ||
194 | .titleSmall | 194 | .titleSmall |
195 | ?.copyWith(color: config.style?.color), | 195 | ?.copyWith(color: config.style?.color), |
196 | ][match![1]!.length - 1]); | 196 | ][match![1]!.length - 1]); |
197 | - return Text.rich( | 197 | + return config.getRich( |
198 | TextSpan( | 198 | TextSpan( |
199 | children: [ | 199 | children: [ |
200 | ...(MarkdownComponent.generate( | 200 | ...(MarkdownComponent.generate( |
@@ -217,9 +217,6 @@ class HTag extends BlockMd { | @@ -217,9 +217,6 @@ class HTag extends BlockMd { | ||
217 | ], | 217 | ], |
218 | ], | 218 | ], |
219 | ), | 219 | ), |
220 | - textDirection: config.textDirection, | ||
221 | - overflow: config.overflow, | ||
222 | - maxLines: config.maxLines, | ||
223 | ); | 220 | ); |
224 | } | 221 | } |
225 | } | 222 | } |
@@ -679,7 +676,7 @@ class ATagMd extends InlineMd { | @@ -679,7 +676,7 @@ class ATagMd extends InlineMd { | ||
679 | onTap: () { | 676 | onTap: () { |
680 | config.onLinkTab?.call("${match?[2]}", "${match?[1]}"); | 677 | config.onLinkTab?.call("${match?[2]}", "${match?[1]}"); |
681 | }, | 678 | }, |
682 | - child: Text.rich( | 679 | + child: config.getRich( |
683 | TextSpan( | 680 | TextSpan( |
684 | text: "${match?[1]}", | 681 | text: "${match?[1]}", |
685 | style: (config.style ?? const TextStyle()).copyWith( | 682 | style: (config.style ?? const TextStyle()).copyWith( |
@@ -688,7 +685,6 @@ class ATagMd extends InlineMd { | @@ -688,7 +685,6 @@ class ATagMd extends InlineMd { | ||
688 | decoration: TextDecoration.underline, | 685 | decoration: TextDecoration.underline, |
689 | ), | 686 | ), |
690 | ), | 687 | ), |
691 | - textDirection: config.textDirection, | ||
692 | ), | 688 | ), |
693 | ), | 689 | ), |
694 | ); | 690 | ); |
@@ -33,16 +33,11 @@ class MdWidget extends StatelessWidget { | @@ -33,16 +33,11 @@ class MdWidget extends StatelessWidget { | ||
33 | config, | 33 | config, |
34 | ), | 34 | ), |
35 | ); | 35 | ); |
36 | - return Text.rich( | 36 | + return config.getRich( |
37 | TextSpan( | 37 | TextSpan( |
38 | children: list, | 38 | children: list, |
39 | style: config.style?.copyWith(), | 39 | style: config.style?.copyWith(), |
40 | ), | 40 | ), |
41 | - textDirection: config.textDirection, | ||
42 | - textScaler: config.textScaler, | ||
43 | - textAlign: config.textAlign, | ||
44 | - maxLines: config.maxLines, | ||
45 | - overflow: config.overflow, | ||
46 | ); | 41 | ); |
47 | } | 42 | } |
48 | } | 43 | } |
-
Please register or login to post a comment