From 0e2a863a76ecb9951d194fc281fcdd652d1858b4 Mon Sep 17 00:00:00 2001 From: nicolas-ferrada Date: Wed, 6 Dec 2023 15:31:19 -0300 Subject: [PATCH 1/3] feat equation style A TextStyle used to apply styles exclusively to the mathematical equations. --- lib/latext.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/latext.dart b/lib/latext.dart index 2db0b61..746134b 100644 --- a/lib/latext.dart +++ b/lib/latext.dart @@ -16,9 +16,14 @@ class LaTexT extends StatefulWidget { // The delimiter to be used for line breaks. Either \\ or \break. final String breakDelimiter; + // A TextStyle used to apply styles exclusively to the mathematical equations of the laTeXCode. + // If not provided, this variable will be ignored, and the laTeXCode style will be applied. + final TextStyle? equationStyle; + const LaTexT({ super.key, required this.laTeXCode, + this.equationStyle, this.delimiter = r'$', this.displayDelimiter = r'$$', this.breakDelimiter = r'\\', @@ -141,7 +146,9 @@ class LaTexTState extends State { Widget tex = Math.tex( texts[i].trim(), - textStyle: widget.laTeXCode.style, + textStyle: (widget.equationStyle != null) + ? widget.equationStyle + : widget.laTeXCode.style, ); if (align) { From d431767cfc3fd2e0f8fc7893e07d568e7c5c4288 Mon Sep 17 00:00:00 2001 From: nicolas-ferrada Date: Wed, 6 Dec 2023 16:07:03 -0300 Subject: [PATCH 2/3] Fix horizontally overflowing mathematical equations does not include a visual indicator of possible scrolling --- lib/latext.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/latext.dart b/lib/latext.dart index 746134b..362acff 100644 --- a/lib/latext.dart +++ b/lib/latext.dart @@ -144,11 +144,14 @@ class LaTexTState extends State { ); } - Widget tex = Math.tex( - texts[i].trim(), - textStyle: (widget.equationStyle != null) - ? widget.equationStyle - : widget.laTeXCode.style, + Widget tex = SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Math.tex( + texts[i].trim(), + textStyle: (widget.equationStyle != null) + ? widget.equationStyle + : widget.laTeXCode.style, + ), ); if (align) { From 87401b21b3d834699331311b79b96881ca2a2593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ferrada?= <118396552+nicolas-ferrada@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:26:27 -0300 Subject: [PATCH 3/3] refactor: replacing ternary operator with null-aware operator Co-authored-by: Afeez Olajide --- lib/latext.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/latext.dart b/lib/latext.dart index 362acff..b062200 100644 --- a/lib/latext.dart +++ b/lib/latext.dart @@ -148,9 +148,7 @@ class LaTexTState extends State { scrollDirection: Axis.horizontal, child: Math.tex( texts[i].trim(), - textStyle: (widget.equationStyle != null) - ? widget.equationStyle - : widget.laTeXCode.style, + textStyle: widget.equationStyle ?? widget.laTeXCode.style, ), );