Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
gpt_markdown
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
saminsohag
2024-08-05 06:24:14 +0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3df2c9839e8639caf8da8f31ed720f678f38e597
3df2c983
1 parent
23659327
overflow peramiter added
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
276 additions
and
432 deletions
gpt_markdown/CHANGELOG.md
gpt_markdown/example/lib/main.dart
gpt_markdown/example/pubspec.lock
gpt_markdown/lib/custom_widgets/markdow_config.dart
gpt_markdown/lib/gpt_markdown.dart
gpt_markdown/lib/markdown_component.dart
gpt_markdown/lib/md_widget.dart
gpt_markdown/pubspec.yaml
gpt_markdown/CHANGELOG.md
View file @
3df2c98
## 0.1.6
*
`overflow`
perameter added.
## 0.1.5
*
Some color changes and highlighted text style changed.
...
...
gpt_markdown/example/lib/main.dart
View file @
3df2c98
...
...
@@ -178,7 +178,8 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
debugPrint(url);
debugPrint(title);
},
maxLines: null,
// maxLines: 3,
// overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
// textScaler: const TextScaler.linear(1.3),
textScaler: const TextScaler.linear(1),
...
...
@@ -186,9 +187,33 @@ Markdown and LaTeX can be powerful tools for formatting text and mathematical ex
// Regular text font size here.
fontSize: 15,
),
latexWorkaround: (tex) =>
tex.replaceAllMapped(RegExp(r"align
\
*"),
(match) => "aligned"),
latexWorkaround: (tex) {
List<String> stack = [];
tex = tex.splitMapJoin(
RegExp(r"
\\
text
\
{|
\
{|
\
}|
\
_"),
onMatch: (p) {
String input = p[0] ?? "";
if (input == r"
\t
ext{") {
stack.add(input);
}
if (stack.isNotEmpty) {
if (input == r"{") {
stack.add(input);
}
if (input == r"}") {
stack.removeLast();
}
if (input == r"_") {
return r"
\
_";
}
}
return input;
},
);
return tex.replaceAllMapped(
RegExp(r"align
\
*"),
(match) => "aligned");
},
latexBuilder:
(contex, tex, textStyle, inline) {
if (tex.contains(r"
\
begin{tabular}")) {
...
...
gpt_markdown/example/pubspec.lock
View file @
3df2c98
...
...
@@ -77,10 +77,10 @@ packages:
dependency: transitive
description:
name: cross_file
sha256: "
55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32
"
sha256: "
7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670
"
url: "https://pub.dev"
source: hosted
version: "0.3.4+
1
"
version: "0.3.4+
2
"
crypto:
dependency: transitive
description:
...
...
@@ -154,10 +154,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256:
c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e
sha256:
"9d98bd47ef9d34e803d438f17fd32b116d31009f534a6fa5ce3a1167f189a6de"
url: "https://pub.dev"
source: hosted
version: "2.0.2
0
"
version: "2.0.2
1
"
flutter_svg:
dependency: transitive
description:
...
...
@@ -182,15 +182,15 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.
5
"
version: "0.1.
6
"
http:
dependency: transitive
description:
name: http
sha256:
"761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
sha256:
b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
url: "https://pub.dev"
source: hosted
version: "1.2.
1
"
version: "1.2.
2
"
http_parser:
dependency: transitive
description:
...
...
@@ -291,18 +291,18 @@ packages:
dependency: "direct main"
description:
name: path_provider
sha256:
c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
sha256:
fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
url: "https://pub.dev"
source: hosted
version: "2.1.
3
"
version: "2.1.
4
"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "
30c5aa827a6ae95ce2853cdc5fe3971daaac00f6f081c419c013f7f57bff2f5e
"
sha256: "
490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb
"
url: "https://pub.dev"
source: hosted
version: "2.2.
7
"
version: "2.2.
9
"
path_provider_foundation:
dependency: transitive
description:
...
...
@@ -379,10 +379,10 @@ packages:
dependency: transitive
description:
name: permission_handler_html
sha256: "
54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d
"
sha256: "
6cac773d389e045a8d4f85418d07ad58ef9e42a56e063629ce14c4c26344de24
"
url: "https://pub.dev"
source: hosted
version: "0.1.
1
"
version: "0.1.
2
"
permission_handler_platform_interface:
dependency: transitive
description:
...
...
@@ -443,10 +443,10 @@ packages:
dependency: transitive
description:
name: qr
sha256: "
64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3
"
sha256: "
5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445
"
url: "https://pub.dev"
source: hosted
version: "3.0.
1
"
version: "3.0.
2
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -528,18 +528,18 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256:
ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf
sha256:
"94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9"
url: "https://pub.dev"
source: hosted
version: "6.3.
3
"
version: "6.3.
8
"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256:
"7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89"
sha256:
e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
url: "https://pub.dev"
source: hosted
version: "6.3.
0
"
version: "6.3.
1
"
url_launcher_linux:
dependency: transitive
description:
...
...
@@ -568,18 +568,18 @@ packages:
dependency: transitive
description:
name: url_launcher_web
sha256:
"8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a"
sha256:
a36e2d7981122fa185006b216eb6b5b97ede3f9a54b7a511bc966971ab98d049
url: "https://pub.dev"
source: hosted
version: "2.3.
1
"
version: "2.3.
2
"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256:
ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
sha256:
"49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185"
url: "https://pub.dev"
source: hosted
version: "3.1.
1
"
version: "3.1.
2
"
vector_graphics:
dependency: transitive
description:
...
...
@@ -632,10 +632,10 @@ packages:
dependency: transitive
description:
name: win32
sha256:
a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
sha256:
"015002c060f1ae9f41a818f2d5640389cc05283e368be19dc8d77cecb43c40c9"
url: "https://pub.dev"
source: hosted
version: "5.5.
1
"
version: "5.5.
3
"
xdg_directories:
dependency: transitive
description:
...
...
gpt_markdown/lib/custom_widgets/markdow_config.dart
0 → 100644
View file @
3df2c98
import
'package:flutter/material.dart'
;
class
GptMarkdownConfig
{
const
GptMarkdownConfig
({
this
.
style
,
this
.
textDirection
=
TextDirection
.
ltr
,
this
.
onLinkTab
,
this
.
textAlign
,
this
.
textScaler
,
this
.
latexWorkaround
,
this
.
latexBuilder
,
this
.
followLinkColor
=
false
,
this
.
codeBuilder
,
this
.
maxLines
,
this
.
overflow
,
});
final
TextDirection
textDirection
;
final
TextStyle
?
style
;
final
TextAlign
?
textAlign
;
final
TextScaler
?
textScaler
;
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
;
final
String
Function
(
String
tex
)?
latexWorkaround
;
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
;
final
bool
followLinkColor
;
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
;
final
int
?
maxLines
;
final
TextOverflow
?
overflow
;
GptMarkdownConfig
copyWith
({
TextStyle
?
style
,
TextDirection
?
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
TextAlign
?
textAlign
,
final
TextScaler
?
textScaler
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
bool
?
followLinkColor
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
int
?
maxLines
,
final
TextOverflow
?
overflow
,
})
{
return
GptMarkdownConfig
(
style:
style
??
this
.
style
,
textDirection:
textDirection
??
this
.
textDirection
,
onLinkTab:
onLinkTab
??
this
.
onLinkTab
,
textAlign:
textAlign
??
this
.
textAlign
,
textScaler:
textScaler
??
this
.
textScaler
,
latexWorkaround:
latexWorkaround
??
this
.
latexWorkaround
,
latexBuilder:
latexBuilder
??
this
.
latexBuilder
,
followLinkColor:
followLinkColor
??
this
.
followLinkColor
,
codeBuilder:
codeBuilder
??
this
.
codeBuilder
,
maxLines:
maxLines
??
this
.
maxLines
,
overflow:
overflow
??
this
.
overflow
,
);
}
}
...
...
gpt_markdown/lib/gpt_markdown.dart
View file @
3df2c98
library
tex_markdown
;
import
'package:flutter/material.dart'
;
import
'package:gpt_markdown/custom_widgets/markdow_config.dart'
;
import
'md_widget.dart'
;
...
...
@@ -19,6 +20,7 @@ class TexMarkdown extends StatelessWidget {
this
.
latexBuilder
,
this
.
codeBuilder
,
this
.
maxLines
,
this
.
overflow
,
});
final
TextDirection
textDirection
;
final
String
data
;
...
...
@@ -28,6 +30,7 @@ class TexMarkdown extends StatelessWidget {
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
;
final
String
Function
(
String
tex
)?
latexWorkaround
;
final
int
?
maxLines
;
final
TextOverflow
?
overflow
;
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
style
,
bool
inline
)?
latexBuilder
;
...
...
@@ -61,16 +64,19 @@ class TexMarkdown extends StatelessWidget {
return
ClipRRect
(
child:
MdWidget
(
tex
,
textDirection:
textDirection
,
style:
style
,
onLinkTab:
onLinkTab
,
textAlign:
textAlign
,
textScaler:
textScaler
,
followLinkColor:
followLinkColor
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
maxLines:
maxLines
,
config:
GptMarkdownConfig
(
textDirection:
textDirection
,
style:
style
,
onLinkTab:
onLinkTab
,
textAlign:
textAlign
,
textScaler:
textScaler
,
followLinkColor:
followLinkColor
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
maxLines:
maxLines
,
overflow:
overflow
,
),
));
}
}
...
...
gpt_markdown/lib/markdown_component.dart
View file @
3df2c98
...
...
@@ -5,6 +5,7 @@ import 'package:flutter_math_fork/flutter_math.dart';
import
'package:gpt_markdown/custom_widgets/custom_divider.dart'
;
import
'package:gpt_markdown/custom_widgets/custom_error_image.dart'
;
import
'package:gpt_markdown/custom_widgets/custom_rb_cb.dart'
;
import
'package:gpt_markdown/custom_widgets/markdow_config.dart'
;
import
'package:gpt_markdown/custom_widgets/unordered_ordered_list.dart'
;
import
'md_widget.dart'
;
...
...
@@ -35,15 +36,7 @@ abstract class MarkdownComponent {
static
List
<
InlineSpan
>
generate
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
List
<
InlineSpan
>
spans
=
[];
List
<
String
>
regexes
=
...
...
@@ -65,12 +58,7 @@ abstract class MarkdownComponent {
spans
.
add
(
each
.
span
(
context
,
element
,
style
,
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
config
,
));
}
else
{
if
(
each
is
BlockMd
)
{
...
...
@@ -80,25 +68,20 @@ abstract class MarkdownComponent {
style:
TextStyle
(
fontSize:
0
,
height:
0
,
color:
style
?.
color
,
color:
config
.
style
?.
color
,
),
),
each
.
span
(
context
,
element
,
style
,
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
config
,
),
TextSpan
(
text:
"
\n
"
,
style:
TextStyle
(
fontSize:
0
,
height:
0
,
color:
style
?.
color
,
color:
config
.
style
?.
color
,
),
),
]);
...
...
@@ -113,7 +96,7 @@ abstract class MarkdownComponent {
spans
.
add
(
TextSpan
(
text:
p0
,
style:
style
,
style:
config
.
style
,
),
);
return
""
;
...
...
@@ -126,15 +109,7 @@ abstract class MarkdownComponent {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
);
RegExp
get
exp
;
...
...
@@ -150,15 +125,7 @@ abstract class InlineMd extends MarkdownComponent {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
);
}
...
...
@@ -170,26 +137,13 @@ abstract class BlockMd extends MarkdownComponent {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
return
WidgetSpan
(
child:
build
(
context
,
text
,
style
,
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
config
,
),
alignment:
PlaceholderAlignment
.
middle
,
);
...
...
@@ -198,15 +152,7 @@ abstract class BlockMd extends MarkdownComponent {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
);
}
...
...
@@ -218,54 +164,43 @@ class HTag extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
var
conf
=
config
.
copyWith
(
style:
[
Theme
.
of
(
context
)
.
textTheme
.
headlineLarge
?.
copyWith
(
color:
config
.
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
headlineMedium
?.
copyWith
(
color:
config
.
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
headlineSmall
?.
copyWith
(
color:
config
.
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleLarge
?.
copyWith
(
color:
config
.
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleMedium
?.
copyWith
(
color:
config
.
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleSmall
?.
copyWith
(
color:
config
.
style
?.
color
),
][
match
![
1
]!.
length
-
1
]);
return
Text
.
rich
(
TextSpan
(
children:
[
...(
MarkdownComponent
.
generate
(
context
,
"
${match?[2]}
"
,
[
Theme
.
of
(
context
)
.
textTheme
.
headlineLarge
?.
copyWith
(
color:
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
headlineMedium
?.
copyWith
(
color:
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
headlineSmall
?.
copyWith
(
color:
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleLarge
?.
copyWith
(
color:
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleMedium
?.
copyWith
(
color:
style
?.
color
),
Theme
.
of
(
context
)
.
textTheme
.
titleSmall
?.
copyWith
(
color:
style
?.
color
),
][
match
![
1
]!.
length
-
1
],
textDirection
,
(
url
,
title
)
{},
latexWorkaround
,
latexBuilder
,
codeBuilder
,
"
${match[2]}
"
,
conf
,
)),
if
(
match
[
1
]!.
length
==
1
)
...[
const
TextSpan
(
...
...
@@ -275,13 +210,16 @@ class HTag extends BlockMd {
WidgetSpan
(
child:
CustomDivider
(
height:
2
,
color:
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
outline
,
color:
config
.
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
outline
,
),
),
],
],
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
overflow:
config
.
overflow
,
maxLines:
config
.
maxLines
,
);
}
}
...
...
@@ -293,21 +231,13 @@ class NewLines extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
return
TextSpan
(
text:
"
\n\n\n\n
"
,
style:
TextStyle
(
fontSize:
6
,
color:
style
?.
color
,
color:
config
.
style
?.
color
,
),
);
}
...
...
@@ -321,19 +251,11 @@ class HrLine extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
return
CustomDivider
(
height:
2
,
color:
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
outline
,
color:
config
.
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
outline
,
);
}
}
...
...
@@ -348,28 +270,15 @@ class CheckBoxMd extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
return
CustomCb
(
value:
(
"
${match?[1]}
"
==
"x"
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
child:
MdWidget
(
"
${match?[2]}
"
,
onLinkTab:
onLinkTab
,
textDirection:
textDirection
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
config:
config
,
),
);
}
...
...
@@ -385,28 +294,15 @@ class RadioButtonMd extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
return
CustomRb
(
value:
(
"
${match?[1]}
"
==
"x"
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
child:
MdWidget
(
"
${match?[2]}
"
,
onLinkTab:
onLinkTab
,
textDirection:
textDirection
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
config:
config
,
),
);
}
...
...
@@ -422,15 +318,7 @@ class IndentMd extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
[
r"\\\[(.*?)\\\]"
,
...
...
@@ -440,21 +328,17 @@ class IndentMd extends BlockMd {
var
match
=
exp
.
firstMatch
(
text
);
int
spaces
=
(
match
?[
1
]
??
""
).
length
;
return
UnorderedListView
(
bulletColor:
style
?.
color
,
bulletColor:
config
.
style
?.
color
,
padding:
spaces
*
5
,
bulletSize:
0
,
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
child:
RichText
(
text:
TextSpan
(
children:
MarkdownComponent
.
generate
(
context
,
"
${match?[2]}
"
,
style
,
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
),
context
,
"
${match?[2]}
"
,
config
,
),
)),
);
}
...
...
@@ -470,30 +354,17 @@ class UnOrderedList extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
);
return
UnorderedListView
(
bulletColor:
style
?.
color
,
bulletColor:
config
.
style
?.
color
,
padding:
10.0
,
bulletSize:
3
,
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
child:
MdWidget
(
"
${match?[1]}
"
,
onLinkTab:
onLinkTab
,
textDirection:
textDirection
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
config:
config
,
),
);
}
...
...
@@ -510,29 +381,19 @@ class OrderedList extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
var
conf
=
config
.
copyWith
(
style:
(
config
.
style
??
const
TextStyle
())
.
copyWith
(
fontWeight:
FontWeight
.
w100
));
return
OrderedListView
(
no:
"
${match?[1]}
"
,
textDirection:
textDirection
,
style:
(
style
??
const
TextStyle
()).
copyWith
(
fontWeight:
FontWeight
.
w100
),
textDirection:
config
.
textDirection
,
style:
conf
.
style
,
child:
MdWidget
(
"
${match?[2]}
"
,
onLinkTab:
onLinkTab
,
textDirection:
textDirection
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
config:
conf
,
),
);
}
...
...
@@ -546,20 +407,11 @@ class HighlightedText extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
return
TextSpan
(
text:
match
?[
1
],
style:
style
?.
copyWith
(
var
conf
=
config
.
copyWith
(
style:
config
.
style
?.
copyWith
(
fontWeight:
FontWeight
.
bold
,
background:
Paint
()
..
color
=
Theme
.
of
(
context
).
colorScheme
.
onInverseSurface
...
...
@@ -574,6 +426,10 @@ class HighlightedText extends InlineMd {
..
strokeJoin
=
StrokeJoin
.
round
,
),
);
return
TextSpan
(
text:
match
?[
1
],
style:
conf
.
style
,
);
}
}
...
...
@@ -586,31 +442,19 @@ class BoldMd extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
var
conf
=
config
.
copyWith
(
style:
config
.
style
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
??
const
TextStyle
(
fontWeight:
FontWeight
.
bold
));
return
TextSpan
(
children:
MarkdownComponent
.
generate
(
context
,
"
${match?[1]}
"
,
style
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
??
const
TextStyle
(
fontWeight:
FontWeight
.
w900
),
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
conf
,
),
style:
style
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
??
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),
style:
conf
.
style
,
);
}
}
...
...
@@ -626,22 +470,14 @@ class LatexMathMultyLine extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
String
Function
(
String
tex
)?
latexWorkaround
,
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
p0
=
exp
.
firstMatch
(
text
.
trim
());
p0
?.
group
(
0
);
String
mathText
=
p0
?[
1
]
??
p0
?[
2
]
??
""
;
var
workaround
=
latexWorkaround
??
(
String
tex
)
=>
tex
;
var
workaround
=
config
.
latexWorkaround
??
(
String
tex
)
=>
tex
;
var
builder
=
latexBuilder
??
var
builder
=
config
.
latexBuilder
??
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)
=>
Math
.
tex
(
tex
,
...
...
@@ -653,17 +489,18 @@ class LatexMathMultyLine extends BlockMd {
),
options:
MathOptions
(
sizeUnderTextStyle:
MathSize
.
large
,
color:
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
onSurface
,
fontSize:
style
?.
fontSize
??
color:
config
.
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
onSurface
,
fontSize:
config
.
style
?.
fontSize
??
Theme
.
of
(
context
).
textTheme
.
bodyMedium
?.
fontSize
,
mathFontOptions:
FontOptions
(
fontFamily:
"Main"
,
fontWeight:
style
?.
fontWeight
??
FontWeight
.
normal
,
fontWeight:
config
.
style
?.
fontWeight
??
FontWeight
.
normal
,
fontShape:
FontStyle
.
normal
,
),
textFontOptions:
FontOptions
(
fontFamily:
"Main"
,
fontWeight:
style
?.
fontWeight
??
FontWeight
.
normal
,
fontWeight:
config
.
style
?.
fontWeight
??
FontWeight
.
normal
,
fontShape:
FontStyle
.
normal
,
),
style:
MathStyle
.
display
,
...
...
@@ -671,7 +508,7 @@ class LatexMathMultyLine extends BlockMd {
onErrorFallback:
(
err
)
{
return
Text
(
workaround
(
mathText
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
style:
textStyle
.
copyWith
(
color:
(!
kDebugMode
)
?
null
...
...
@@ -679,8 +516,8 @@ class LatexMathMultyLine extends BlockMd {
);
},
);
return
builder
(
context
,
workaround
(
mathText
),
style
??
const
TextStyle
(),
false
);
return
builder
(
context
,
workaround
(
mathText
),
config
.
style
??
const
TextStyle
(),
false
);
}
}
...
...
@@ -699,21 +536,13 @@ class LatexMath extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
p0
=
exp
.
firstMatch
(
text
.
trim
());
p0
?.
group
(
0
);
String
mathText
=
p0
?[
1
]?.
toString
()
??
""
;
var
workaround
=
latexWorkaround
??
(
String
tex
)
=>
tex
;
var
builder
=
latexBuilder
??
var
workaround
=
config
.
latexWorkaround
??
(
String
tex
)
=>
tex
;
var
builder
=
config
.
latexBuilder
??
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)
=>
Math
.
tex
(
tex
,
...
...
@@ -725,17 +554,18 @@ class LatexMath extends InlineMd {
),
options:
MathOptions
(
sizeUnderTextStyle:
MathSize
.
large
,
color:
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
onSurface
,
fontSize:
style
?.
fontSize
??
color:
config
.
style
?.
color
??
Theme
.
of
(
context
).
colorScheme
.
onSurface
,
fontSize:
config
.
style
?.
fontSize
??
Theme
.
of
(
context
).
textTheme
.
bodyMedium
?.
fontSize
,
mathFontOptions:
FontOptions
(
fontFamily:
"Main"
,
fontWeight:
style
?.
fontWeight
??
FontWeight
.
normal
,
fontWeight:
config
.
style
?.
fontWeight
??
FontWeight
.
normal
,
fontShape:
FontStyle
.
normal
,
),
textFontOptions:
FontOptions
(
fontFamily:
"Main"
,
fontWeight:
style
?.
fontWeight
??
FontWeight
.
normal
,
fontWeight:
config
.
style
?.
fontWeight
??
FontWeight
.
normal
,
fontShape:
FontStyle
.
normal
,
),
style:
MathStyle
.
display
,
...
...
@@ -743,7 +573,7 @@ class LatexMath extends InlineMd {
onErrorFallback:
(
err
)
{
return
Text
(
workaround
(
mathText
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
style:
textStyle
.
copyWith
(
color:
(!
kDebugMode
)
?
null
...
...
@@ -754,8 +584,8 @@ class LatexMath extends InlineMd {
return
WidgetSpan
(
alignment:
PlaceholderAlignment
.
baseline
,
baseline:
TextBaseline
.
alphabetic
,
child:
builder
(
context
,
workaround
(
mathText
),
style
??
const
TextStyle
(),
true
),
child:
builder
(
context
,
workaround
(
mathText
),
config
.
style
??
const
TextStyle
(),
true
),
);
}
}
...
...
@@ -769,29 +599,19 @@ class ItalicMd extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
var
conf
=
config
.
copyWith
(
style:
(
config
.
style
??
const
TextStyle
())
.
copyWith
(
fontStyle:
FontStyle
.
italic
));
return
TextSpan
(
children:
MarkdownComponent
.
generate
(
context
,
"
${match?[1]}
"
,
(
style
??
const
TextStyle
()).
copyWith
(
fontStyle:
FontStyle
.
italic
),
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
conf
,
),
style:
(
style
??
const
TextStyle
()).
copyWith
(
fontStyle:
FontStyle
.
italic
)
,
style:
conf
.
style
,
);
}
}
...
...
@@ -805,15 +625,7 @@ class SourceTag extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
if
(
match
?[
1
]
==
null
)
{
...
...
@@ -835,7 +647,7 @@ class SourceTag extends InlineMd {
child:
Text
(
"
${match?[1]}
"
,
// style: (style ?? const TextStyle()).copyWith(),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
),
),
),
...
...
@@ -854,15 +666,7 @@ class ATagMd extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
if
(
match
?[
1
]
==
null
&&
match
?[
2
]
==
null
)
{
...
...
@@ -873,21 +677,18 @@ class ATagMd extends InlineMd {
baseline:
TextBaseline
.
alphabetic
,
child:
GestureDetector
(
onTap:
()
{
if
(
onLinkTab
==
null
)
{
return
;
}
onLinkTab
(
"
${match?[2]}
"
,
"
${match?[1]}
"
);
config
.
onLinkTab
?.
call
(
"
${match?[2]}
"
,
"
${match?[1]}
"
);
},
child:
Text
.
rich
(
TextSpan
(
text:
"
${match?[1]}
"
,
style:
(
style
??
const
TextStyle
()).
copyWith
(
style:
(
config
.
style
??
const
TextStyle
()).
copyWith
(
color:
Colors
.
blueAccent
,
decorationColor:
Colors
.
blue
,
decoration:
TextDecoration
.
underline
,
),
),
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
),
),
);
...
...
@@ -903,15 +704,7 @@ class ImageMd extends InlineMd {
InlineSpan
span
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
var
match
=
exp
.
firstMatch
(
text
.
trim
());
double
?
height
;
...
...
@@ -959,15 +752,7 @@ class TableMd extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
final
List
<
Map
<
int
,
String
>>
value
=
text
.
split
(
'
\n
'
)
...
...
@@ -990,7 +775,7 @@ class TableMd extends BlockMd {
}
}
if
(
maxCol
==
0
)
{
return
Text
(
""
,
style:
style
);
return
Text
(
""
,
style:
config
.
style
);
}
final
controller
=
ScrollController
();
return
Scrollbar
(
...
...
@@ -999,7 +784,7 @@ class TableMd extends BlockMd {
controller:
controller
,
scrollDirection:
Axis
.
horizontal
,
child:
Table
(
textDirection:
textDirection
,
textDirection:
config
.
textDirection
,
defaultColumnWidth:
CustomTableColumnWidth
(),
defaultVerticalAlignment:
TableCellVerticalAlignment
.
middle
,
border:
TableBorder
.
all
(
...
...
@@ -1036,12 +821,7 @@ class TableMd extends BlockMd {
horizontal:
8
,
vertical:
4
),
child:
MdWidget
(
(
e
[
index
]
??
""
).
trim
(),
textDirection:
textDirection
,
onLinkTab:
onLinkTab
,
style:
style
,
latexWorkaround:
latexWorkaround
,
latexBuilder:
latexBuilder
,
codeBuilder:
codeBuilder
,
config:
config
,
),
),
);
...
...
@@ -1072,23 +852,15 @@ class CodeBlockMd extends BlockMd {
Widget
build
(
BuildContext
context
,
String
text
,
TextStyle
?
style
,
TextDirection
textDirection
,
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
,
final
String
Function
(
String
tex
)?
latexWorkaround
,
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
,
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
,
final
GptMarkdownConfig
config
,
)
{
String
codes
=
exp
.
firstMatch
(
text
)?[
2
]
??
""
;
String
name
=
exp
.
firstMatch
(
text
)?[
1
]
??
""
;
codes
=
codes
.
replaceAll
(
r"```"
,
""
).
trim
();
return
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
codeBuilder
!=
null
?
codeBuilder
(
context
,
name
,
codes
)
child:
config
.
codeBuilder
!=
null
?
config
.
codeBuilder
?.
call
(
context
,
name
,
codes
)
:
CodeField
(
name:
name
,
codes:
codes
),
);
}
...
...
gpt_markdown/lib/md_widget.dart
View file @
3df2c98
import
'dart:math'
;
import
'package:flutter/material.dart'
;
import
'package:gpt_markdown/custom_widgets/markdow_config.dart'
;
import
'package:gpt_markdown/markdown_component.dart'
;
/// It creates a markdown widget closed to each other.
...
...
@@ -8,31 +9,10 @@ class MdWidget extends StatelessWidget {
const
MdWidget
(
this
.
exp
,
{
super
.
key
,
this
.
style
,
this
.
textDirection
=
TextDirection
.
ltr
,
this
.
onLinkTab
,
this
.
textAlign
,
this
.
textScaler
,
this
.
latexWorkaround
,
this
.
latexBuilder
,
this
.
followLinkColor
=
false
,
this
.
codeBuilder
,
this
.
maxLines
,
required
this
.
config
,
});
final
String
exp
;
final
TextDirection
textDirection
;
final
TextStyle
?
style
;
final
TextAlign
?
textAlign
;
final
TextScaler
?
textScaler
;
final
void
Function
(
String
url
,
String
title
)?
onLinkTab
;
final
String
Function
(
String
tex
)?
latexWorkaround
;
final
Widget
Function
(
BuildContext
context
,
String
tex
,
TextStyle
textStyle
,
bool
inline
)?
latexBuilder
;
final
bool
followLinkColor
;
final
Widget
Function
(
BuildContext
context
,
String
name
,
String
code
)?
codeBuilder
;
final
int
?
maxLines
;
final
GptMarkdownConfig
config
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -50,23 +30,19 @@ class MdWidget extends StatelessWidget {
String
body
=
(
match
[
1
]
??
match
[
2
])?.
replaceAll
(
"
\n
"
,
" "
)
??
""
;
return
"
\\
[
$body
\\
]"
;
}),
style
,
textDirection
,
onLinkTab
,
latexWorkaround
,
latexBuilder
,
codeBuilder
,
config
,
),
);
return
Text
.
rich
(
TextSpan
(
children:
list
,
style:
style
?.
copyWith
(),
style:
config
.
style
?.
copyWith
(),
),
textDirection:
textDirection
,
textScaler:
textScaler
,
textAlign:
textAlign
,
maxLines:
maxLines
,
textDirection:
config
.
textDirection
,
textScaler:
config
.
textScaler
,
textAlign:
config
.
textAlign
,
maxLines:
config
.
maxLines
,
overflow:
config
.
overflow
,
);
}
}
...
...
gpt_markdown/pubspec.yaml
View file @
3df2c98
name
:
gpt_markdown
description
:
"
The
purpose
of
this
package
is
to
render
the
response
of
ChatGPT
into
a
Flutter
app."
version
:
0.1.
5
version
:
0.1.
6
homepage
:
https://github.com/saminsohag/flutter_packages/tree/main/gpt_markdown
environment
:
...
...
Please
register
or
login
to post a comment