Showing
21 changed files
with
1023 additions
and
54 deletions
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | * Add Page.orientation to force landscape or portrait | 4 | * Add Page.orientation to force landscape or portrait |
5 | * Improve MultiPage Widget | 5 | * Improve MultiPage Widget |
6 | * Convert GridView to a SpanningWidget | 6 | * Convert GridView to a SpanningWidget |
7 | +* Add all Material Colors | ||
7 | 8 | ||
8 | # 1.3.3 | 9 | # 1.3.3 |
9 | * Fix a bug with the RichText Widget | 10 | * Fix a bug with the RichText Widget |
@@ -20,11 +20,11 @@ void main() { | @@ -20,11 +20,11 @@ void main() { | ||
20 | padding: const EdgeInsets.only(bottom: 3.0 * PdfPageFormat.mm), | 20 | padding: const EdgeInsets.only(bottom: 3.0 * PdfPageFormat.mm), |
21 | decoration: const BoxDecoration( | 21 | decoration: const BoxDecoration( |
22 | border: | 22 | border: |
23 | - BoxBorder(bottom: true, width: 0.5, color: PdfColor.grey)), | 23 | + BoxBorder(bottom: true, width: 0.5, color: PdfColors.grey)), |
24 | child: Text('Portable Document Format', | 24 | child: Text('Portable Document Format', |
25 | style: Theme.of(context) | 25 | style: Theme.of(context) |
26 | .defaultTextStyle | 26 | .defaultTextStyle |
27 | - .copyWith(color: PdfColor.grey))); | 27 | + .copyWith(color: PdfColors.grey))); |
28 | }, | 28 | }, |
29 | footer: (Context context) { | 29 | footer: (Context context) { |
30 | return Container( | 30 | return Container( |
@@ -33,7 +33,7 @@ void main() { | @@ -33,7 +33,7 @@ void main() { | ||
33 | child: Text('Page ${context.pageNumber}', | 33 | child: Text('Page ${context.pageNumber}', |
34 | style: Theme.of(context) | 34 | style: Theme.of(context) |
35 | .defaultTextStyle | 35 | .defaultTextStyle |
36 | - .copyWith(color: PdfColor.grey))); | 36 | + .copyWith(color: PdfColors.grey))); |
37 | }, | 37 | }, |
38 | build: (Context context) => <Widget>[ | 38 | build: (Context context) => <Widget>[ |
39 | Header( | 39 | Header( |
@@ -31,6 +31,7 @@ part 'src/ascii85.dart'; | @@ -31,6 +31,7 @@ part 'src/ascii85.dart'; | ||
31 | part 'src/border.dart'; | 31 | part 'src/border.dart'; |
32 | part 'src/catalog.dart'; | 32 | part 'src/catalog.dart'; |
33 | part 'src/color.dart'; | 33 | part 'src/color.dart'; |
34 | +part 'src/colors.dart'; | ||
34 | part 'src/compatibility.dart'; | 35 | part 'src/compatibility.dart'; |
35 | part 'src/document.dart'; | 36 | part 'src/document.dart'; |
36 | part 'src/font.dart'; | 37 | part 'src/font.dart'; |
@@ -26,6 +26,9 @@ class PdfColor { | @@ -26,6 +26,9 @@ class PdfColor { | ||
26 | a = (color >> 24 & 0xff) / 255.0; | 26 | a = (color >> 24 & 0xff) / 255.0; |
27 | 27 | ||
28 | factory PdfColor.fromHex(String color) { | 28 | factory PdfColor.fromHex(String color) { |
29 | + if (color.startsWith('#')) { | ||
30 | + color = color.substring(1); | ||
31 | + } | ||
29 | return PdfColor( | 32 | return PdfColor( |
30 | (int.parse(color.substring(0, 1), radix: 16) >> 16 & 0xff) / 255.0, | 33 | (int.parse(color.substring(0, 1), radix: 16) >> 16 & 0xff) / 255.0, |
31 | (int.parse(color.substring(2, 3), radix: 16) >> 8 & 0xff) / 255.0, | 34 | (int.parse(color.substring(2, 3), radix: 16) >> 8 & 0xff) / 255.0, |
@@ -38,27 +41,48 @@ class PdfColor { | @@ -38,27 +41,48 @@ class PdfColor { | ||
38 | final double g; | 41 | final double g; |
39 | final double b; | 42 | final double b; |
40 | 43 | ||
41 | - static const PdfColor black = PdfColor(0.0, 0.0, 0.0); | ||
42 | - static const PdfColor white = PdfColor(1.0, 1.0, 1.0); | ||
43 | - static const PdfColor red = PdfColor(0.95686, 0.26274, 0.21176); | ||
44 | - static const PdfColor pink = PdfColor(0.91372, 0.11764, 0.38823); | ||
45 | - static const PdfColor purple = PdfColor(0.91372, 0.11764, 0.38823); | ||
46 | - static const PdfColor deepPurple = PdfColor(0.40392, 0.22745, 0.71765); | ||
47 | - static const PdfColor indigo = PdfColor(0.24705, 0.31765, 0.70980); | ||
48 | - static const PdfColor blue = PdfColor(0.12941, 0.58823, 0.95294); | ||
49 | - static const PdfColor lightBlue = PdfColor(0.01176, 0.66274, 0.95686); | ||
50 | - static const PdfColor cyan = PdfColor(0, 0.73725, 0.83137); | ||
51 | - static const PdfColor teal = PdfColor(0, 0.58823, 0.53333); | ||
52 | - static const PdfColor green = PdfColor(0.29803, 0.68627, 0.31372); | ||
53 | - static const PdfColor lightGreen = PdfColor(0.54509, 0.76470, 0.29020); | ||
54 | - static const PdfColor lime = PdfColor(0.80392, 0.86274, 0.22353); | ||
55 | - static const PdfColor yellow = PdfColor(1, 0.92157, 0.23137); | ||
56 | - static const PdfColor amber = PdfColor(1, 0.75686, 0.02745); | ||
57 | - static const PdfColor orange = PdfColor(1, 0.59608, 0); | ||
58 | - static const PdfColor deepOrange = PdfColor(1, 0.34118, 0.13333); | ||
59 | - static const PdfColor brown = PdfColor(0.47451, 0.33333, 0.28235); | ||
60 | - static const PdfColor grey = PdfColor(0.61961, 0.61961, 0.61961); | ||
61 | - static const PdfColor blueGrey = PdfColor(0.37647, 0.49020, 0.54510); | 44 | + @deprecated |
45 | + static const PdfColor black = PdfColors.black; | ||
46 | + @deprecated | ||
47 | + static const PdfColor white = PdfColors.white; | ||
48 | + @deprecated | ||
49 | + static const PdfColor red = PdfColors.red; | ||
50 | + @deprecated | ||
51 | + static const PdfColor pink = PdfColors.pink; | ||
52 | + @deprecated | ||
53 | + static const PdfColor purple = PdfColors.purple; | ||
54 | + @deprecated | ||
55 | + static const PdfColor deepPurple = PdfColors.deepPurple; | ||
56 | + @deprecated | ||
57 | + static const PdfColor indigo = PdfColors.indigo; | ||
58 | + @deprecated | ||
59 | + static const PdfColor blue = PdfColors.blue; | ||
60 | + @deprecated | ||
61 | + static const PdfColor lightBlue = PdfColors.lightBlue; | ||
62 | + @deprecated | ||
63 | + static const PdfColor cyan = PdfColors.cyan; | ||
64 | + @deprecated | ||
65 | + static const PdfColor teal = PdfColors.teal; | ||
66 | + @deprecated | ||
67 | + static const PdfColor green = PdfColors.green; | ||
68 | + @deprecated | ||
69 | + static const PdfColor lightGreen = PdfColors.lightGreen; | ||
70 | + @deprecated | ||
71 | + static const PdfColor lime = PdfColors.lime; | ||
72 | + @deprecated | ||
73 | + static const PdfColor yellow = PdfColors.yellow; | ||
74 | + @deprecated | ||
75 | + static const PdfColor amber = PdfColors.amber; | ||
76 | + @deprecated | ||
77 | + static const PdfColor orange = PdfColors.orange; | ||
78 | + @deprecated | ||
79 | + static const PdfColor deepOrange = PdfColors.deepOrange; | ||
80 | + @deprecated | ||
81 | + static const PdfColor brown = PdfColors.brown; | ||
82 | + @deprecated | ||
83 | + static const PdfColor grey = PdfColors.grey; | ||
84 | + @deprecated | ||
85 | + static const PdfColor blueGrey = PdfColors.blueGrey; | ||
62 | 86 | ||
63 | int toInt() => | 87 | int toInt() => |
64 | ((((a * 255.0).round() & 0xff) << 24) | | 88 | ((((a * 255.0).round() & 0xff) << 24) | |
@@ -67,6 +91,8 @@ class PdfColor { | @@ -67,6 +91,8 @@ class PdfColor { | ||
67 | (((b * 255.0).round() & 0xff) << 0)) & | 91 | (((b * 255.0).round() & 0xff) << 0)) & |
68 | 0xFFFFFFFF; | 92 | 0xFFFFFFFF; |
69 | 93 | ||
94 | + String toHex() => '#' + toInt().toRadixString(16); | ||
95 | + | ||
70 | PdfColorCmyk toCmyk() { | 96 | PdfColorCmyk toCmyk() { |
71 | return PdfColorCmyk.fromRgb(r, g, b, a); | 97 | return PdfColorCmyk.fromRgb(r, g, b, a); |
72 | } | 98 | } |
pdf/lib/src/colors.dart
0 → 100644
1 | +/* | ||
2 | + * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com> | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http: //www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +part of pdf; | ||
18 | + | ||
19 | +class PdfColors { | ||
20 | + PdfColors._(); | ||
21 | + | ||
22 | + // Red | ||
23 | + static const PdfColor red = red500; | ||
24 | + static const PdfColor red50 = PdfColor.fromInt(0xffffebee); | ||
25 | + static const PdfColor red100 = PdfColor.fromInt(0xffffcdd2); | ||
26 | + static const PdfColor red200 = PdfColor.fromInt(0xffef9a9a); | ||
27 | + static const PdfColor red300 = PdfColor.fromInt(0xffe57373); | ||
28 | + static const PdfColor red400 = PdfColor.fromInt(0xffef5350); | ||
29 | + static const PdfColor red500 = PdfColor.fromInt(0xfff44336); | ||
30 | + static const PdfColor red600 = PdfColor.fromInt(0xffe53935); | ||
31 | + static const PdfColor red700 = PdfColor.fromInt(0xffd32f2f); | ||
32 | + static const PdfColor red800 = PdfColor.fromInt(0xffc62828); | ||
33 | + static const PdfColor red900 = PdfColor.fromInt(0xffb71c1c); | ||
34 | + static const PdfColor redAccent = redAccent200; | ||
35 | + static const PdfColor redAccent100 = PdfColor.fromInt(0xffff8a80); | ||
36 | + static const PdfColor redAccent200 = PdfColor.fromInt(0xffff5252); | ||
37 | + static const PdfColor redAccent400 = PdfColor.fromInt(0xffff1744); | ||
38 | + static const PdfColor redAccent700 = PdfColor.fromInt(0xffd50000); | ||
39 | + | ||
40 | + // Pink | ||
41 | + static const PdfColor pink = pink500; | ||
42 | + static const PdfColor pink50 = PdfColor.fromInt(0xfffce4ec); | ||
43 | + static const PdfColor pink100 = PdfColor.fromInt(0xfff8bbd0); | ||
44 | + static const PdfColor pink200 = PdfColor.fromInt(0xfff48fb1); | ||
45 | + static const PdfColor pink300 = PdfColor.fromInt(0xfff06292); | ||
46 | + static const PdfColor pink400 = PdfColor.fromInt(0xffec407a); | ||
47 | + static const PdfColor pink500 = PdfColor.fromInt(0xffe91e63); | ||
48 | + static const PdfColor pink600 = PdfColor.fromInt(0xffd81b60); | ||
49 | + static const PdfColor pink700 = PdfColor.fromInt(0xffc2185b); | ||
50 | + static const PdfColor pink800 = PdfColor.fromInt(0xffad1457); | ||
51 | + static const PdfColor pink900 = PdfColor.fromInt(0xff880e4f); | ||
52 | + static const PdfColor pinkAccent = pinkAccent200; | ||
53 | + static const PdfColor pinkAccent100 = PdfColor.fromInt(0xffff80ab); | ||
54 | + static const PdfColor pinkAccent200 = PdfColor.fromInt(0xffff4081); | ||
55 | + static const PdfColor pinkAccent400 = PdfColor.fromInt(0xfff50057); | ||
56 | + static const PdfColor pinkAccent700 = PdfColor.fromInt(0xffc51162); | ||
57 | + | ||
58 | + // Purple | ||
59 | + static const PdfColor purple = purple500; | ||
60 | + static const PdfColor purple50 = PdfColor.fromInt(0xfff3e5f5); | ||
61 | + static const PdfColor purple100 = PdfColor.fromInt(0xffe1bee7); | ||
62 | + static const PdfColor purple200 = PdfColor.fromInt(0xffce93d8); | ||
63 | + static const PdfColor purple300 = PdfColor.fromInt(0xffba68c8); | ||
64 | + static const PdfColor purple400 = PdfColor.fromInt(0xffab47bc); | ||
65 | + static const PdfColor purple500 = PdfColor.fromInt(0xff9c27b0); | ||
66 | + static const PdfColor purple600 = PdfColor.fromInt(0xff8e24aa); | ||
67 | + static const PdfColor purple700 = PdfColor.fromInt(0xff7b1fa2); | ||
68 | + static const PdfColor purple800 = PdfColor.fromInt(0xff6a1b9a); | ||
69 | + static const PdfColor purple900 = PdfColor.fromInt(0xff4a148c); | ||
70 | + static const PdfColor purpleAccent = purpleAccent200; | ||
71 | + static const PdfColor purpleAccent100 = PdfColor.fromInt(0xffea80fc); | ||
72 | + static const PdfColor purpleAccent200 = PdfColor.fromInt(0xffe040fb); | ||
73 | + static const PdfColor purpleAccent400 = PdfColor.fromInt(0xffd500f9); | ||
74 | + static const PdfColor purpleAccent700 = PdfColor.fromInt(0xffaa00ff); | ||
75 | + | ||
76 | + // Deep Purple | ||
77 | + static const PdfColor deepPurple = deepPurple500; | ||
78 | + static const PdfColor deepPurple50 = PdfColor.fromInt(0xffede7f6); | ||
79 | + static const PdfColor deepPurple100 = PdfColor.fromInt(0xffd1c4e9); | ||
80 | + static const PdfColor deepPurple200 = PdfColor.fromInt(0xffb39ddb); | ||
81 | + static const PdfColor deepPurple300 = PdfColor.fromInt(0xff9575cd); | ||
82 | + static const PdfColor deepPurple400 = PdfColor.fromInt(0xff7e57c2); | ||
83 | + static const PdfColor deepPurple500 = PdfColor.fromInt(0xff673ab7); | ||
84 | + static const PdfColor deepPurple600 = PdfColor.fromInt(0xff5e35b1); | ||
85 | + static const PdfColor deepPurple700 = PdfColor.fromInt(0xff512da8); | ||
86 | + static const PdfColor deepPurple800 = PdfColor.fromInt(0xff4527a0); | ||
87 | + static const PdfColor deepPurple900 = PdfColor.fromInt(0xff311b92); | ||
88 | + static const PdfColor deepPurpleAccent = deepPurpleAccent200; | ||
89 | + static const PdfColor deepPurpleAccent100 = PdfColor.fromInt(0xffb388ff); | ||
90 | + static const PdfColor deepPurpleAccent200 = PdfColor.fromInt(0xff7c4dff); | ||
91 | + static const PdfColor deepPurpleAccent400 = PdfColor.fromInt(0xff651fff); | ||
92 | + static const PdfColor deepPurpleAccent700 = PdfColor.fromInt(0xff6200ea); | ||
93 | + | ||
94 | + // Indigo | ||
95 | + static const PdfColor indigo = indigo500; | ||
96 | + static const PdfColor indigo50 = PdfColor.fromInt(0xffe8eaf6); | ||
97 | + static const PdfColor indigo100 = PdfColor.fromInt(0xffc5cae9); | ||
98 | + static const PdfColor indigo200 = PdfColor.fromInt(0xff9fa8da); | ||
99 | + static const PdfColor indigo300 = PdfColor.fromInt(0xff7986cb); | ||
100 | + static const PdfColor indigo400 = PdfColor.fromInt(0xff5c6bc0); | ||
101 | + static const PdfColor indigo500 = PdfColor.fromInt(0xff3f51b5); | ||
102 | + static const PdfColor indigo600 = PdfColor.fromInt(0xff3949ab); | ||
103 | + static const PdfColor indigo700 = PdfColor.fromInt(0xff303f9f); | ||
104 | + static const PdfColor indigo800 = PdfColor.fromInt(0xff283593); | ||
105 | + static const PdfColor indigo900 = PdfColor.fromInt(0xff1a237e); | ||
106 | + static const PdfColor indigoAccent = indigoAccent200; | ||
107 | + static const PdfColor indigoAccent100 = PdfColor.fromInt(0xff8c9eff); | ||
108 | + static const PdfColor indigoAccent200 = PdfColor.fromInt(0xff536dfe); | ||
109 | + static const PdfColor indigoAccent400 = PdfColor.fromInt(0xff3d5afe); | ||
110 | + static const PdfColor indigoAccent700 = PdfColor.fromInt(0xff304ffe); | ||
111 | + | ||
112 | + // Blue | ||
113 | + static const PdfColor blue = blue500; | ||
114 | + static const PdfColor blue50 = PdfColor.fromInt(0xffe3f2fd); | ||
115 | + static const PdfColor blue100 = PdfColor.fromInt(0xffbbdefb); | ||
116 | + static const PdfColor blue200 = PdfColor.fromInt(0xff90caf9); | ||
117 | + static const PdfColor blue300 = PdfColor.fromInt(0xff64b5f6); | ||
118 | + static const PdfColor blue400 = PdfColor.fromInt(0xff42a5f5); | ||
119 | + static const PdfColor blue500 = PdfColor.fromInt(0xff2196f3); | ||
120 | + static const PdfColor blue600 = PdfColor.fromInt(0xff1e88e5); | ||
121 | + static const PdfColor blue700 = PdfColor.fromInt(0xff1976d2); | ||
122 | + static const PdfColor blue800 = PdfColor.fromInt(0xff1565c0); | ||
123 | + static const PdfColor blue900 = PdfColor.fromInt(0xff0d47a1); | ||
124 | + static const PdfColor blueAccent = blueAccent200; | ||
125 | + static const PdfColor blueAccent100 = PdfColor.fromInt(0xff82b1ff); | ||
126 | + static const PdfColor blueAccent200 = PdfColor.fromInt(0xff448aff); | ||
127 | + static const PdfColor blueAccent400 = PdfColor.fromInt(0xff2979ff); | ||
128 | + static const PdfColor blueAccent700 = PdfColor.fromInt(0xff2962ff); | ||
129 | + | ||
130 | + // Light Blue | ||
131 | + static const PdfColor lightBlue = lightBlue500; | ||
132 | + static const PdfColor lightBlue50 = PdfColor.fromInt(0xffe1f5fe); | ||
133 | + static const PdfColor lightBlue100 = PdfColor.fromInt(0xffb3e5fc); | ||
134 | + static const PdfColor lightBlue200 = PdfColor.fromInt(0xff81d4fa); | ||
135 | + static const PdfColor lightBlue300 = PdfColor.fromInt(0xff4fc3f7); | ||
136 | + static const PdfColor lightBlue400 = PdfColor.fromInt(0xff29b6f6); | ||
137 | + static const PdfColor lightBlue500 = PdfColor.fromInt(0xff03a9f4); | ||
138 | + static const PdfColor lightBlue600 = PdfColor.fromInt(0xff039be5); | ||
139 | + static const PdfColor lightBlue700 = PdfColor.fromInt(0xff0288d1); | ||
140 | + static const PdfColor lightBlue800 = PdfColor.fromInt(0xff0277bd); | ||
141 | + static const PdfColor lightBlue900 = PdfColor.fromInt(0xff01579b); | ||
142 | + static const PdfColor lightBlueAccent = lightBlueAccent200; | ||
143 | + static const PdfColor lightBlueAccent100 = PdfColor.fromInt(0xff80d8ff); | ||
144 | + static const PdfColor lightBlueAccent200 = PdfColor.fromInt(0xff40c4ff); | ||
145 | + static const PdfColor lightBlueAccent400 = PdfColor.fromInt(0xff00b0ff); | ||
146 | + static const PdfColor lightBlueAccent700 = PdfColor.fromInt(0xff0091ea); | ||
147 | + | ||
148 | + // Cyan | ||
149 | + static const PdfColor cyan = cyan500; | ||
150 | + static const PdfColor cyan50 = PdfColor.fromInt(0xffe0f7fa); | ||
151 | + static const PdfColor cyan100 = PdfColor.fromInt(0xffb2ebf2); | ||
152 | + static const PdfColor cyan200 = PdfColor.fromInt(0xff80deea); | ||
153 | + static const PdfColor cyan300 = PdfColor.fromInt(0xff4dd0e1); | ||
154 | + static const PdfColor cyan400 = PdfColor.fromInt(0xff26c6da); | ||
155 | + static const PdfColor cyan500 = PdfColor.fromInt(0xff00bcd4); | ||
156 | + static const PdfColor cyan600 = PdfColor.fromInt(0xff00acc1); | ||
157 | + static const PdfColor cyan700 = PdfColor.fromInt(0xff0097a7); | ||
158 | + static const PdfColor cyan800 = PdfColor.fromInt(0xff00838f); | ||
159 | + static const PdfColor cyan900 = PdfColor.fromInt(0xff006064); | ||
160 | + static const PdfColor cyanAccent = cyanAccent200; | ||
161 | + static const PdfColor cyanAccent100 = PdfColor.fromInt(0xff84ffff); | ||
162 | + static const PdfColor cyanAccent200 = PdfColor.fromInt(0xff18ffff); | ||
163 | + static const PdfColor cyanAccent400 = PdfColor.fromInt(0xff00e5ff); | ||
164 | + static const PdfColor cyanAccent700 = PdfColor.fromInt(0xff00b8d4); | ||
165 | + | ||
166 | + // Teal | ||
167 | + static const PdfColor teal = teal500; | ||
168 | + static const PdfColor teal50 = PdfColor.fromInt(0xffe0f2f1); | ||
169 | + static const PdfColor teal100 = PdfColor.fromInt(0xffb2dfdb); | ||
170 | + static const PdfColor teal200 = PdfColor.fromInt(0xff80cbc4); | ||
171 | + static const PdfColor teal300 = PdfColor.fromInt(0xff4db6ac); | ||
172 | + static const PdfColor teal400 = PdfColor.fromInt(0xff26a69a); | ||
173 | + static const PdfColor teal500 = PdfColor.fromInt(0xff009688); | ||
174 | + static const PdfColor teal600 = PdfColor.fromInt(0xff00897b); | ||
175 | + static const PdfColor teal700 = PdfColor.fromInt(0xff00796b); | ||
176 | + static const PdfColor teal800 = PdfColor.fromInt(0xff00695c); | ||
177 | + static const PdfColor teal900 = PdfColor.fromInt(0xff004d40); | ||
178 | + static const PdfColor tealAccent = tealAccent200; | ||
179 | + static const PdfColor tealAccent100 = PdfColor.fromInt(0xffa7ffeb); | ||
180 | + static const PdfColor tealAccent200 = PdfColor.fromInt(0xff64ffda); | ||
181 | + static const PdfColor tealAccent400 = PdfColor.fromInt(0xff1de9b6); | ||
182 | + static const PdfColor tealAccent700 = PdfColor.fromInt(0xff00bfa5); | ||
183 | + | ||
184 | + // Green | ||
185 | + static const PdfColor green = green500; | ||
186 | + static const PdfColor green50 = PdfColor.fromInt(0xffe8f5e9); | ||
187 | + static const PdfColor green100 = PdfColor.fromInt(0xffc8e6c9); | ||
188 | + static const PdfColor green200 = PdfColor.fromInt(0xffa5d6a7); | ||
189 | + static const PdfColor green300 = PdfColor.fromInt(0xff81c784); | ||
190 | + static const PdfColor green400 = PdfColor.fromInt(0xff66bb6a); | ||
191 | + static const PdfColor green500 = PdfColor.fromInt(0xff4caf50); | ||
192 | + static const PdfColor green600 = PdfColor.fromInt(0xff43a047); | ||
193 | + static const PdfColor green700 = PdfColor.fromInt(0xff388e3c); | ||
194 | + static const PdfColor green800 = PdfColor.fromInt(0xff2e7d32); | ||
195 | + static const PdfColor green900 = PdfColor.fromInt(0xff1b5e20); | ||
196 | + static const PdfColor greenAccent = greenAccent200; | ||
197 | + static const PdfColor greenAccent100 = PdfColor.fromInt(0xffb9f6ca); | ||
198 | + static const PdfColor greenAccent200 = PdfColor.fromInt(0xff69f0ae); | ||
199 | + static const PdfColor greenAccent400 = PdfColor.fromInt(0xff00e676); | ||
200 | + static const PdfColor greenAccent700 = PdfColor.fromInt(0xff00c853); | ||
201 | + | ||
202 | + // Light Green | ||
203 | + static const PdfColor lightGreen = lightGreen500; | ||
204 | + static const PdfColor lightGreen50 = PdfColor.fromInt(0xfff1f8e9); | ||
205 | + static const PdfColor lightGreen100 = PdfColor.fromInt(0xffdcedc8); | ||
206 | + static const PdfColor lightGreen200 = PdfColor.fromInt(0xffc5e1a5); | ||
207 | + static const PdfColor lightGreen300 = PdfColor.fromInt(0xffaed581); | ||
208 | + static const PdfColor lightGreen400 = PdfColor.fromInt(0xff9ccc65); | ||
209 | + static const PdfColor lightGreen500 = PdfColor.fromInt(0xff8bc34a); | ||
210 | + static const PdfColor lightGreen600 = PdfColor.fromInt(0xff7cb342); | ||
211 | + static const PdfColor lightGreen700 = PdfColor.fromInt(0xff689f38); | ||
212 | + static const PdfColor lightGreen800 = PdfColor.fromInt(0xff558b2f); | ||
213 | + static const PdfColor lightGreen900 = PdfColor.fromInt(0xff33691e); | ||
214 | + static const PdfColor lightGreenAccent = lightGreenAccent200; | ||
215 | + static const PdfColor lightGreenAccent100 = PdfColor.fromInt(0xffccff90); | ||
216 | + static const PdfColor lightGreenAccent200 = PdfColor.fromInt(0xffb2ff59); | ||
217 | + static const PdfColor lightGreenAccent400 = PdfColor.fromInt(0xff76ff03); | ||
218 | + static const PdfColor lightGreenAccent700 = PdfColor.fromInt(0xff64dd17); | ||
219 | + | ||
220 | + // Lime | ||
221 | + static const PdfColor lime = lime500; | ||
222 | + static const PdfColor lime50 = PdfColor.fromInt(0xfff9fbe7); | ||
223 | + static const PdfColor lime100 = PdfColor.fromInt(0xfff0f4c3); | ||
224 | + static const PdfColor lime200 = PdfColor.fromInt(0xffe6ee9c); | ||
225 | + static const PdfColor lime300 = PdfColor.fromInt(0xffdce775); | ||
226 | + static const PdfColor lime400 = PdfColor.fromInt(0xffd4e157); | ||
227 | + static const PdfColor lime500 = PdfColor.fromInt(0xffcddc39); | ||
228 | + static const PdfColor lime600 = PdfColor.fromInt(0xffc0ca33); | ||
229 | + static const PdfColor lime700 = PdfColor.fromInt(0xffafb42b); | ||
230 | + static const PdfColor lime800 = PdfColor.fromInt(0xff9e9d24); | ||
231 | + static const PdfColor lime900 = PdfColor.fromInt(0xff827717); | ||
232 | + static const PdfColor limeAccent = limeAccent200; | ||
233 | + static const PdfColor limeAccent100 = PdfColor.fromInt(0xfff4ff81); | ||
234 | + static const PdfColor limeAccent200 = PdfColor.fromInt(0xffeeff41); | ||
235 | + static const PdfColor limeAccent400 = PdfColor.fromInt(0xffc6ff00); | ||
236 | + static const PdfColor limeAccent700 = PdfColor.fromInt(0xffaeea00); | ||
237 | + | ||
238 | + // Yellow | ||
239 | + static const PdfColor yellow = yellow500; | ||
240 | + static const PdfColor yellow50 = PdfColor.fromInt(0xfffffde7); | ||
241 | + static const PdfColor yellow100 = PdfColor.fromInt(0xfffff9c4); | ||
242 | + static const PdfColor yellow200 = PdfColor.fromInt(0xfffff59d); | ||
243 | + static const PdfColor yellow300 = PdfColor.fromInt(0xfffff176); | ||
244 | + static const PdfColor yellow400 = PdfColor.fromInt(0xffffee58); | ||
245 | + static const PdfColor yellow500 = PdfColor.fromInt(0xffffeb3b); | ||
246 | + static const PdfColor yellow600 = PdfColor.fromInt(0xfffdd835); | ||
247 | + static const PdfColor yellow700 = PdfColor.fromInt(0xfffbc02d); | ||
248 | + static const PdfColor yellow800 = PdfColor.fromInt(0xfff9a825); | ||
249 | + static const PdfColor yellow900 = PdfColor.fromInt(0xfff57f17); | ||
250 | + static const PdfColor yellowAccent = yellowAccent200; | ||
251 | + static const PdfColor yellowAccent100 = PdfColor.fromInt(0xffffff8d); | ||
252 | + static const PdfColor yellowAccent200 = PdfColor.fromInt(0xffffff00); | ||
253 | + static const PdfColor yellowAccent400 = PdfColor.fromInt(0xffffea00); | ||
254 | + static const PdfColor yellowAccent700 = PdfColor.fromInt(0xffffd600); | ||
255 | + | ||
256 | + // Amber | ||
257 | + static const PdfColor amber = amber500; | ||
258 | + static const PdfColor amber50 = PdfColor.fromInt(0xfffff8e1); | ||
259 | + static const PdfColor amber100 = PdfColor.fromInt(0xffffecb3); | ||
260 | + static const PdfColor amber200 = PdfColor.fromInt(0xffffe082); | ||
261 | + static const PdfColor amber300 = PdfColor.fromInt(0xffffd54f); | ||
262 | + static const PdfColor amber400 = PdfColor.fromInt(0xffffca28); | ||
263 | + static const PdfColor amber500 = PdfColor.fromInt(0xffffc107); | ||
264 | + static const PdfColor amber600 = PdfColor.fromInt(0xffffb300); | ||
265 | + static const PdfColor amber700 = PdfColor.fromInt(0xffffa000); | ||
266 | + static const PdfColor amber800 = PdfColor.fromInt(0xffff8f00); | ||
267 | + static const PdfColor amber900 = PdfColor.fromInt(0xffff6f00); | ||
268 | + static const PdfColor amberAccent = amberAccent200; | ||
269 | + static const PdfColor amberAccent100 = PdfColor.fromInt(0xffffe57f); | ||
270 | + static const PdfColor amberAccent200 = PdfColor.fromInt(0xffffd740); | ||
271 | + static const PdfColor amberAccent400 = PdfColor.fromInt(0xffffc400); | ||
272 | + static const PdfColor amberAccent700 = PdfColor.fromInt(0xffffab00); | ||
273 | + | ||
274 | + // Orange | ||
275 | + static const PdfColor orange = orange500; | ||
276 | + static const PdfColor orange50 = PdfColor.fromInt(0xfffff3e0); | ||
277 | + static const PdfColor orange100 = PdfColor.fromInt(0xffffe0b2); | ||
278 | + static const PdfColor orange200 = PdfColor.fromInt(0xffffcc80); | ||
279 | + static const PdfColor orange300 = PdfColor.fromInt(0xffffb74d); | ||
280 | + static const PdfColor orange400 = PdfColor.fromInt(0xffffa726); | ||
281 | + static const PdfColor orange500 = PdfColor.fromInt(0xffff9800); | ||
282 | + static const PdfColor orange600 = PdfColor.fromInt(0xfffb8c00); | ||
283 | + static const PdfColor orange700 = PdfColor.fromInt(0xfff57c00); | ||
284 | + static const PdfColor orange800 = PdfColor.fromInt(0xffef6c00); | ||
285 | + static const PdfColor orange900 = PdfColor.fromInt(0xffe65100); | ||
286 | + static const PdfColor orangeAccent = orangeAccent200; | ||
287 | + static const PdfColor orangeAccent100 = PdfColor.fromInt(0xffffd180); | ||
288 | + static const PdfColor orangeAccent200 = PdfColor.fromInt(0xffffab40); | ||
289 | + static const PdfColor orangeAccent400 = PdfColor.fromInt(0xffff9100); | ||
290 | + static const PdfColor orangeAccent700 = PdfColor.fromInt(0xffff6d00); | ||
291 | + | ||
292 | + // Deep Orange | ||
293 | + static const PdfColor deepOrange = deepOrange500; | ||
294 | + static const PdfColor deepOrange50 = PdfColor.fromInt(0xfffbe9e7); | ||
295 | + static const PdfColor deepOrange100 = PdfColor.fromInt(0xffffccbc); | ||
296 | + static const PdfColor deepOrange200 = PdfColor.fromInt(0xffffab91); | ||
297 | + static const PdfColor deepOrange300 = PdfColor.fromInt(0xffff8a65); | ||
298 | + static const PdfColor deepOrange400 = PdfColor.fromInt(0xffff7043); | ||
299 | + static const PdfColor deepOrange500 = PdfColor.fromInt(0xffff5722); | ||
300 | + static const PdfColor deepOrange600 = PdfColor.fromInt(0xfff4511e); | ||
301 | + static const PdfColor deepOrange700 = PdfColor.fromInt(0xffe64a19); | ||
302 | + static const PdfColor deepOrange800 = PdfColor.fromInt(0xffd84315); | ||
303 | + static const PdfColor deepOrange900 = PdfColor.fromInt(0xffbf360c); | ||
304 | + static const PdfColor deepOrangeAccent = deepOrangeAccent200; | ||
305 | + static const PdfColor deepOrangeAccent100 = PdfColor.fromInt(0xffff9e80); | ||
306 | + static const PdfColor deepOrangeAccent200 = PdfColor.fromInt(0xffff6e40); | ||
307 | + static const PdfColor deepOrangeAccent400 = PdfColor.fromInt(0xffff3d00); | ||
308 | + static const PdfColor deepOrangeAccent700 = PdfColor.fromInt(0xffdd2c00); | ||
309 | + | ||
310 | + // Brown | ||
311 | + static const PdfColor brown = brown500; | ||
312 | + static const PdfColor brown50 = PdfColor.fromInt(0xffefebe9); | ||
313 | + static const PdfColor brown100 = PdfColor.fromInt(0xffd7ccc8); | ||
314 | + static const PdfColor brown200 = PdfColor.fromInt(0xffbcaaa4); | ||
315 | + static const PdfColor brown300 = PdfColor.fromInt(0xffa1887f); | ||
316 | + static const PdfColor brown400 = PdfColor.fromInt(0xff8d6e63); | ||
317 | + static const PdfColor brown500 = PdfColor.fromInt(0xff795548); | ||
318 | + static const PdfColor brown600 = PdfColor.fromInt(0xff6d4c41); | ||
319 | + static const PdfColor brown700 = PdfColor.fromInt(0xff5d4037); | ||
320 | + static const PdfColor brown800 = PdfColor.fromInt(0xff4e342e); | ||
321 | + static const PdfColor brown900 = PdfColor.fromInt(0xff3e2723); | ||
322 | + | ||
323 | + // Grey | ||
324 | + static const PdfColor grey = grey500; | ||
325 | + static const PdfColor grey50 = PdfColor.fromInt(0xfffafafa); | ||
326 | + static const PdfColor grey100 = PdfColor.fromInt(0xfff5f5f5); | ||
327 | + static const PdfColor grey200 = PdfColor.fromInt(0xffeeeeee); | ||
328 | + static const PdfColor grey300 = PdfColor.fromInt(0xffe0e0e0); | ||
329 | + static const PdfColor grey400 = PdfColor.fromInt(0xffbdbdbd); | ||
330 | + static const PdfColor grey500 = PdfColor.fromInt(0xff9e9e9e); | ||
331 | + static const PdfColor grey600 = PdfColor.fromInt(0xff757575); | ||
332 | + static const PdfColor grey700 = PdfColor.fromInt(0xff616161); | ||
333 | + static const PdfColor grey800 = PdfColor.fromInt(0xff424242); | ||
334 | + static const PdfColor grey900 = PdfColor.fromInt(0xff212121); | ||
335 | + | ||
336 | + // Blue Grey | ||
337 | + static const PdfColor blueGrey = blueGrey500; | ||
338 | + static const PdfColor blueGrey50 = PdfColor.fromInt(0xffeceff1); | ||
339 | + static const PdfColor blueGrey100 = PdfColor.fromInt(0xffcfd8dc); | ||
340 | + static const PdfColor blueGrey200 = PdfColor.fromInt(0xffb0bec5); | ||
341 | + static const PdfColor blueGrey300 = PdfColor.fromInt(0xff90a4ae); | ||
342 | + static const PdfColor blueGrey400 = PdfColor.fromInt(0xff78909c); | ||
343 | + static const PdfColor blueGrey500 = PdfColor.fromInt(0xff607d8b); | ||
344 | + static const PdfColor blueGrey600 = PdfColor.fromInt(0xff546e7a); | ||
345 | + static const PdfColor blueGrey700 = PdfColor.fromInt(0xff455a64); | ||
346 | + static const PdfColor blueGrey800 = PdfColor.fromInt(0xff37474f); | ||
347 | + static const PdfColor blueGrey900 = PdfColor.fromInt(0xff263238); | ||
348 | + | ||
349 | + // White / Black | ||
350 | + static const PdfColor white = PdfColor.fromInt(0xffffffff); | ||
351 | + static const PdfColor black = PdfColor.fromInt(0xff000000); | ||
352 | + | ||
353 | + /// The material design primary color swatches, excluding grey. | ||
354 | + static const List<PdfColor> primaries = <PdfColor>[ | ||
355 | + red, | ||
356 | + pink, | ||
357 | + purple, | ||
358 | + deepPurple, | ||
359 | + indigo, | ||
360 | + blue, | ||
361 | + lightBlue, | ||
362 | + cyan, | ||
363 | + teal, | ||
364 | + green, | ||
365 | + lightGreen, | ||
366 | + lime, | ||
367 | + yellow, | ||
368 | + amber, | ||
369 | + orange, | ||
370 | + deepOrange, | ||
371 | + brown, | ||
372 | + grey, | ||
373 | + blueGrey, | ||
374 | + ]; | ||
375 | + | ||
376 | + /// The material design accent color swatches. | ||
377 | + static const List<PdfColor> accents = <PdfColor>[ | ||
378 | + redAccent, | ||
379 | + pinkAccent, | ||
380 | + purpleAccent, | ||
381 | + deepPurpleAccent, | ||
382 | + indigoAccent, | ||
383 | + blueAccent, | ||
384 | + lightBlueAccent, | ||
385 | + cyanAccent, | ||
386 | + tealAccent, | ||
387 | + greenAccent, | ||
388 | + lightGreenAccent, | ||
389 | + limeAccent, | ||
390 | + yellowAccent, | ||
391 | + amberAccent, | ||
392 | + orangeAccent, | ||
393 | + deepOrangeAccent, | ||
394 | + ]; | ||
395 | +} |
@@ -87,7 +87,7 @@ class Padding extends SingleChildWidget { | @@ -87,7 +87,7 @@ class Padding extends SingleChildWidget { | ||
87 | @override | 87 | @override |
88 | void debugPaint(Context context) { | 88 | void debugPaint(Context context) { |
89 | context.canvas | 89 | context.canvas |
90 | - ..setFillColor(PdfColor.lime) | 90 | + ..setFillColor(PdfColors.lime) |
91 | ..moveTo(box.x, box.y) | 91 | ..moveTo(box.x, box.y) |
92 | ..lineTo(box.right, box.y) | 92 | ..lineTo(box.right, box.y) |
93 | ..lineTo(box.right, box.top) | 93 | ..lineTo(box.right, box.top) |
@@ -22,7 +22,7 @@ class ClipRect extends SingleChildWidget { | @@ -22,7 +22,7 @@ class ClipRect extends SingleChildWidget { | ||
22 | @override | 22 | @override |
23 | void debugPaint(Context context) { | 23 | void debugPaint(Context context) { |
24 | context.canvas | 24 | context.canvas |
25 | - ..setStrokeColor(PdfColor.deepPurple) | 25 | + ..setStrokeColor(PdfColors.deepPurple) |
26 | ..drawRect(box.x, box.y, box.width, box.height) | 26 | ..drawRect(box.x, box.y, box.width, box.height) |
27 | ..strokePath(); | 27 | ..strokePath(); |
28 | } | 28 | } |
@@ -63,7 +63,7 @@ class ClipRRect extends SingleChildWidget { | @@ -63,7 +63,7 @@ class ClipRRect extends SingleChildWidget { | ||
63 | @override | 63 | @override |
64 | void debugPaint(Context context) { | 64 | void debugPaint(Context context) { |
65 | context.canvas | 65 | context.canvas |
66 | - ..setStrokeColor(PdfColor.deepPurple) | 66 | + ..setStrokeColor(PdfColors.deepPurple) |
67 | ..drawRRect( | 67 | ..drawRRect( |
68 | box.x, box.y, box.width, box.height, horizontalRadius, verticalRadius) | 68 | box.x, box.y, box.width, box.height, horizontalRadius, verticalRadius) |
69 | ..strokePath(); | 69 | ..strokePath(); |
@@ -102,7 +102,7 @@ class ClipOval extends SingleChildWidget { | @@ -102,7 +102,7 @@ class ClipOval extends SingleChildWidget { | ||
102 | final double ry = box.height / 2.0; | 102 | final double ry = box.height / 2.0; |
103 | 103 | ||
104 | context.canvas | 104 | context.canvas |
105 | - ..setStrokeColor(PdfColor.deepPurple) | 105 | + ..setStrokeColor(PdfColors.deepPurple) |
106 | ..drawEllipse(box.x + rx, box.y + ry, rx, ry) | 106 | ..drawEllipse(box.x + rx, box.y + ry, rx, ry) |
107 | ..strokePath(); | 107 | ..strokePath(); |
108 | } | 108 | } |
@@ -25,7 +25,7 @@ class BoxBorder { | @@ -25,7 +25,7 @@ class BoxBorder { | ||
25 | this.top = false, | 25 | this.top = false, |
26 | this.right = false, | 26 | this.right = false, |
27 | this.bottom = false, | 27 | this.bottom = false, |
28 | - this.color = PdfColor.black, | 28 | + this.color = PdfColors.black, |
29 | this.width = 1.0}) | 29 | this.width = 1.0}) |
30 | : assert(color != null), | 30 | : assert(color != null), |
31 | assert(width != null), | 31 | assert(width != null), |
@@ -139,7 +139,7 @@ class Bullet extends StatelessWidget { | @@ -139,7 +139,7 @@ class Bullet extends StatelessWidget { | ||
139 | right: 2.0 * PdfPageFormat.mm, | 139 | right: 2.0 * PdfPageFormat.mm, |
140 | ), | 140 | ), |
141 | this.bulletShape = BoxShape.circle, | 141 | this.bulletShape = BoxShape.circle, |
142 | - this.bulletColor = PdfColor.black}); | 142 | + this.bulletColor = PdfColors.black}); |
143 | 143 | ||
144 | final String text; | 144 | final String text; |
145 | 145 |
@@ -105,7 +105,7 @@ class Page { | @@ -105,7 +105,7 @@ class Page { | ||
105 | void debugPaint(Context context) { | 105 | void debugPaint(Context context) { |
106 | final EdgeInsets _margin = margin; | 106 | final EdgeInsets _margin = margin; |
107 | context.canvas | 107 | context.canvas |
108 | - ..setFillColor(PdfColor.lightGreen) | 108 | + ..setFillColor(PdfColors.lightGreen) |
109 | ..moveTo(0, 0) | 109 | ..moveTo(0, 0) |
110 | ..lineTo(pageFormat.width, 0) | 110 | ..lineTo(pageFormat.width, 0) |
111 | ..lineTo(pageFormat.width, pageFormat.height) | 111 | ..lineTo(pageFormat.width, pageFormat.height) |
@@ -207,7 +207,7 @@ class GridView extends MultiChildWidget implements SpanningWidget { | @@ -207,7 +207,7 @@ class GridView extends MultiChildWidget implements SpanningWidget { | ||
207 | super.debugPaint(context); | 207 | super.debugPaint(context); |
208 | 208 | ||
209 | context.canvas | 209 | context.canvas |
210 | - ..setFillColor(PdfColor.lime) | 210 | + ..setFillColor(PdfColors.lime) |
211 | ..moveTo(box.left, box.bottom) | 211 | ..moveTo(box.left, box.bottom) |
212 | ..lineTo(box.right, box.bottom) | 212 | ..lineTo(box.right, box.bottom) |
213 | ..lineTo(box.right, box.top) | 213 | ..lineTo(box.right, box.top) |
@@ -61,7 +61,7 @@ class Placeholder extends Widget { | @@ -61,7 +61,7 @@ class Placeholder extends Widget { | ||
61 | } | 61 | } |
62 | 62 | ||
63 | class PdfLogo extends StatelessWidget { | 63 | class PdfLogo extends StatelessWidget { |
64 | - PdfLogo({this.color = PdfColor.red, this.fit = BoxFit.contain}); | 64 | + PdfLogo({this.color = PdfColors.red, this.fit = BoxFit.contain}); |
65 | 65 | ||
66 | final PdfColor color; | 66 | final PdfColor color; |
67 | final BoxFit fit; | 67 | final BoxFit fit; |
@@ -40,7 +40,7 @@ class TableBorder extends BoxBorder { | @@ -40,7 +40,7 @@ class TableBorder extends BoxBorder { | ||
40 | bool bottom = true, | 40 | bool bottom = true, |
41 | this.horizontalInside = true, | 41 | this.horizontalInside = true, |
42 | this.verticalInside = true, | 42 | this.verticalInside = true, |
43 | - PdfColor color = PdfColor.black, | 43 | + PdfColor color = PdfColors.black, |
44 | double width = 1.0}) | 44 | double width = 1.0}) |
45 | : super( | 45 | : super( |
46 | left: left, | 46 | left: left, |
@@ -40,14 +40,14 @@ class _Word { | @@ -40,14 +40,14 @@ class _Word { | ||
40 | context.canvas | 40 | context.canvas |
41 | ..drawRect(globalBox.x + offset.x + metrics.left, | 41 | ..drawRect(globalBox.x + offset.x + metrics.left, |
42 | globalBox.top + offset.y + metrics.top, metrics.width, metrics.height) | 42 | globalBox.top + offset.y + metrics.top, metrics.width, metrics.height) |
43 | - ..setStrokeColor(PdfColor.orange) | 43 | + ..setStrokeColor(PdfColors.orange) |
44 | ..strokePath() | 44 | ..strokePath() |
45 | ..drawLine( | 45 | ..drawLine( |
46 | globalBox.x + offset.x - deb, | 46 | globalBox.x + offset.x - deb, |
47 | globalBox.top + offset.y, | 47 | globalBox.top + offset.y, |
48 | globalBox.x + offset.x + metrics.right + deb, | 48 | globalBox.x + offset.x + metrics.right + deb, |
49 | globalBox.top + offset.y) | 49 | globalBox.top + offset.y) |
50 | - ..setStrokeColor(PdfColor.deepPurple) | 50 | + ..setStrokeColor(PdfColors.deepPurple) |
51 | ..strokePath(); | 51 | ..strokePath(); |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -237,7 +237,7 @@ class RichText extends Widget { | @@ -237,7 +237,7 @@ class RichText extends Widget { | ||
237 | @override | 237 | @override |
238 | void debugPaint(Context context) { | 238 | void debugPaint(Context context) { |
239 | context.canvas | 239 | context.canvas |
240 | - ..setStrokeColor(PdfColor.blue) | 240 | + ..setStrokeColor(PdfColors.blue) |
241 | ..drawRect(box.x, box.y, box.width, box.height) | 241 | ..drawRect(box.x, box.y, box.width, box.height) |
242 | ..strokePath(); | 242 | ..strokePath(); |
243 | } | 243 | } |
@@ -19,7 +19,7 @@ part of widget; | @@ -19,7 +19,7 @@ part of widget; | ||
19 | @immutable | 19 | @immutable |
20 | class TextStyle { | 20 | class TextStyle { |
21 | const TextStyle({ | 21 | const TextStyle({ |
22 | - this.color = PdfColor.black, | 22 | + this.color = PdfColors.black, |
23 | @required this.font, | 23 | @required this.font, |
24 | this.fontSize = _defaultFontSize, | 24 | this.fontSize = _defaultFontSize, |
25 | this.letterSpacing = 1.0, | 25 | this.letterSpacing = 1.0, |
@@ -86,7 +86,7 @@ abstract class Widget { | @@ -86,7 +86,7 @@ abstract class Widget { | ||
86 | @protected | 86 | @protected |
87 | void debugPaint(Context context) { | 87 | void debugPaint(Context context) { |
88 | context.canvas | 88 | context.canvas |
89 | - ..setStrokeColor(PdfColor.purple) | 89 | + ..setStrokeColor(PdfColors.purple) |
90 | ..drawRect(box.x, box.y, box.width, box.height) | 90 | ..drawRect(box.x, box.y, box.width, box.height) |
91 | ..strokePath(); | 91 | ..strokePath(); |
92 | } | 92 | } |
pdf/test/colors.dart
0 → 100644
1 | +/* | ||
2 | + * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com> | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +import 'dart:io'; | ||
18 | + | ||
19 | +import 'package:pdf/pdf.dart'; | ||
20 | +import 'package:pdf/widgets.dart'; | ||
21 | +import 'package:test/test.dart'; | ||
22 | + | ||
23 | +class Color extends StatelessWidget { | ||
24 | + Color(this.color, this.name, [this.varient]); | ||
25 | + final PdfColor color; | ||
26 | + final String name; | ||
27 | + final String varient; | ||
28 | + | ||
29 | + @override | ||
30 | + Widget build(Context context) { | ||
31 | + final TextStyle style = Theme.of(context).defaultTextStyle.copyWith( | ||
32 | + color: color.luminance < 0.2 ? PdfColors.white : PdfColors.black, | ||
33 | + fontSize: 14); | ||
34 | + final TextStyle hexStyle = | ||
35 | + style.copyWith(font: Font.courier(), fontSize: 10); | ||
36 | + return Container( | ||
37 | + color: color, | ||
38 | + padding: const EdgeInsets.all(2 * PdfPageFormat.mm), | ||
39 | + // child: FittedBox( | ||
40 | + child: Column( | ||
41 | + mainAxisAlignment: MainAxisAlignment.center, | ||
42 | + children: <Widget>[ | ||
43 | + Text(name, style: style), | ||
44 | + Text(varient ?? '', style: style), | ||
45 | + Padding(padding: const EdgeInsets.all(2 * PdfPageFormat.mm)), | ||
46 | + Text(color.toHex(), style: hexStyle), | ||
47 | + ], | ||
48 | + // ) | ||
49 | + )); | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | +void main() { | ||
54 | + test('Pdf', () { | ||
55 | + final Document pdf = Document(title: 'Material Colors'); | ||
56 | + | ||
57 | + pdf.addPage(MultiPage( | ||
58 | + pageFormat: PdfPageFormat.standard, | ||
59 | + build: (Context context) => <Widget>[ | ||
60 | + Header(text: 'Red'), | ||
61 | + GridView( | ||
62 | + crossAxisCount: 4, | ||
63 | + direction: Axis.vertical, | ||
64 | + crossAxisSpacing: 10, | ||
65 | + mainAxisSpacing: 10, | ||
66 | + childAspectRatio: 1, | ||
67 | + padding: const EdgeInsets.all(10), | ||
68 | + children: <Widget>[ | ||
69 | + Color(PdfColors.red50, 'Red', '50'), | ||
70 | + Color(PdfColors.red100, 'Red', '100'), | ||
71 | + Color(PdfColors.red200, 'Red', '200'), | ||
72 | + Color(PdfColors.red300, 'Red', '300'), | ||
73 | + Color(PdfColors.red400, 'Red', '400'), | ||
74 | + Color(PdfColors.red500, 'Red', '500'), | ||
75 | + Color(PdfColors.red600, 'Red', '600'), | ||
76 | + Color(PdfColors.red700, 'Red', '700'), | ||
77 | + Color(PdfColors.red800, 'Red', '800'), | ||
78 | + Color(PdfColors.red900, 'Red', '900'), | ||
79 | + Color(PdfColors.redAccent100, 'Red', 'Accent 100'), | ||
80 | + Color(PdfColors.redAccent200, 'Red', 'Accent 200'), | ||
81 | + Color(PdfColors.redAccent400, 'Red', 'Accent 400'), | ||
82 | + Color(PdfColors.redAccent700, 'Red', 'Accent 700'), | ||
83 | + ]), | ||
84 | + NewPage(), | ||
85 | + Header(text: 'Pink'), | ||
86 | + GridView( | ||
87 | + crossAxisCount: 4, | ||
88 | + direction: Axis.vertical, | ||
89 | + crossAxisSpacing: 10, | ||
90 | + mainAxisSpacing: 10, | ||
91 | + childAspectRatio: 1, | ||
92 | + padding: const EdgeInsets.all(10), | ||
93 | + children: <Widget>[ | ||
94 | + Color(PdfColors.pink50, 'Pink', '50'), | ||
95 | + Color(PdfColors.pink100, 'Pink', '100'), | ||
96 | + Color(PdfColors.pink200, 'Pink', '200'), | ||
97 | + Color(PdfColors.pink300, 'Pink', '300'), | ||
98 | + Color(PdfColors.pink400, 'Pink', '400'), | ||
99 | + Color(PdfColors.pink500, 'Pink', '500'), | ||
100 | + Color(PdfColors.pink600, 'Pink', '600'), | ||
101 | + Color(PdfColors.pink700, 'Pink', '700'), | ||
102 | + Color(PdfColors.pink800, 'Pink', '800'), | ||
103 | + Color(PdfColors.pink900, 'Pink', '900'), | ||
104 | + Color(PdfColors.pinkAccent100, 'Pink', 'Accent 100'), | ||
105 | + Color(PdfColors.pinkAccent200, 'Pink', 'Accent 200'), | ||
106 | + Color(PdfColors.pinkAccent400, 'Pink', 'Accent 400'), | ||
107 | + Color(PdfColors.pinkAccent700, 'Pink', 'Accent 700'), | ||
108 | + ]), | ||
109 | + NewPage(), | ||
110 | + Header(text: 'Purple'), | ||
111 | + GridView( | ||
112 | + crossAxisCount: 4, | ||
113 | + direction: Axis.vertical, | ||
114 | + crossAxisSpacing: 10, | ||
115 | + mainAxisSpacing: 10, | ||
116 | + childAspectRatio: 1, | ||
117 | + padding: const EdgeInsets.all(10), | ||
118 | + children: <Widget>[ | ||
119 | + Color(PdfColors.purple50, 'Purple', '50'), | ||
120 | + Color(PdfColors.purple100, 'Purple', '100'), | ||
121 | + Color(PdfColors.purple200, 'Purple', '200'), | ||
122 | + Color(PdfColors.purple300, 'Purple', '300'), | ||
123 | + Color(PdfColors.purple400, 'Purple', '400'), | ||
124 | + Color(PdfColors.purple500, 'Purple', '500'), | ||
125 | + Color(PdfColors.purple600, 'Purple', '600'), | ||
126 | + Color(PdfColors.purple700, 'Purple', '700'), | ||
127 | + Color(PdfColors.purple800, 'Purple', '800'), | ||
128 | + Color(PdfColors.purple900, 'Purple', '900'), | ||
129 | + Color(PdfColors.purpleAccent100, 'Purple', 'Accent 100'), | ||
130 | + Color(PdfColors.purpleAccent200, 'Purple', 'Accent 200'), | ||
131 | + Color(PdfColors.purpleAccent400, 'Purple', 'Accent 400'), | ||
132 | + Color(PdfColors.purpleAccent700, 'Purple', 'Accent 700'), | ||
133 | + ]), | ||
134 | + NewPage(), | ||
135 | + Header(text: 'Deep Purple'), | ||
136 | + GridView( | ||
137 | + crossAxisCount: 4, | ||
138 | + direction: Axis.vertical, | ||
139 | + crossAxisSpacing: 10, | ||
140 | + mainAxisSpacing: 10, | ||
141 | + childAspectRatio: 1, | ||
142 | + padding: const EdgeInsets.all(10), | ||
143 | + children: <Widget>[ | ||
144 | + Color(PdfColors.deepPurple50, 'Deep Purple', '50'), | ||
145 | + Color(PdfColors.deepPurple100, 'Deep Purple', '100'), | ||
146 | + Color(PdfColors.deepPurple200, 'Deep Purple', '200'), | ||
147 | + Color(PdfColors.deepPurple300, 'Deep Purple', '300'), | ||
148 | + Color(PdfColors.deepPurple400, 'Deep Purple', '400'), | ||
149 | + Color(PdfColors.deepPurple500, 'Deep Purple', '500'), | ||
150 | + Color(PdfColors.deepPurple600, 'Deep Purple', '600'), | ||
151 | + Color(PdfColors.deepPurple700, 'Deep Purple', '700'), | ||
152 | + Color(PdfColors.deepPurple800, 'Deep Purple', '800'), | ||
153 | + Color(PdfColors.deepPurple900, 'Deep Purple', '900'), | ||
154 | + Color(PdfColors.deepPurpleAccent100, 'Deep Purple', | ||
155 | + 'Accent 100'), | ||
156 | + Color(PdfColors.deepPurpleAccent200, 'Deep Purple', | ||
157 | + 'Accent 200'), | ||
158 | + Color(PdfColors.deepPurpleAccent400, 'Deep Purple', | ||
159 | + 'Accent 400'), | ||
160 | + Color(PdfColors.deepPurpleAccent700, 'Deep Purple', | ||
161 | + 'Accent 700'), | ||
162 | + ]), | ||
163 | + NewPage(), | ||
164 | + Header(text: 'Indigo'), | ||
165 | + GridView( | ||
166 | + crossAxisCount: 4, | ||
167 | + direction: Axis.vertical, | ||
168 | + crossAxisSpacing: 10, | ||
169 | + mainAxisSpacing: 10, | ||
170 | + childAspectRatio: 1, | ||
171 | + padding: const EdgeInsets.all(10), | ||
172 | + children: <Widget>[ | ||
173 | + Color(PdfColors.indigo50, 'Indigo', '50'), | ||
174 | + Color(PdfColors.indigo100, 'Indigo', '100'), | ||
175 | + Color(PdfColors.indigo200, 'Indigo', '200'), | ||
176 | + Color(PdfColors.indigo300, 'Indigo', '300'), | ||
177 | + Color(PdfColors.indigo400, 'Indigo', '400'), | ||
178 | + Color(PdfColors.indigo500, 'Indigo', '500'), | ||
179 | + Color(PdfColors.indigo600, 'Indigo', '600'), | ||
180 | + Color(PdfColors.indigo700, 'Indigo', '700'), | ||
181 | + Color(PdfColors.indigo800, 'Indigo', '800'), | ||
182 | + Color(PdfColors.indigo900, 'Indigo', '900'), | ||
183 | + Color(PdfColors.indigoAccent100, 'Indigo', 'Accent 100'), | ||
184 | + Color(PdfColors.indigoAccent200, 'Indigo', 'Accent 200'), | ||
185 | + Color(PdfColors.indigoAccent400, 'Indigo', 'Accent 400'), | ||
186 | + Color(PdfColors.indigoAccent700, 'Indigo', 'Accent 700'), | ||
187 | + ]), | ||
188 | + NewPage(), | ||
189 | + Header(text: 'Blue'), | ||
190 | + GridView( | ||
191 | + crossAxisCount: 4, | ||
192 | + direction: Axis.vertical, | ||
193 | + crossAxisSpacing: 10, | ||
194 | + mainAxisSpacing: 10, | ||
195 | + childAspectRatio: 1, | ||
196 | + padding: const EdgeInsets.all(10), | ||
197 | + children: <Widget>[ | ||
198 | + Color(PdfColors.blue50, 'Blue', '50'), | ||
199 | + Color(PdfColors.blue100, 'Blue', '100'), | ||
200 | + Color(PdfColors.blue200, 'Blue', '200'), | ||
201 | + Color(PdfColors.blue300, 'Blue', '300'), | ||
202 | + Color(PdfColors.blue400, 'Blue', '400'), | ||
203 | + Color(PdfColors.blue500, 'Blue', '500'), | ||
204 | + Color(PdfColors.blue600, 'Blue', '600'), | ||
205 | + Color(PdfColors.blue700, 'Blue', '700'), | ||
206 | + Color(PdfColors.blue800, 'Blue', '800'), | ||
207 | + Color(PdfColors.blue900, 'Blue', '900'), | ||
208 | + Color(PdfColors.blueAccent100, 'Blue', 'Accent 100'), | ||
209 | + Color(PdfColors.blueAccent200, 'Blue', 'Accent 200'), | ||
210 | + Color(PdfColors.blueAccent400, 'Blue', 'Accent 400'), | ||
211 | + Color(PdfColors.blueAccent700, 'Blue', 'Accent 700'), | ||
212 | + ]), | ||
213 | + NewPage(), | ||
214 | + Header(text: 'Light Blue'), | ||
215 | + GridView( | ||
216 | + crossAxisCount: 4, | ||
217 | + direction: Axis.vertical, | ||
218 | + crossAxisSpacing: 10, | ||
219 | + mainAxisSpacing: 10, | ||
220 | + childAspectRatio: 1, | ||
221 | + padding: const EdgeInsets.all(10), | ||
222 | + children: <Widget>[ | ||
223 | + Color(PdfColors.lightBlue50, 'Light Blue', '50'), | ||
224 | + Color(PdfColors.lightBlue100, 'Light Blue', '100'), | ||
225 | + Color(PdfColors.lightBlue200, 'Light Blue', '200'), | ||
226 | + Color(PdfColors.lightBlue300, 'Light Blue', '300'), | ||
227 | + Color(PdfColors.lightBlue400, 'Light Blue', '400'), | ||
228 | + Color(PdfColors.lightBlue500, 'Light Blue', '500'), | ||
229 | + Color(PdfColors.lightBlue600, 'Light Blue', '600'), | ||
230 | + Color(PdfColors.lightBlue700, 'Light Blue', '700'), | ||
231 | + Color(PdfColors.lightBlue800, 'Light Blue', '800'), | ||
232 | + Color(PdfColors.lightBlue900, 'Light Blue', '900'), | ||
233 | + Color(PdfColors.lightBlueAccent100, 'Light Blue', | ||
234 | + 'Accent 100'), | ||
235 | + Color(PdfColors.lightBlueAccent200, 'Light Blue', | ||
236 | + 'Accent 200'), | ||
237 | + Color(PdfColors.lightBlueAccent400, 'Light Blue', | ||
238 | + 'Accent 400'), | ||
239 | + Color(PdfColors.lightBlueAccent700, 'Light Blue', | ||
240 | + 'Accent 700'), | ||
241 | + ]), | ||
242 | + NewPage(), | ||
243 | + Header(text: 'Cyan'), | ||
244 | + GridView( | ||
245 | + crossAxisCount: 4, | ||
246 | + direction: Axis.vertical, | ||
247 | + crossAxisSpacing: 10, | ||
248 | + mainAxisSpacing: 10, | ||
249 | + childAspectRatio: 1, | ||
250 | + padding: const EdgeInsets.all(10), | ||
251 | + children: <Widget>[ | ||
252 | + Color(PdfColors.cyan50, 'Cyan', '50'), | ||
253 | + Color(PdfColors.cyan100, 'Cyan', '100'), | ||
254 | + Color(PdfColors.cyan200, 'Cyan', '200'), | ||
255 | + Color(PdfColors.cyan300, 'Cyan', '300'), | ||
256 | + Color(PdfColors.cyan400, 'Cyan', '400'), | ||
257 | + Color(PdfColors.cyan500, 'Cyan', '500'), | ||
258 | + Color(PdfColors.cyan600, 'Cyan', '600'), | ||
259 | + Color(PdfColors.cyan700, 'Cyan', '700'), | ||
260 | + Color(PdfColors.cyan800, 'Cyan', '800'), | ||
261 | + Color(PdfColors.cyan900, 'Cyan', '900'), | ||
262 | + Color(PdfColors.cyanAccent100, 'Cyan', 'Accent 100'), | ||
263 | + Color(PdfColors.cyanAccent200, 'Cyan', 'Accent 200'), | ||
264 | + Color(PdfColors.cyanAccent400, 'Cyan', 'Accent 400'), | ||
265 | + Color(PdfColors.cyanAccent700, 'Cyan', 'Accent 700'), | ||
266 | + ]), | ||
267 | + NewPage(), | ||
268 | + Header(text: 'Teal'), | ||
269 | + GridView( | ||
270 | + crossAxisCount: 4, | ||
271 | + direction: Axis.vertical, | ||
272 | + crossAxisSpacing: 10, | ||
273 | + mainAxisSpacing: 10, | ||
274 | + childAspectRatio: 1, | ||
275 | + padding: const EdgeInsets.all(10), | ||
276 | + children: <Widget>[ | ||
277 | + Color(PdfColors.teal50, 'Teal', '50'), | ||
278 | + Color(PdfColors.teal100, 'Teal', '100'), | ||
279 | + Color(PdfColors.teal200, 'Teal', '200'), | ||
280 | + Color(PdfColors.teal300, 'Teal', '300'), | ||
281 | + Color(PdfColors.teal400, 'Teal', '400'), | ||
282 | + Color(PdfColors.teal500, 'Teal', '500'), | ||
283 | + Color(PdfColors.teal600, 'Teal', '600'), | ||
284 | + Color(PdfColors.teal700, 'Teal', '700'), | ||
285 | + Color(PdfColors.teal800, 'Teal', '800'), | ||
286 | + Color(PdfColors.teal900, 'Teal', '900'), | ||
287 | + Color(PdfColors.tealAccent100, 'Teal', 'Accent 100'), | ||
288 | + Color(PdfColors.tealAccent200, 'Teal', 'Accent 200'), | ||
289 | + Color(PdfColors.tealAccent400, 'Teal', 'Accent 400'), | ||
290 | + Color(PdfColors.tealAccent700, 'Teal', 'Accent 700'), | ||
291 | + ]), | ||
292 | + NewPage(), | ||
293 | + Header(text: 'Green'), | ||
294 | + GridView( | ||
295 | + crossAxisCount: 4, | ||
296 | + direction: Axis.vertical, | ||
297 | + crossAxisSpacing: 10, | ||
298 | + mainAxisSpacing: 10, | ||
299 | + childAspectRatio: 1, | ||
300 | + padding: const EdgeInsets.all(10), | ||
301 | + children: <Widget>[ | ||
302 | + Color(PdfColors.green50, 'Green', '50'), | ||
303 | + Color(PdfColors.green100, 'Green', '100'), | ||
304 | + Color(PdfColors.green200, 'Green', '200'), | ||
305 | + Color(PdfColors.green300, 'Green', '300'), | ||
306 | + Color(PdfColors.green400, 'Green', '400'), | ||
307 | + Color(PdfColors.green500, 'Green', '500'), | ||
308 | + Color(PdfColors.green600, 'Green', '600'), | ||
309 | + Color(PdfColors.green700, 'Green', '700'), | ||
310 | + Color(PdfColors.green800, 'Green', '800'), | ||
311 | + Color(PdfColors.green900, 'Green', '900'), | ||
312 | + Color(PdfColors.greenAccent100, 'Green', 'Accent 100'), | ||
313 | + Color(PdfColors.greenAccent200, 'Green', 'Accent 200'), | ||
314 | + Color(PdfColors.greenAccent400, 'Green', 'Accent 400'), | ||
315 | + Color(PdfColors.greenAccent700, 'Green', 'Accent 700'), | ||
316 | + ]), | ||
317 | + NewPage(), | ||
318 | + Header(text: 'Light Green'), | ||
319 | + GridView( | ||
320 | + crossAxisCount: 4, | ||
321 | + direction: Axis.vertical, | ||
322 | + crossAxisSpacing: 10, | ||
323 | + mainAxisSpacing: 10, | ||
324 | + childAspectRatio: 1, | ||
325 | + padding: const EdgeInsets.all(10), | ||
326 | + children: <Widget>[ | ||
327 | + Color(PdfColors.lightGreen50, 'Light Green', '50'), | ||
328 | + Color(PdfColors.lightGreen100, 'Light Green', '100'), | ||
329 | + Color(PdfColors.lightGreen200, 'Light Green', '200'), | ||
330 | + Color(PdfColors.lightGreen300, 'Light Green', '300'), | ||
331 | + Color(PdfColors.lightGreen400, 'Light Green', '400'), | ||
332 | + Color(PdfColors.lightGreen500, 'Light Green', '500'), | ||
333 | + Color(PdfColors.lightGreen600, 'Light Green', '600'), | ||
334 | + Color(PdfColors.lightGreen700, 'Light Green', '700'), | ||
335 | + Color(PdfColors.lightGreen800, 'Light Green', '800'), | ||
336 | + Color(PdfColors.lightGreen900, 'Light Green', '900'), | ||
337 | + Color(PdfColors.lightGreenAccent100, 'Light Green', | ||
338 | + 'Accent100'), | ||
339 | + Color(PdfColors.lightGreenAccent200, 'Light Green', | ||
340 | + 'Accent200'), | ||
341 | + Color(PdfColors.lightGreenAccent400, 'Light Green', | ||
342 | + 'Accent400'), | ||
343 | + Color(PdfColors.lightGreenAccent700, 'Light Green', | ||
344 | + 'Accent700'), | ||
345 | + ]), | ||
346 | + NewPage(), | ||
347 | + Header(text: 'Lime'), | ||
348 | + GridView( | ||
349 | + crossAxisCount: 4, | ||
350 | + direction: Axis.vertical, | ||
351 | + crossAxisSpacing: 10, | ||
352 | + mainAxisSpacing: 10, | ||
353 | + childAspectRatio: 1, | ||
354 | + padding: const EdgeInsets.all(10), | ||
355 | + children: <Widget>[ | ||
356 | + Color(PdfColors.lime50, 'Lime', '50'), | ||
357 | + Color(PdfColors.lime100, 'Lime', '100'), | ||
358 | + Color(PdfColors.lime200, 'Lime', '200'), | ||
359 | + Color(PdfColors.lime300, 'Lime', '300'), | ||
360 | + Color(PdfColors.lime400, 'Lime', '400'), | ||
361 | + Color(PdfColors.lime500, 'Lime', '500'), | ||
362 | + Color(PdfColors.lime600, 'Lime', '600'), | ||
363 | + Color(PdfColors.lime700, 'Lime', '700'), | ||
364 | + Color(PdfColors.lime800, 'Lime', '800'), | ||
365 | + Color(PdfColors.lime900, 'Lime', '900'), | ||
366 | + Color(PdfColors.limeAccent100, 'Lime', 'Accent 100'), | ||
367 | + Color(PdfColors.limeAccent200, 'Lime', 'Accent 200'), | ||
368 | + Color(PdfColors.limeAccent400, 'Lime', 'Accent 400'), | ||
369 | + Color(PdfColors.limeAccent700, 'Lime', 'Accent 700'), | ||
370 | + ]), | ||
371 | + NewPage(), | ||
372 | + Header(text: 'Yellow'), | ||
373 | + GridView( | ||
374 | + crossAxisCount: 4, | ||
375 | + direction: Axis.vertical, | ||
376 | + crossAxisSpacing: 10, | ||
377 | + mainAxisSpacing: 10, | ||
378 | + childAspectRatio: 1, | ||
379 | + padding: const EdgeInsets.all(10), | ||
380 | + children: <Widget>[ | ||
381 | + Color(PdfColors.yellow50, 'Yellow', '50'), | ||
382 | + Color(PdfColors.yellow100, 'Yellow', '100'), | ||
383 | + Color(PdfColors.yellow200, 'Yellow', '200'), | ||
384 | + Color(PdfColors.yellow300, 'Yellow', '300'), | ||
385 | + Color(PdfColors.yellow400, 'Yellow', '400'), | ||
386 | + Color(PdfColors.yellow500, 'Yellow', '500'), | ||
387 | + Color(PdfColors.yellow600, 'Yellow', '600'), | ||
388 | + Color(PdfColors.yellow700, 'Yellow', '700'), | ||
389 | + Color(PdfColors.yellow800, 'Yellow', '800'), | ||
390 | + Color(PdfColors.yellow900, 'Yellow', '900'), | ||
391 | + Color(PdfColors.yellowAccent100, 'Yellow', 'Accent 100'), | ||
392 | + Color(PdfColors.yellowAccent200, 'Yellow', 'Accent 200'), | ||
393 | + Color(PdfColors.yellowAccent400, 'Yellow', 'Accent 400'), | ||
394 | + Color(PdfColors.yellowAccent700, 'Yellow', 'Accent 700'), | ||
395 | + ]), | ||
396 | + NewPage(), | ||
397 | + Header(text: 'Amber'), | ||
398 | + GridView( | ||
399 | + crossAxisCount: 4, | ||
400 | + direction: Axis.vertical, | ||
401 | + crossAxisSpacing: 10, | ||
402 | + mainAxisSpacing: 10, | ||
403 | + childAspectRatio: 1, | ||
404 | + padding: const EdgeInsets.all(10), | ||
405 | + children: <Widget>[ | ||
406 | + Color(PdfColors.amber50, 'Amber', '50'), | ||
407 | + Color(PdfColors.amber100, 'Amber', '100'), | ||
408 | + Color(PdfColors.amber200, 'Amber', '200'), | ||
409 | + Color(PdfColors.amber300, 'Amber', '300'), | ||
410 | + Color(PdfColors.amber400, 'Amber', '400'), | ||
411 | + Color(PdfColors.amber500, 'Amber', '500'), | ||
412 | + Color(PdfColors.amber600, 'Amber', '600'), | ||
413 | + Color(PdfColors.amber700, 'Amber', '700'), | ||
414 | + Color(PdfColors.amber800, 'Amber', '800'), | ||
415 | + Color(PdfColors.amber900, 'Amber', '900'), | ||
416 | + Color(PdfColors.amberAccent100, 'Amber', 'Accent 100'), | ||
417 | + Color(PdfColors.amberAccent200, 'Amber', 'Accent 200'), | ||
418 | + Color(PdfColors.amberAccent400, 'Amber', 'Accent 400'), | ||
419 | + Color(PdfColors.amberAccent700, 'Amber', 'Accent 700'), | ||
420 | + ]), | ||
421 | + NewPage(), | ||
422 | + Header(text: 'Orange'), | ||
423 | + GridView( | ||
424 | + crossAxisCount: 4, | ||
425 | + direction: Axis.vertical, | ||
426 | + crossAxisSpacing: 10, | ||
427 | + mainAxisSpacing: 10, | ||
428 | + childAspectRatio: 1, | ||
429 | + padding: const EdgeInsets.all(10), | ||
430 | + children: <Widget>[ | ||
431 | + Color(PdfColors.orange50, 'Orange', '50'), | ||
432 | + Color(PdfColors.orange100, 'Orange', '100'), | ||
433 | + Color(PdfColors.orange200, 'Orange', '200'), | ||
434 | + Color(PdfColors.orange300, 'Orange', '300'), | ||
435 | + Color(PdfColors.orange400, 'Orange', '400'), | ||
436 | + Color(PdfColors.orange500, 'Orange', '500'), | ||
437 | + Color(PdfColors.orange600, 'Orange', '600'), | ||
438 | + Color(PdfColors.orange700, 'Orange', '700'), | ||
439 | + Color(PdfColors.orange800, 'Orange', '800'), | ||
440 | + Color(PdfColors.orange900, 'Orange', '900'), | ||
441 | + Color(PdfColors.orangeAccent100, 'Orange', 'Accent 100'), | ||
442 | + Color(PdfColors.orangeAccent200, 'Orange', 'Accent 200'), | ||
443 | + Color(PdfColors.orangeAccent400, 'Orange', 'Accent 400'), | ||
444 | + Color(PdfColors.orangeAccent700, 'Orange', 'Accent 700'), | ||
445 | + ]), | ||
446 | + NewPage(), | ||
447 | + Header(text: 'Deep Orange'), | ||
448 | + GridView( | ||
449 | + crossAxisCount: 4, | ||
450 | + direction: Axis.vertical, | ||
451 | + crossAxisSpacing: 10, | ||
452 | + mainAxisSpacing: 10, | ||
453 | + childAspectRatio: 1, | ||
454 | + padding: const EdgeInsets.all(10), | ||
455 | + children: <Widget>[ | ||
456 | + Color(PdfColors.deepOrange50, 'Deep Orange', '50'), | ||
457 | + Color(PdfColors.deepOrange100, 'Deep Orange', '100'), | ||
458 | + Color(PdfColors.deepOrange200, 'Deep Orange', '200'), | ||
459 | + Color(PdfColors.deepOrange300, 'Deep Orange', '300'), | ||
460 | + Color(PdfColors.deepOrange400, 'Deep Orange', '400'), | ||
461 | + Color(PdfColors.deepOrange500, 'Deep Orange', '500'), | ||
462 | + Color(PdfColors.deepOrange600, 'Deep Orange', '600'), | ||
463 | + Color(PdfColors.deepOrange700, 'Deep Orange', '700'), | ||
464 | + Color(PdfColors.deepOrange800, 'Deep Orange', '800'), | ||
465 | + Color(PdfColors.deepOrange900, 'Deep Orange', '900'), | ||
466 | + Color(PdfColors.deepOrangeAccent100, 'Deep Orange', | ||
467 | + 'Accent 100'), | ||
468 | + Color(PdfColors.deepOrangeAccent200, 'Deep Orange', | ||
469 | + 'Accent 200'), | ||
470 | + Color(PdfColors.deepOrangeAccent400, 'Deep Orange', | ||
471 | + 'Accent 400'), | ||
472 | + Color(PdfColors.deepOrangeAccent700, 'Deep Orange', | ||
473 | + 'Accent 700'), | ||
474 | + ]), | ||
475 | + NewPage(), | ||
476 | + Header(text: 'Brown'), | ||
477 | + GridView( | ||
478 | + crossAxisCount: 4, | ||
479 | + direction: Axis.vertical, | ||
480 | + crossAxisSpacing: 10, | ||
481 | + mainAxisSpacing: 10, | ||
482 | + childAspectRatio: 1, | ||
483 | + padding: const EdgeInsets.all(10), | ||
484 | + children: <Widget>[ | ||
485 | + Color(PdfColors.brown50, 'Brown', '50'), | ||
486 | + Color(PdfColors.brown100, 'Brown', '100'), | ||
487 | + Color(PdfColors.brown200, 'Brown', '200'), | ||
488 | + Color(PdfColors.brown300, 'Brown', '300'), | ||
489 | + Color(PdfColors.brown400, 'Brown', '400'), | ||
490 | + Color(PdfColors.brown500, 'Brown', '500'), | ||
491 | + Color(PdfColors.brown600, 'Brown', '600'), | ||
492 | + Color(PdfColors.brown700, 'Brown', '700'), | ||
493 | + Color(PdfColors.brown800, 'Brown', '800'), | ||
494 | + Color(PdfColors.brown900, 'Brown', '900'), | ||
495 | + ]), | ||
496 | + NewPage(), | ||
497 | + Header(text: 'Blue Grey'), | ||
498 | + GridView( | ||
499 | + crossAxisCount: 4, | ||
500 | + direction: Axis.vertical, | ||
501 | + crossAxisSpacing: 10, | ||
502 | + mainAxisSpacing: 10, | ||
503 | + childAspectRatio: 1, | ||
504 | + padding: const EdgeInsets.all(10), | ||
505 | + children: <Widget>[ | ||
506 | + Color(PdfColors.blueGrey50, 'Blue Grey', '50'), | ||
507 | + Color(PdfColors.blueGrey100, 'Blue Grey', '100'), | ||
508 | + Color(PdfColors.blueGrey200, 'Blue Grey', '200'), | ||
509 | + Color(PdfColors.blueGrey300, 'Blue Grey', '300'), | ||
510 | + Color(PdfColors.blueGrey400, 'Blue Grey', '400'), | ||
511 | + Color(PdfColors.blueGrey500, 'Blue Grey', '500'), | ||
512 | + Color(PdfColors.blueGrey600, 'Blue Grey', '600'), | ||
513 | + Color(PdfColors.blueGrey700, 'Blue Grey', '700'), | ||
514 | + Color(PdfColors.blueGrey800, 'Blue Grey', '800'), | ||
515 | + Color(PdfColors.blueGrey900, 'Blue Grey', '900'), | ||
516 | + ]), | ||
517 | + NewPage(), | ||
518 | + Header(text: 'Grey'), | ||
519 | + GridView( | ||
520 | + crossAxisCount: 4, | ||
521 | + direction: Axis.vertical, | ||
522 | + crossAxisSpacing: 10, | ||
523 | + mainAxisSpacing: 10, | ||
524 | + childAspectRatio: 1, | ||
525 | + padding: const EdgeInsets.all(10), | ||
526 | + children: <Widget>[ | ||
527 | + Color(PdfColors.white, 'White'), | ||
528 | + Color(PdfColors.grey50, 'Grey', '50'), | ||
529 | + Color(PdfColors.grey100, 'Grey', '100'), | ||
530 | + Color(PdfColors.grey200, 'Grey', '200'), | ||
531 | + Color(PdfColors.grey300, 'Grey', '300'), | ||
532 | + Color(PdfColors.grey400, 'Grey', '400'), | ||
533 | + Color(PdfColors.grey400, 'Grey', '400'), | ||
534 | + Color(PdfColors.grey500, 'Grey', '500'), | ||
535 | + Color(PdfColors.grey600, 'Grey', '600'), | ||
536 | + Color(PdfColors.grey700, 'Grey', '700'), | ||
537 | + Color(PdfColors.grey800, 'Grey', '800'), | ||
538 | + Color(PdfColors.grey900, 'Grey', '900'), | ||
539 | + Color(PdfColors.black, 'Black'), | ||
540 | + ]), | ||
541 | + ])); | ||
542 | + | ||
543 | + final File file = File('colors.pdf'); | ||
544 | + file.writeAsBytesSync(pdf.save()); | ||
545 | + }); | ||
546 | +} |
@@ -38,22 +38,22 @@ void printMetrics( | @@ -38,22 +38,22 @@ void printMetrics( | ||
38 | canvas | 38 | canvas |
39 | ..setLineWidth(0.5) | 39 | ..setLineWidth(0.5) |
40 | ..drawRect(x, y + metrics.descent, metrics.advanceWidth, metrics.maxHeight) | 40 | ..drawRect(x, y + metrics.descent, metrics.advanceWidth, metrics.maxHeight) |
41 | - ..setStrokeColor(PdfColor.green) | 41 | + ..setStrokeColor(PdfColors.green) |
42 | ..strokePath() | 42 | ..strokePath() |
43 | ..drawRect(x + metrics.left, y + metrics.top, metrics.width, metrics.height) | 43 | ..drawRect(x + metrics.left, y + metrics.top, metrics.width, metrics.height) |
44 | - ..setStrokeColor(PdfColor.amber) | 44 | + ..setStrokeColor(PdfColors.amber) |
45 | ..strokePath() | 45 | ..strokePath() |
46 | ..drawLine(x + metrics.effectiveLeft - deb, y, | 46 | ..drawLine(x + metrics.effectiveLeft - deb, y, |
47 | x + metrics.maxWidth + metrics.effectiveLeft + deb, y) | 47 | x + metrics.maxWidth + metrics.effectiveLeft + deb, y) |
48 | - ..setColor(PdfColor.blue) | 48 | + ..setColor(PdfColors.blue) |
49 | ..strokePath() | 49 | ..strokePath() |
50 | ..drawEllipse(x, y, 5, 5) | 50 | ..drawEllipse(x, y, 5, 5) |
51 | - ..setFillColor(PdfColor.black) | 51 | + ..setFillColor(PdfColors.black) |
52 | ..fillPath() | 52 | ..fillPath() |
53 | ..drawEllipse(x + metrics.advanceWidth, y, 5, 5) | 53 | ..drawEllipse(x + metrics.advanceWidth, y, 5, 5) |
54 | - ..setFillColor(PdfColor.red) | 54 | + ..setFillColor(PdfColors.red) |
55 | ..fillPath() | 55 | ..fillPath() |
56 | - ..setFillColor(PdfColor.grey) | 56 | + ..setFillColor(PdfColors.grey) |
57 | ..drawString(font, fontSize, text, x, y); | 57 | ..drawString(font, fontSize, text, x, y); |
58 | } | 58 | } |
59 | 59 |
@@ -35,15 +35,15 @@ void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | @@ -35,15 +35,15 @@ void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | ||
35 | ..setColor(const PdfColor(0.9, 0.9, 0.9)) | 35 | ..setColor(const PdfColor(0.9, 0.9, 0.9)) |
36 | ..fillPath() | 36 | ..fillPath() |
37 | ..drawLine(x + metrics.left - deb, y, x + metrics.right + deb, y) | 37 | ..drawLine(x + metrics.left - deb, y, x + metrics.right + deb, y) |
38 | - ..setColor(PdfColor.blue) | 38 | + ..setColor(PdfColors.blue) |
39 | ..strokePath() | 39 | ..strokePath() |
40 | ..drawLine(x + metrics.left - deb, y + metrics.ascent, | 40 | ..drawLine(x + metrics.left - deb, y + metrics.ascent, |
41 | x + metrics.right + deb, y + metrics.ascent) | 41 | x + metrics.right + deb, y + metrics.ascent) |
42 | - ..setColor(PdfColor.green) | 42 | + ..setColor(PdfColors.green) |
43 | ..strokePath() | 43 | ..strokePath() |
44 | ..drawLine(x + metrics.left - deb, y + metrics.descent, | 44 | ..drawLine(x + metrics.left - deb, y + metrics.descent, |
45 | x + metrics.right + deb, y + metrics.descent) | 45 | x + metrics.right + deb, y + metrics.descent) |
46 | - ..setColor(PdfColor.purple) | 46 | + ..setColor(PdfColors.purple) |
47 | ..strokePath() | 47 | ..strokePath() |
48 | ..setColor(const PdfColor(0.3, 0.3, 0.3)) | 48 | ..setColor(const PdfColor(0.3, 0.3, 0.3)) |
49 | ..drawString(font, fontSize, text, x, y); | 49 | ..drawString(font, fontSize, text, x, y); |
@@ -34,15 +34,15 @@ void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | @@ -34,15 +34,15 @@ void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | ||
34 | ..setColor(const PdfColor(0.9, 0.9, 0.9)) | 34 | ..setColor(const PdfColor(0.9, 0.9, 0.9)) |
35 | ..fillPath() | 35 | ..fillPath() |
36 | ..drawLine(x + metrics.left - deb, y, x + metrics.right + deb, y) | 36 | ..drawLine(x + metrics.left - deb, y, x + metrics.right + deb, y) |
37 | - ..setColor(PdfColor.blue) | 37 | + ..setColor(PdfColors.blue) |
38 | ..strokePath() | 38 | ..strokePath() |
39 | ..drawLine(x + metrics.left - deb, y + metrics.ascent, | 39 | ..drawLine(x + metrics.left - deb, y + metrics.ascent, |
40 | x + metrics.right + deb, y + metrics.ascent) | 40 | x + metrics.right + deb, y + metrics.ascent) |
41 | - ..setColor(PdfColor.green) | 41 | + ..setColor(PdfColors.green) |
42 | ..strokePath() | 42 | ..strokePath() |
43 | ..drawLine(x + metrics.left - deb, y + metrics.descent, | 43 | ..drawLine(x + metrics.left - deb, y + metrics.descent, |
44 | x + metrics.right + deb, y + metrics.descent) | 44 | x + metrics.right + deb, y + metrics.descent) |
45 | - ..setColor(PdfColor.purple) | 45 | + ..setColor(PdfColors.purple) |
46 | ..strokePath() | 46 | ..strokePath() |
47 | ..setColor(const PdfColor(0.3, 0.3, 0.3)) | 47 | ..setColor(const PdfColor(0.3, 0.3, 0.3)) |
48 | ..drawString(font, fontSize, text, x, y); | 48 | ..drawString(font, fontSize, text, x, y); |
@@ -42,7 +42,7 @@ void main() { | @@ -42,7 +42,7 @@ void main() { | ||
42 | padding: const EdgeInsets.all(5), | 42 | padding: const EdgeInsets.all(5), |
43 | margin: const EdgeInsets.only(bottom: 10), | 43 | margin: const EdgeInsets.only(bottom: 10), |
44 | decoration: const BoxDecoration( | 44 | decoration: const BoxDecoration( |
45 | - color: PdfColor.amber, | 45 | + color: PdfColors.amber, |
46 | border: BoxBorder( | 46 | border: BoxBorder( |
47 | top: true, | 47 | top: true, |
48 | bottom: true, | 48 | bottom: true, |
@@ -149,7 +149,7 @@ void main() { | @@ -149,7 +149,7 @@ void main() { | ||
149 | size: const PdfPoint(50, 50), | 149 | size: const PdfPoint(50, 50), |
150 | painter: (PdfGraphics canvas, PdfPoint size) { | 150 | painter: (PdfGraphics canvas, PdfPoint size) { |
151 | canvas | 151 | canvas |
152 | - ..setColor(PdfColor.indigo) | 152 | + ..setColor(PdfColors.indigo) |
153 | ..drawRRect(0, 0, size.x, size.y, 10, 10) | 153 | ..drawRRect(0, 0, size.x, size.y, 10, 10) |
154 | ..fillPath(); | 154 | ..fillPath(); |
155 | })), | 155 | })), |
@@ -166,7 +166,7 @@ void main() { | @@ -166,7 +166,7 @@ void main() { | ||
166 | style: Theme.of(context) | 166 | style: Theme.of(context) |
167 | .defaultTextStyleBold | 167 | .defaultTextStyleBold |
168 | .copyWith( | 168 | .copyWith( |
169 | - fontSize: 20, color: PdfColor.blue)), | 169 | + fontSize: 20, color: PdfColors.blue)), |
170 | const TextSpan( | 170 | const TextSpan( |
171 | text: ' world!', | 171 | text: ' world!', |
172 | ), | 172 | ), |
-
Please register or login to post a comment