saminsohag

new line support added

  1 +## 0.0.4
  2 +
  3 +* New line support added.
  4 +
1 ## 0.0.3 5 ## 0.0.3
2 6
3 * Equation alignment fixed. 7 * Equation alignment fixed.
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
4 import 'package:flutter_math_fork/flutter_math.dart'; 4 import 'package:flutter_math_fork/flutter_math.dart';
5 export 'package:flutter_math_fork/flutter_math.dart'; 5 export 'package:flutter_math_fork/flutter_math.dart';
6 6
7 -/// A Calculator. 7 +/// A LaTex text view.
8 class TexText extends StatelessWidget { 8 class TexText extends StatelessWidget {
9 const TexText(this.text, 9 const TexText(this.text,
10 {super.key, 10 {super.key,
@@ -18,43 +18,50 @@ class TexText extends StatelessWidget { @@ -18,43 +18,50 @@ class TexText extends StatelessWidget {
18 18
19 @override 19 @override
20 Widget build(BuildContext context) { 20 Widget build(BuildContext context) {
21 - return Wrap(  
22 - alignment: alignment,  
23 - crossAxisAlignment: WrapCrossAlignment.center,  
24 - spacing: 4,  
25 - children: text  
26 - .split("<m>")  
27 - .asMap()  
28 - .map<int, List<Widget>>(  
29 - (index, e) {  
30 - if (index.isOdd) {  
31 - return MapEntry(  
32 - index,  
33 - [  
34 - Math.tex(  
35 - e,  
36 - textStyle: style,  
37 - mathStyle: mathStyle,  
38 - ),  
39 - ],  
40 - );  
41 - }  
42 - return MapEntry(  
43 - index,  
44 - e  
45 - .split(" ")  
46 - .map<Widget>((e) => Text( 21 + return Column(
  22 + mainAxisSize: MainAxisSize.min,
  23 + crossAxisAlignment: CrossAxisAlignment.values[alignment.index % 3],
  24 + children: text.split('\n').map<Widget>(
  25 + (e) {
  26 + return Wrap(
  27 + alignment: alignment,
  28 + crossAxisAlignment: WrapCrossAlignment.center,
  29 + spacing: 4,
  30 + children: e
  31 + .split("<m>")
  32 + .asMap()
  33 + .map<int, List<Widget>>(
  34 + (index, e) {
  35 + if (index.isOdd) {
  36 + return MapEntry(
  37 + index,
  38 + [
  39 + Math.tex(
  40 + e,
  41 + textStyle: style,
  42 + mathStyle: mathStyle,
  43 + ),
  44 + ],
  45 + );
  46 + }
  47 + return MapEntry(
  48 + index,
  49 + e.split(" ").map<Widget>((e) {
  50 + return Text(
47 e, 51 e,
48 style: style, 52 style: style,
49 - ))  
50 - .toList(),  
51 - );  
52 - },  
53 - )  
54 - .values  
55 - .toList()  
56 - .expand<Widget>((element) => element)  
57 - .toList(), 53 + );
  54 + }).toList(),
  55 + );
  56 + },
  57 + )
  58 + .values
  59 + .toList()
  60 + .expand<Widget>((element) => element)
  61 + .toList(),
  62 + );
  63 + },
  64 + ).toList(),
58 ); 65 );
59 } 66 }
60 } 67 }
1 name: tex_text 1 name: tex_text
2 description: This package for Flutter allows you to show text on a Flutter app with LaTex math formula and normal text from string. It is vary easy to use and works for all of the platforms. 2 description: This package for Flutter allows you to show text on a Flutter app with LaTex math formula and normal text from string. It is vary easy to use and works for all of the platforms.
3 -version: 0.0.3 3 +version: 0.0.4
4 homepage: https://github.com/saminsohag/flutter_packages/tree/main/tex_text 4 homepage: https://github.com/saminsohag/flutter_packages/tree/main/tex_text
5 5
6 environment: 6 environment: