David PHAM-VAN

Update demo favicons

@@ -55,3 +55,4 @@ cache_* @@ -55,3 +55,4 @@ cache_*
55 package.json 55 package.json
56 56
57 GeneratedPluginRegistrant.* 57 GeneratedPluginRegistrant.*
  58 +test/social_preview.png
@@ -267,6 +267,7 @@ ref: svg @@ -267,6 +267,7 @@ ref: svg
267 cd $@; curl -OL 'https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf' 267 cd $@; curl -OL 'https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf'
268 268
269 gh-pages: all 269 gh-pages: all
  270 + cd test; $(DART_BIN) --enable-asserts github_social_preview.dart
270 cd demo; $(FLUTTER_BIN) build web 271 cd demo; $(FLUTTER_BIN) build web
271 git checkout gh-pages 272 git checkout gh-pages
272 rm -rf assets icons 273 rm -rf assets icons
@@ -40,3 +40,5 @@ assets/*.png @@ -40,3 +40,5 @@ assets/*.png
40 assets/*.jpg 40 assets/*.jpg
41 assets/logo.svg 41 assets/logo.svg
42 linux 42 linux
  43 +
  44 +web/*.png
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <meta name="apple-mobile-web-app-capable" content="yes"> 21 <meta name="apple-mobile-web-app-capable" content="yes">
22 <meta name="apple-mobile-web-app-status-bar-style" content="black"> 22 <meta name="apple-mobile-web-app-status-bar-style" content="black">
23 <meta name="apple-mobile-web-app-title" content="printing_demo"> 23 <meta name="apple-mobile-web-app-title" content="printing_demo">
24 - <link rel="apple-touch-icon" href="icons/Icon-192.png"> 24 + <link rel="apple-touch-icon" href="icon-192.png">
25 25
26 <!-- Favicon --> 26 <!-- Favicon -->
27 <link rel="icon" type="image/png" href="favicon.png"/> 27 <link rel="icon" type="image/png" href="favicon.png"/>
@@ -10,12 +10,12 @@ @@ -10,12 +10,12 @@
10 "prefer_related_applications": false, 10 "prefer_related_applications": false,
11 "icons": [ 11 "icons": [
12 { 12 {
13 - "src": "icons/Icon-192.png", 13 + "src": "icon-192.png",
14 "sizes": "192x192", 14 "sizes": "192x192",
15 "type": "image/png" 15 "type": "image/png"
16 }, 16 },
17 { 17 {
18 - "src": "icons/Icon-512.png", 18 + "src": "icon-512.png",
19 "sizes": "512x512", 19 "sizes": "512x512",
20 "type": "image/png" 20 "type": "image/png"
21 } 21 }
@@ -68,7 +68,7 @@ Future<void> main() async { @@ -68,7 +68,7 @@ Future<void> main() async {
68 ), 68 ),
69 ), 69 ),
70 // Add a vertical separator 70 // Add a vertical separator
71 - Container(width: 5 * px, color: PdfColors.lightBlue), 71 + VerticalDivider(width: 5 * px, color: PdfColors.lightBlue),
72 // Show "Hello World!" centered and rotated on the second half of the page 72 // Show "Hello World!" centered and rotated on the second half of the page
73 Flexible( 73 Flexible(
74 fit: FlexFit.tight, 74 fit: FlexFit.tight,
@@ -95,8 +95,62 @@ Future<void> main() async { @@ -95,8 +95,62 @@ Future<void> main() async {
95 await File('social_preview.pdf').writeAsBytes(await pdf.save()); 95 await File('social_preview.pdf').writeAsBytes(await pdf.save());
96 96
97 // Convert to png 97 // Convert to png
98 - Process.runSync('pdftocairo',  
99 - ['social_preview.pdf', '-png', '-r', '72', 'social_preview.png']); 98 + Process.runSync('pdftocairo', [
  99 + 'social_preview.pdf',
  100 + '-png',
  101 + '-singlefile',
  102 + '-r',
  103 + dpi.toString(),
  104 + 'social_preview',
  105 + ]);
  106 +
  107 + // Generate some favicons
  108 + Document.debug = false;
  109 +
  110 + // Create a pdf document
  111 + final favicon = Document();
  112 +
  113 + favicon.addPage(
  114 + Page(
  115 + pageFormat: PdfPageFormat(512, 512),
  116 + build: (context) => Center(child: PdfLogo()),
  117 + ),
  118 + );
  119 +
  120 + await File('favicon.pdf').writeAsBytes(await favicon.save());
  121 +
  122 + // Convert to png
  123 + Process.runSync('pdftocairo', [
  124 + 'favicon.pdf',
  125 + '-png',
  126 + '-singlefile',
  127 + '-transp',
  128 + '-r',
  129 + dpi.toString(),
  130 + '../demo/web/icon-512',
  131 + ]);
  132 + Process.runSync('pdftocairo', [
  133 + 'favicon.pdf',
  134 + '-png',
  135 + '-singlefile',
  136 + '-transp',
  137 + '-scale-to',
  138 + '192',
  139 + '-r',
  140 + dpi.toString(),
  141 + '../demo/web/icon-192',
  142 + ]);
  143 + Process.runSync('pdftocairo', [
  144 + 'favicon.pdf',
  145 + '-png',
  146 + '-singlefile',
  147 + '-transp',
  148 + '-scale-to',
  149 + '16',
  150 + '-r',
  151 + dpi.toString(),
  152 + '../demo/web/favicon',
  153 + ]);
100 } 154 }
101 155
102 class SyntaxHighlighterStyle { 156 class SyntaxHighlighterStyle {