Showing
9 changed files
with
205 additions
and
0 deletions
tex_text/.gitignore
0 → 100644
1 | +# Miscellaneous | ||
2 | +*.class | ||
3 | +*.log | ||
4 | +*.pyc | ||
5 | +*.swp | ||
6 | +.DS_Store | ||
7 | +.atom/ | ||
8 | +.buildlog/ | ||
9 | +.history | ||
10 | +.svn/ | ||
11 | +migrate_working_dir/ | ||
12 | + | ||
13 | +# IntelliJ related | ||
14 | +*.iml | ||
15 | +*.ipr | ||
16 | +*.iws | ||
17 | +.idea/ | ||
18 | + | ||
19 | +# The .vscode folder contains launch configuration and tasks you configure in | ||
20 | +# VS Code which you may wish to be included in version control, so this line | ||
21 | +# is commented out by default. | ||
22 | +#.vscode/ | ||
23 | + | ||
24 | +# Flutter/Dart/Pub related | ||
25 | +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
26 | +/pubspec.lock | ||
27 | +**/doc/api/ | ||
28 | +.dart_tool/ | ||
29 | +.packages | ||
30 | +build/ |
tex_text/.metadata
0 → 100644
1 | +# This file tracks properties of this Flutter project. | ||
2 | +# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
3 | +# | ||
4 | +# This file should be version controlled and should not be manually edited. | ||
5 | + | ||
6 | +version: | ||
7 | + revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
8 | + channel: stable | ||
9 | + | ||
10 | +project_type: package |
tex_text/CHANGELOG.md
0 → 100644
tex_text/LICENSE
0 → 100644
1 | +TODO: Add your license here. |
tex_text/README.md
0 → 100644
1 | +<!-- | ||
2 | +This README describes the package. If you publish this package to pub.dev, | ||
3 | +this README's contents appear on the landing page for your package. | ||
4 | + | ||
5 | +For information about how to write a good package README, see the guide for | ||
6 | +[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). | ||
7 | + | ||
8 | +For general information about developing packages, see the Dart guide for | ||
9 | +[creating packages](https://dart.dev/guides/libraries/create-library-packages) | ||
10 | +and the Flutter guide for | ||
11 | +[developing packages and plugins](https://flutter.dev/developing-packages). | ||
12 | +--> | ||
13 | + | ||
14 | +TODO: Put a short description of the package here that helps potential users | ||
15 | +know whether this package might be useful for them. | ||
16 | + | ||
17 | +## Features | ||
18 | + | ||
19 | +TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
20 | + | ||
21 | +## Getting started | ||
22 | + | ||
23 | +TODO: List prerequisites and provide or point to information on how to | ||
24 | +start using the package. | ||
25 | + | ||
26 | +## Usage | ||
27 | + | ||
28 | +TODO: Include short and useful examples for package users. Add longer examples | ||
29 | +to `/example` folder. | ||
30 | + | ||
31 | +```dart | ||
32 | +const like = 'sample'; | ||
33 | +``` | ||
34 | + | ||
35 | +## Additional information | ||
36 | + | ||
37 | +TODO: Tell users more about the package: where to find more information, how to | ||
38 | +contribute to the package, how to file issues, what response they can expect | ||
39 | +from the package authors, and more. |
tex_text/analysis_options.yaml
0 → 100644
tex_text/lib/tex_text.dart
0 → 100644
1 | +library tex_text; | ||
2 | + | ||
3 | +import 'package:flutter/material.dart'; | ||
4 | +import 'package:flutter_math_fork/flutter_math.dart'; | ||
5 | + | ||
6 | +/// A Calculator. | ||
7 | +class TexText extends StatelessWidget { | ||
8 | + const TexText(this.text, | ||
9 | + {super.key, this.style, this.mathStyle = MathStyle.display}); | ||
10 | + final String text; | ||
11 | + final TextStyle? style; | ||
12 | + final MathStyle mathStyle; | ||
13 | + | ||
14 | + @override | ||
15 | + Widget build(BuildContext context) { | ||
16 | + return Wrap( | ||
17 | + alignment: WrapAlignment.start, | ||
18 | + spacing: 4, | ||
19 | + children: text | ||
20 | + .split("<m>") | ||
21 | + .asMap() | ||
22 | + .map<int, List<Widget>>( | ||
23 | + (index, e) { | ||
24 | + if (index.isOdd) { | ||
25 | + return MapEntry( | ||
26 | + index, | ||
27 | + [ | ||
28 | + Math.tex( | ||
29 | + e, | ||
30 | + textStyle: style, | ||
31 | + mathStyle: mathStyle, | ||
32 | + ), | ||
33 | + ], | ||
34 | + ); | ||
35 | + } | ||
36 | + return MapEntry( | ||
37 | + index, | ||
38 | + e | ||
39 | + .split(" ") | ||
40 | + .map<Widget>((e) => Text( | ||
41 | + e, | ||
42 | + style: style, | ||
43 | + )) | ||
44 | + .toList(), | ||
45 | + ); | ||
46 | + }, | ||
47 | + ) | ||
48 | + .values | ||
49 | + .toList() | ||
50 | + .expand<Widget>((element) => element) | ||
51 | + .toList(), | ||
52 | + ); | ||
53 | + } | ||
54 | +} |
tex_text/pubspec.yaml
0 → 100644
1 | +name: tex_text | ||
2 | +description: A new Flutter package project. | ||
3 | +version: 0.0.1 | ||
4 | +homepage: | ||
5 | + | ||
6 | +environment: | ||
7 | + sdk: '>=2.18.6 <3.0.0' | ||
8 | + flutter: ">=1.17.0" | ||
9 | + | ||
10 | +dependencies: | ||
11 | + flutter: | ||
12 | + sdk: flutter | ||
13 | + flutter_math_fork: ^0.6.3+1 | ||
14 | + | ||
15 | +dev_dependencies: | ||
16 | + flutter_test: | ||
17 | + sdk: flutter | ||
18 | + flutter_lints: ^2.0.0 | ||
19 | + | ||
20 | +# For information on the generic Dart part of this file, see the | ||
21 | +# following page: https://dart.dev/tools/pub/pubspec | ||
22 | + | ||
23 | +# The following section is specific to Flutter packages. | ||
24 | +flutter: | ||
25 | + | ||
26 | + # To add assets to your package, add an assets section, like this: | ||
27 | + # assets: | ||
28 | + # - images/a_dot_burr.jpeg | ||
29 | + # - images/a_dot_ham.jpeg | ||
30 | + # | ||
31 | + # For details regarding assets in packages, see | ||
32 | + # https://flutter.dev/assets-and-images/#from-packages | ||
33 | + # | ||
34 | + # An image asset can refer to one or more resolution-specific "variants", see | ||
35 | + # https://flutter.dev/assets-and-images/#resolution-aware | ||
36 | + | ||
37 | + # To add custom fonts to your package, add a fonts section here, | ||
38 | + # in this "flutter" section. Each entry in this list should have a | ||
39 | + # "family" key with the font family name, and a "fonts" key with a | ||
40 | + # list giving the asset and other descriptors for the font. For | ||
41 | + # example: | ||
42 | + # fonts: | ||
43 | + # - family: Schyler | ||
44 | + # fonts: | ||
45 | + # - asset: fonts/Schyler-Regular.ttf | ||
46 | + # - asset: fonts/Schyler-Italic.ttf | ||
47 | + # style: italic | ||
48 | + # - family: Trajan Pro | ||
49 | + # fonts: | ||
50 | + # - asset: fonts/TrajanPro.ttf | ||
51 | + # - asset: fonts/TrajanPro_Bold.ttf | ||
52 | + # weight: 700 | ||
53 | + # | ||
54 | + # For details regarding fonts in packages, see | ||
55 | + # https://flutter.dev/custom-fonts/#from-packages |
-
Please register or login to post a comment