saminsohag

bug fixed

## 0.1.2
* Bug fixes.
* Shortcut syntax to math added.
## 0.1.1
* Html parser math fixed.
... ...
... ... @@ -56,17 +56,24 @@ class MyHomePage extends StatefulWidget {
}
class _MyHomePageState extends State<MyHomePage> {
final TextEditingController _controller =
TextEditingController(text: '''# hi how are you?
## hi how are you?
final TextEditingController _controller = TextEditingController(text: r'''
# hi how are you?$my is^2$
## hi how are you$(\frac ab)^2$?
### hi how are you?
#### hi how are you?
##### hi how are you?
###### hi how are you?
![100x100](https://image.jpg)
##### hi how are you?$my name is x^2$
###### hi how are you?$x^2$
hello
---
**bold text**
*Italic text*
my name is
![100x100](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png)
**bold$x^2\cfrac a{\cfrac ab}$ text**
*Italic text$x^2\cfrac a{b}$*
**hello**
$hello$
$sdf\frac a{\frac ab}$
$hello$
[Link]()
- unordered list
1. ordered list 1
... ...
... ... @@ -238,15 +238,15 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.1"
version: "0.1.2"
tex_text:
dependency: transitive
description:
name: tex_text
sha256: "33bd11ec8eb58ca9d32919a71629ab80d704405da1a6e03d48ec3f6a266f1267"
sha256: "46942a9587170f5130d2f7110083abd4335b66d763b0cf6a241c80e74826d71d"
url: "https://pub.dev"
source: hosted
version: "0.1.4"
version: "0.1.5"
tuple:
dependency: transitive
description:
... ...
... ... @@ -50,7 +50,10 @@ abstract class MarkdownComponent {
if (each is InlineMd) {
if (spans.isNotEmpty) {
spans.add(
TextSpan(text: " ", style: style),
TextSpan(
text: " ",
style: style,
),
);
}
spans.add(each.inlineSpan(
... ... @@ -83,7 +86,9 @@ abstract class MarkdownComponent {
if (spans.isNotEmpty) {
children.add(
Text.rich(
TextSpan(children: List.from(spans)),
TextSpan(
children: List.from(spans),
),
textAlign: TextAlign.left,
),
);
... ... @@ -168,7 +173,13 @@ class HTag extends BlockMd {
),
],
),
if (match[1]!.length == 1) const Divider(height: 6),
if (match[1]!.length == 1)
Divider(
height: 6,
thickness: 2,
color:
style?.color ?? Theme.of(context).colorScheme.onSurfaceVariant,
),
],
);
}
... ... @@ -190,8 +201,10 @@ class HrLine extends BlockMd {
TextStyle? style,
final void Function(String url, String title)? onLinkTab,
) {
return const Divider(
height: 5,
return Divider(
height: 6,
thickness: 2,
color: style?.color ?? Theme.of(context).colorScheme.onSurfaceVariant,
);
}
... ... @@ -393,6 +406,8 @@ class BoldMd extends InlineMd {
var match = exp.firstMatch(text.trim());
return WidgetSpan(
// text: "${match?[1]}",
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: TexText(
"${match?[1]}",
style: style?.copyWith(fontWeight: FontWeight.bold) ??
... ... @@ -423,6 +438,8 @@ class ItalicMd extends InlineMd {
) {
var match = exp.firstMatch(text.trim());
return WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: TexText(
"${match?[1]}",
style:
... ... @@ -455,6 +472,8 @@ class ATagMd extends InlineMd {
return const TextSpan();
}
return WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: GestureDetector(
onTap: () {
if (onLinkTab == null) {
... ... @@ -502,7 +521,7 @@ class ImageMd extends InlineMd {
height = double.tryParse(size?[2]?.toString().trim() ?? 'a');
}
return WidgetSpan(
// alignment: PlaceholderAlignment.middle,
alignment: PlaceholderAlignment.bottom,
child: SizedBox(
width: width,
height: height,
... ... @@ -526,7 +545,15 @@ class ImageMd extends InlineMd {
@override
String toHtml(String text) {
var match = exp.firstMatch(text.trim());
return '<img src="${match?[2].toString().trim()}">';
double? height;
double? width;
if (match?[1] != null) {
var size = RegExp(r"^([0-9]+)?x?([0-9]+)?")
.firstMatch(match![1].toString().trim());
width = double.tryParse(size?[1]?.toString().trim() ?? 'a');
height = double.tryParse(size?[2]?.toString().trim() ?? 'a');
}
return '<img src="${match?[2].toString().trim()}" height="$height" width="$width">';
}
}
... ...
name: tex_markdown
description: This package is used to create flutter widget that can render markdown and latex formulas. It is very simple to use and uses native flutter components.
version: 0.1.1
version: 0.1.2
homepage: https://github.com/saminsohag/flutter_packages/tree/main/tex_markdown
environment:
... ... @@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
tex_text: ^0.1.4
tex_text: ^0.1.5
dev_dependencies:
flutter_test:
... ...