Showing
4 changed files
with
138 additions
and
2 deletions
1 | -TODO: Add your license here. | 1 | +MIT License |
2 | + | ||
3 | +Copyright 2022 Samin Sohag | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
6 | + | ||
7 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
8 | + | ||
9 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
tex_text/example/example.md
0 → 100644
1 | +# tex_text_example | ||
2 | + | ||
3 | +Demonstrates how to use the tex_text package. | ||
4 | + | ||
5 | +## Getting Started | ||
6 | + | ||
7 | +Just import the package | ||
8 | +```dart | ||
9 | +import 'package:tex_text/tex_text.dart'; | ||
10 | +``` | ||
11 | +and start using it. | ||
12 | + | ||
13 | + | ||
14 | +```dart | ||
15 | +import 'package:flutter/material.dart'; | ||
16 | +import 'package:tex_text/tex_text.dart'; | ||
17 | + | ||
18 | +void main(List<String> args) { | ||
19 | + runApp(const MyApp()); | ||
20 | +} | ||
21 | + | ||
22 | +class MyApp extends StatefulWidget { | ||
23 | + const MyApp({super.key}); | ||
24 | + | ||
25 | + @override | ||
26 | + State<MyApp> createState() => _MyAppState(); | ||
27 | +} | ||
28 | + | ||
29 | +class _MyAppState extends State<MyApp> { | ||
30 | + final TextEditingController _text = TextEditingController(); | ||
31 | + @override | ||
32 | + Widget build(BuildContext context) { | ||
33 | + return MaterialApp( | ||
34 | + home: Scaffold( | ||
35 | + appBar: AppBar(title: const Text("Tex Text.")), | ||
36 | + body: Padding( | ||
37 | + padding: const EdgeInsets.all(8.0), | ||
38 | + child: Column( | ||
39 | + mainAxisAlignment: MainAxisAlignment.start, | ||
40 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
41 | + children: [ | ||
42 | + AnimatedBuilder( | ||
43 | + animation: _text, | ||
44 | + builder: (context, child) { | ||
45 | + return TexText( | ||
46 | + _text.text, | ||
47 | + style: Theme.of(context) | ||
48 | + .textTheme | ||
49 | + .titleLarge | ||
50 | + ?.copyWith(color: Colors.red), | ||
51 | + mathStyle: MathStyle.text, | ||
52 | + ); | ||
53 | + }), | ||
54 | + const SizedBox( | ||
55 | + height: 100, | ||
56 | + ), | ||
57 | + TextField( | ||
58 | + controller: _text, | ||
59 | + maxLines: null, | ||
60 | + decoration: const InputDecoration( | ||
61 | + border: OutlineInputBorder(), | ||
62 | + ), | ||
63 | + ), | ||
64 | + ], | ||
65 | + ), | ||
66 | + ), | ||
67 | + ), | ||
68 | + ); | ||
69 | + } | ||
70 | +} | ||
71 | + | ||
72 | +``` |
tex_text/example/lib/main.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:tex_text/tex_text.dart'; | ||
3 | + | ||
4 | +void main(List<String> args) { | ||
5 | + runApp(const MyApp()); | ||
6 | +} | ||
7 | + | ||
8 | +class MyApp extends StatefulWidget { | ||
9 | + const MyApp({super.key}); | ||
10 | + | ||
11 | + @override | ||
12 | + State<MyApp> createState() => _MyAppState(); | ||
13 | +} | ||
14 | + | ||
15 | +class _MyAppState extends State<MyApp> { | ||
16 | + final TextEditingController _text = TextEditingController(); | ||
17 | + @override | ||
18 | + Widget build(BuildContext context) { | ||
19 | + return MaterialApp( | ||
20 | + home: Scaffold( | ||
21 | + appBar: AppBar(title: const Text("Tex Text.")), | ||
22 | + body: Padding( | ||
23 | + padding: const EdgeInsets.all(8.0), | ||
24 | + child: Column( | ||
25 | + mainAxisAlignment: MainAxisAlignment.start, | ||
26 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
27 | + children: [ | ||
28 | + AnimatedBuilder( | ||
29 | + animation: _text, | ||
30 | + builder: (context, child) { | ||
31 | + return TexText( | ||
32 | + _text.text, | ||
33 | + style: Theme.of(context) | ||
34 | + .textTheme | ||
35 | + .titleLarge | ||
36 | + ?.copyWith(color: Colors.red), | ||
37 | + mathStyle: MathStyle.text, | ||
38 | + ); | ||
39 | + }), | ||
40 | + const SizedBox( | ||
41 | + height: 100, | ||
42 | + ), | ||
43 | + TextField( | ||
44 | + controller: _text, | ||
45 | + maxLines: null, | ||
46 | + decoration: const InputDecoration( | ||
47 | + border: OutlineInputBorder(), | ||
48 | + ), | ||
49 | + ), | ||
50 | + ], | ||
51 | + ), | ||
52 | + ), | ||
53 | + ), | ||
54 | + ); | ||
55 | + } | ||
56 | +} |
1 | name: tex_text | 1 | name: tex_text |
2 | -description: A flutter package to show the latex 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. |
3 | version: 0.0.1 | 3 | version: 0.0.1 |
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 |
-
Please register or login to post a comment