-
Notifications
You must be signed in to change notification settings - Fork 136
/
tex_view_fonts_example.dart
90 lines (86 loc) · 3.44 KB
/
tex_view_fonts_example.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import 'package:flutter/material.dart';
import 'package:flutter_tex/flutter_tex.dart';
class TeXViewFontsExamples extends StatelessWidget {
const TeXViewFontsExamples(
{super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text("TeXView Fonts"),
),
body: TeXView(
fonts: const [
TeXViewFont(fontFamily: 'army', src: 'fonts/Army.ttf'),
TeXViewFont(fontFamily: 'budhrg', src: 'fonts/Budhrg.ttf'),
TeXViewFont(fontFamily: 'celtg', src: 'fonts/CELTG.ttf'),
TeXViewFont(fontFamily: 'hillock', src: 'fonts/hillock.ttf'),
TeXViewFont(fontFamily: 'intimacy', src: 'fonts/intimacy.ttf'),
TeXViewFont(
fontFamily: 'sansation_light', src: 'fonts/SansationLight.ttf'),
TeXViewFont(fontFamily: 'slenmini', src: 'fonts/slenmini.ttf'),
TeXViewFont(
fontFamily: 'subaccuz_regular',
src: 'fonts/SubaccuzRegular.ttf'),
],
child: TeXViewColumn(children: [
_teXViewWidget("Army", 'army'),
_teXViewWidget("Budhrg", 'budhrg'),
_teXViewWidget("CELTG", 'celtg'),
_teXViewWidget("Hillock", 'hillock'),
_teXViewWidget("intimacy", 'intimacy'),
_teXViewWidget("Sansation Light", 'sansation_light'),
_teXViewWidget("Slenmini", 'slenmini'),
_teXViewWidget("Subaccuz Regular'", 'subaccuz_regular')
]),
style: const TeXViewStyle(
margin: TeXViewMargin.all(10),
elevation: 10,
borderRadius: TeXViewBorderRadius.all(25),
border: TeXViewBorder.all(
TeXViewBorderDecoration(
borderColor: Colors.blue,
borderStyle: TeXViewBorderStyle.solid,
borderWidth: 5),
),
backgroundColor: Colors.white,
),
loadingWidgetBuilder: (context) => const Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(),
Text("Rendering...")
],
),
)),
);
}
static TeXViewWidget _teXViewWidget(String title, String fontFamily) {
return TeXViewColumn(
style: const TeXViewStyle(
margin: TeXViewMargin.all(5),
padding: TeXViewPadding.all(5),
borderRadius: TeXViewBorderRadius.all(10),
border: TeXViewBorder.all(TeXViewBorderDecoration(
borderWidth: 2,
borderStyle: TeXViewBorderStyle.groove,
borderColor: Colors.green))),
children: [
TeXViewDocument(title,
style: TeXViewStyle(
fontStyle: TeXViewFontStyle(
fontSize: 20,
sizeUnit: TeXViewSizeUnit.pt,
fontFamily: fontFamily),
padding: const TeXViewPadding.all(10),
borderRadius: const TeXViewBorderRadius.all(10),
textAlign: TeXViewTextAlign.center,
width: 250,
margin: const TeXViewMargin.zeroAuto())),
]);
}
}