Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update legacy kit recovery sheet PDF design

Neeraj Gupta7aac4e8d9407
diff --git a/mobile/packages/legacy/assets/legacy_kit_sheet_ente_com_badge.svg b/mobile/packages/legacy/assets/legacy_kit_sheet_ente_com_badge.svg
new file mode 100644
index 0000000000..c7aba571d4
--- /dev/null
+++ b/mobile/packages/legacy/assets/legacy_kit_sheet_ente_com_badge.svg
@@ -0,0 +1,13 @@
+<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36.6811 16.1389" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="Group">
+<path id="Vector" d="M28.6838 0.188966L7.61952 0.711123C3.41138 0.815438 0.0845636 4.31137 0.188878 8.51952C0.293193 12.7277 3.78914 16.0545 7.99728 15.9502L29.0616 15.428C33.2697 15.3237 36.5965 11.8277 36.4922 7.6196C36.3879 3.41146 32.8919 0.0846515 28.6838 0.188966Z" fill="#08C225"/>
+<g id="Group_2">
+<path id="Vector_2" d="M6.07805 11.6029C7.26441 11.6029 8.22615 10.6411 8.22615 9.45477C8.22615 8.26841 7.26441 7.30668 6.07805 7.30668C4.89169 7.30668 3.92996 8.26841 3.92996 9.45477C3.92996 10.6411 4.89169 11.6029 6.07805 11.6029Z" fill="#FFFFFF"/>
+<g id="Group_3">
+<path id="Vector_3" d="M12.1216 11.5201C11.1511 11.534 10.34 11.229 9.68973 10.6052C9.03875 9.97339 8.70664 9.18018 8.69275 8.2262C8.67886 7.27223 8.98847 6.47439 9.62092 5.83201C10.2527 5.18169 11.0545 4.84893 12.025 4.83504C12.6496 4.82577 13.2238 4.96801 13.7471 5.25976C13.7524 5.2624 13.7577 5.26571 13.763 5.26836C14.49 5.67919 14.4947 6.72644 13.7755 7.1505L13.6789 7.2074C13.3482 7.40256 12.9413 7.39793 12.6039 7.21335C12.4465 7.12669 12.2645 7.08501 12.0575 7.08832C11.7617 7.09229 11.5163 7.19946 11.3211 7.40917C11.126 7.61889 11.03 7.88021 11.0347 8.1918C11.0393 8.50406 11.1419 8.76207 11.3436 8.96583C11.5447 9.16959 11.7935 9.26948 12.0886 9.26552C12.3082 9.26221 12.4948 9.21458 12.6502 9.1213C12.9863 8.91952 13.4077 8.92481 13.7497 9.11601L13.8139 9.15173C14.5469 9.56057 14.5668 10.6131 13.8457 11.0425C13.8404 11.0458 13.8351 11.0484 13.8304 11.0517C13.3157 11.3547 12.7461 11.5109 12.121 11.5195L12.1216 11.5201Z" fill="#232323"/>
+<path id="Vector_4" d="M17.8514 11.4239C16.906 11.4378 16.0949 11.1282 15.4195 10.4964C14.752 9.86458 14.4113 9.076 14.3974 8.13063C14.3835 7.18526 14.7017 6.38741 15.3507 5.73643C15.9911 5.08546 16.7929 4.75335 17.7548 4.73946C18.7167 4.72557 19.5278 5.03518 20.1867 5.66697C20.8542 6.30736 21.1949 7.09594 21.2088 8.03271C21.2227 8.97809 20.9045 9.77659 20.2555 10.4269C19.6145 11.0779 18.8133 11.41 17.8514 11.4239ZM17.0423 8.90267C17.2481 9.10246 17.5067 9.19971 17.819 9.19508C18.1312 9.19045 18.3826 9.08592 18.5745 8.88018C18.7736 8.65789 18.8715 8.38665 18.8669 8.06579C18.8623 7.74493 18.7571 7.47237 18.5513 7.27258C18.3628 7.06419 18.1081 6.96231 17.7872 6.96694C17.475 6.97157 17.2189 7.08073 17.0191 7.29441C16.828 7.5081 16.7347 7.77537 16.7393 8.09623C16.7439 8.41708 16.8445 8.68568 17.0423 8.90201V8.90267Z" fill="#232323"/>
+<path id="Vector_5" d="M29.1622 4.57473C29.9051 4.56415 30.484 4.78577 30.9001 5.2396C31.3162 5.6941 31.5299 6.34706 31.5425 7.19981L31.5809 9.87781C31.5901 10.5248 31.0735 11.0567 30.4264 11.066C29.7794 11.0752 29.2475 10.5586 29.2383 9.91155L29.2045 7.55044C29.1979 7.06948 28.9789 6.83198 28.5483 6.83794C28.0501 6.84521 27.806 7.16078 27.8146 7.78529L27.8457 9.9314C27.855 10.5784 27.3383 11.1103 26.6913 11.1196C26.0443 11.1288 25.5124 10.6121 25.5031 9.96514L25.4694 7.60403C25.4627 7.12307 25.2438 6.88557 24.8131 6.89152C24.3149 6.8988 24.0708 7.21436 24.0794 7.83888L24.1105 9.98499C24.1198 10.632 23.6031 11.1639 22.9561 11.1732C22.3091 11.1824 21.7772 10.6657 21.7679 10.0187L21.711 6.08243C21.7011 5.40698 22.2409 4.85127 22.9164 4.842L23.4404 4.83473C23.7691 4.8301 24.0391 5.09274 24.0437 5.42153C24.4499 4.90088 25.0202 4.63494 25.7545 4.62435C26.4802 4.61377 27.0115 4.8678 27.3482 5.38647C27.7967 4.85656 28.4001 4.58598 29.1602 4.5754L29.1622 4.57473Z" fill="#232323"/>
+</g>
+</g>
+</g>
+</svg>
diff --git a/mobile/packages/legacy/assets/legacy_kit_sheet_ente_logo_black.svg b/mobile/packages/legacy/assets/legacy_kit_sheet_ente_logo_black.svg
new file mode 100644
index 0000000000..3f00a5be42
--- /dev/null
+++ b/mobile/packages/legacy/assets/legacy_kit_sheet_ente_logo_black.svg
@@ -0,0 +1,10 @@
+<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 75.6692 22.4932" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="Group 1597881792">
+<g id="ente">
+<path d="M19.2528 14.9332H6.40517C7.02583 16.4476 8.4161 17.2048 10.576 17.2048C11.8918 17.2048 13.0214 16.7703 13.9648 15.9014L18.4335 19.0295C16.6212 21.3383 13.9524 22.4928 10.427 22.4928C7.27409 22.4928 4.74181 21.5742 2.83019 19.737C0.943398 17.8751 0 15.529 0 12.6988C0 9.89344 0.930984 7.54736 2.79295 5.66057C4.65492 3.77377 7.02583 2.83037 9.90568 2.83037C12.6862 2.83037 14.9826 3.76136 16.795 5.62333C18.6073 7.46047 19.5134 9.79414 19.5134 12.6243C19.5134 13.4932 19.4265 14.2629 19.2528 14.9332ZM6.33069 10.6506H13.4807C13.009 8.9128 11.8421 8.04388 9.98015 8.04388C8.06853 8.04388 6.85205 8.9128 6.33069 10.6506Z" fill="#212121"/>
+<path d="M32.7943 2.83037C34.8549 2.83037 36.5058 3.53792 37.7471 4.95302C39.0133 6.34329 39.6464 8.30456 39.6464 10.8368V21.9714H33.4646V11.6189C33.4646 10.6755 33.2163 9.95551 32.7198 9.45898C32.2233 8.93763 31.5406 8.67695 30.6717 8.67695C29.7034 8.67695 28.9462 8.97487 28.4001 9.5707C27.8787 10.1417 27.618 10.9734 27.618 12.0657V21.9714H21.4363V3.35173H27.618V5.21369C28.7352 3.62481 30.4606 2.83037 32.7943 2.83037Z" fill="#212121"/>
+<path d="M54.3392 3.35173V9.27278H50.4663V14.6725C50.4663 15.4669 50.7394 15.9759 51.2856 16.1993C51.8566 16.3979 52.8745 16.46 54.3392 16.3855V21.9714C50.6649 22.4183 48.0582 22.0831 46.5189 20.9659C45.0294 19.7991 44.2846 17.7509 44.2846 14.8215V9.27278H41.4916V3.35173H44.2846V0.00018053L50.4663 0.000111465V3.35173H54.3392Z" fill="#212121"/>
+<path d="M75.4085 14.9336H62.5609C63.1816 16.448 64.5719 17.2052 66.7317 17.2052C68.0475 17.2052 69.1771 16.7708 70.1205 15.9019L74.5892 19.03C72.7769 21.3388 70.1081 22.4932 66.5828 22.4932C63.4298 22.4932 60.8976 21.5747 58.9859 19.7375C57.0991 17.8755 56.1557 15.5295 56.1557 12.6993C56.1557 9.89391 57.0867 7.54783 58.9487 5.66103C60.8107 3.77424 63.1816 2.83084 66.0614 2.83084C68.842 2.83084 71.1384 3.76183 72.9507 5.6238C74.763 7.46094 75.6692 9.7946 75.6692 12.6248C75.6692 13.4937 75.5823 14.2633 75.4085 14.9336ZM62.4864 10.6511H69.6364C69.1647 8.91327 67.9979 8.04435 66.1359 8.04435C64.2243 8.04435 63.0078 8.91327 62.4864 10.6511Z" fill="#212121"/>
+</g>
+</g>
+</svg>
diff --git a/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart b/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart
index 38262bf7d2..002a3bd56e 100644
--- a/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart
+++ b/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart
@@ -16,8 +16,10 @@ class LegacyKitPdfService {
static const String _heroBgRightAsset =
"$_assetRoot/legacy_kit_sheet_hero_bg_right.svg";
static const String _logoAsset = "$_assetRoot/legacy_kit_sheet_logo.svg";
- static const String _enteWordmarkAsset =
- "$_assetRoot/legacy_kit_sheet_ente_wordmark.svg";
+ static const String _enteLogoBlackAsset =
+ "$_assetRoot/legacy_kit_sheet_ente_logo_black.svg";
+ static const String _enteComBadgeAsset =
+ "$_assetRoot/legacy_kit_sheet_ente_com_badge.svg";
static const String _interRegularAsset = "assets/fonts/Inter-Regular.ttf";
static const String _interMediumAsset = "assets/fonts/Inter-Medium.ttf";
static const String _interBoldAsset = "assets/fonts/Inter-Bold.ttf";
@@ -25,12 +27,18 @@ class LegacyKitPdfService {
static const PdfPageFormat _sheetPageFormat = PdfPageFormat(676, 900);
static const PdfColor _background = PdfColor.fromInt(0xFFFAFAFA);
static const PdfColor _green = PdfColor.fromInt(0xFF08C225);
- static const PdfColor _heroBadge = PdfColor.fromInt(0xFF057C18);
+ static const PdfColor _blue = PdfColor.fromInt(0xFF1071FF);
static const PdfColor _dark = PdfColor.fromInt(0xFF212121);
static const PdfColor _black = PdfColor.fromInt(0xFF000000);
static const PdfColor _white = PdfColor.fromInt(0xFFFFFFFF);
static const PdfColor _muted = PdfColor.fromInt(0xFF969696);
- static const PdfColor _lightText = PdfColor.fromInt(0xFFE5E5E5);
+ static const PdfColor _textLight = PdfColor.fromInt(0xFF999999);
+ static const PdfColor _copyCodeBackground = PdfColor.fromInt(0xFF666666);
+ static const PdfColor _chipBackground = PdfColor.fromInt(0xFF0A0A0A);
+ static const List<PdfColor> _holderChipColors = [
+ PdfColor.fromInt(0xFFFFA939),
+ PdfColor.fromInt(0xFFF24822),
+ ];
Future<Uint8List> buildRecoverySheet({
required String accountEmail,
@@ -68,7 +76,8 @@ class LegacyKitPdfService {
heroBgLeftSvg: await _loadSvg(_heroBgLeftAsset),
heroBgRightSvg: await _loadSvg(_heroBgRightAsset),
logoSvg: await _loadSvg(_logoAsset),
- enteWordmarkSvg: await _loadSvg(_enteWordmarkAsset),
+ enteLogoBlackSvg: await _loadSvg(_enteLogoBlackAsset),
+ enteComBadgeSvg: await _loadSvg(_enteComBadgeAsset),
theme: baseFont == null && interBold == null
? null
: pw.ThemeData.withFont(
@@ -160,37 +169,123 @@ class LegacyKitPdfService {
}) {
final qrPayload = share.toQrPayload();
final copyCode = share.toCopyCode();
- return pw.Container(
- color: _background,
- padding: const pw.EdgeInsets.fromLTRB(42, 40, 42, 40),
- child: pw.Column(
- crossAxisAlignment: pw.CrossAxisAlignment.start,
- children: [
- _header(assets),
- pw.SizedBox(height: 29),
- _hero(accountEmail, share, assets),
- pw.SizedBox(height: 32),
- pw.Text(
- "How to recover the account?",
- style: pw.TextStyle(
- color: _black,
- fontSize: 20,
- fontWeight: pw.FontWeight.bold,
+ return pw.SizedBox(
+ width: _sheetPageFormat.width,
+ height: _sheetPageFormat.height,
+ child: pw.Container(
+ color: _background,
+ child: pw.Stack(
+ fit: pw.StackFit.expand,
+ children: [
+ pw.Positioned(
+ left: 42,
+ top: 66,
+ child: _header(assets),
),
- ),
- pw.SizedBox(height: 12),
- _recoveryBlock(qrPayload, copyCode, otherShares, recoveryUrl),
- pw.Spacer(),
- pw.Center(
- child: pw.Text(
- "Store this sheet somewhere safe.\nOn its own, this sheet cannot unlock the account.",
- textAlign: pw.TextAlign.center,
- style: const pw.TextStyle(
- color: _muted,
- fontSize: 12,
- lineSpacing: 3,
+ pw.Positioned(
+ left: 550,
+ top: 52,
+ child: _enteLockup(assets),
+ ),
+ pw.Positioned(
+ left: 456,
+ top: 97,
+ child: pw.Text(
+ "Protect your digital life",
+ style: pw.TextStyle(
+ color: _black,
+ fontSize: 15.7,
+ fontWeight: pw.FontWeight.bold,
+ ),
+ ),
+ ),
+ pw.Positioned(
+ left: 42,
+ top: 162,
+ child: _hero(accountEmail, share, assets),
+ ),
+ pw.Positioned(
+ left: 66,
+ top: 418,
+ child: pw.Text(
+ "How to recover the account?",
+ style: pw.TextStyle(
+ color: _black,
+ fontSize: 20,
+ fontWeight: pw.FontWeight.bold,
+ ),
),
),
+ pw.Positioned(
+ left: 42,
+ top: 453,
+ child: _recoveryBlock(
+ qrPayload,
+ copyCode,
+ otherShares,
+ recoveryUrl,
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ pw.Widget _enteLockup(_SheetAssets assets) {
+ final enteLogoSvg = assets.enteLogoBlackSvg;
+ final enteComBadgeSvg = assets.enteComBadgeSvg;
+ return pw.SizedBox(
+ width: 82,
+ height: 38,
+ child: pw.Stack(
+ children: [
+ pw.Positioned(
+ left: 0,
+ top: 0,
+ child: enteLogoSvg == null
+ ? pw.Text(
+ "ente",
+ style: pw.TextStyle(
+ color: _dark,
+ fontSize: 26,
+ fontWeight: pw.FontWeight.bold,
+ ),
+ )
+ : pw.SizedBox(
+ width: 75.7,
+ height: 22.5,
+ child: pw.SvgImage(svg: enteLogoSvg),
+ ),
+ ),
+ pw.Positioned(
+ left: 44,
+ top: 20,
+ child: enteComBadgeSvg == null
+ ? pw.Container(
+ width: 37,
+ height: 16,
+ decoration: const pw.BoxDecoration(
+ color: _green,
+ borderRadius:
+ pw.BorderRadius.all(pw.Radius.circular(999)),
+ ),
+ child: pw.Center(
+ child: pw.Text(
+ ".com",
+ style: pw.TextStyle(
+ color: _dark,
+ fontSize: 7.5,
+ fontWeight: pw.FontWeight.bold,
+ ),
+ ),
+ ),
+ )
+ : pw.SizedBox(
+ width: 36.7,
+ height: 16.1,
+ child: pw.SvgImage(svg: enteComBadgeSvg),
+ ),
),
],
),
@@ -199,9 +294,9 @@ class LegacyKitPdfService {
pw.Widget _header(_SheetAssets assets) {
final logoSvg = assets.logoSvg;
- final enteWordmarkSvg = assets.enteWordmarkSvg;
return pw.Row(
mainAxisSize: pw.MainAxisSize.min,
+ crossAxisAlignment: pw.CrossAxisAlignment.center,
children: [
logoSvg == null
? _fallbackHeaderLogo()
@@ -211,32 +306,13 @@ class LegacyKitPdfService {
child: pw.SvgImage(svg: logoSvg),
),
pw.SizedBox(width: 10),
- pw.Column(
- crossAxisAlignment: pw.CrossAxisAlignment.start,
- children: [
- enteWordmarkSvg == null
- ? pw.Text(
- "ente",
- style: pw.TextStyle(
- color: _green,
- fontSize: 22,
- fontWeight: pw.FontWeight.bold,
- ),
- )
- : pw.SizedBox(
- width: 52,
- height: 16,
- child: pw.SvgImage(svg: enteWordmarkSvg),
- ),
- pw.SizedBox(height: 4),
- pw.Text(
- "Legacy Kit",
- style: const pw.TextStyle(
- color: _muted,
- fontSize: 12,
- ),
- ),
- ],
+ pw.Text(
+ "Legacy Kit",
+ style: pw.TextStyle(
+ color: const PdfColor.fromInt(0xFF1C1C1C),
+ fontSize: 20,
+ fontWeight: pw.FontWeight.bold,
+ ),
),
],
);
@@ -273,8 +349,8 @@ class LegacyKitPdfService {
verticalRadius: 24,
child: pw.Container(
width: 592,
- height: 213,
- color: _green,
+ height: 218,
+ color: _blue,
child: pw.Stack(
fit: pw.StackFit.expand,
children: [
@@ -305,7 +381,7 @@ class LegacyKitPdfService {
),
if (assets.duckyImage != null)
pw.Positioned(
- left: 386,
+ left: 398,
top: 37,
child: pw.Image(
pw.MemoryImage(assets.duckyImage!),
@@ -346,26 +422,83 @@ class LegacyKitPdfService {
),
pw.SizedBox(height: 12),
pw.Container(
- padding: const pw.EdgeInsets.symmetric(
- horizontal: 14,
- vertical: 8,
- ),
+ width: 278,
+ height: 32,
+ padding: const pw.EdgeInsets.symmetric(horizontal: 12),
decoration: const pw.BoxDecoration(
- color: _heroBadge,
+ color: PdfColor(0, 0, 0, 0.36),
borderRadius: pw.BorderRadius.all(pw.Radius.circular(12)),
),
- child: pw.Text(
- "Legacy Kit for $accountEmail",
- style: const pw.TextStyle(color: _white, fontSize: 14),
+ child: pw.Row(
+ children: [
+ _personIcon(),
+ pw.SizedBox(width: 6),
+ pw.Expanded(
+ child: pw.Text(
+ "Legacy Kit for $accountEmail",
+ maxLines: 1,
+ overflow: pw.TextOverflow.clip,
+ style: const pw.TextStyle(
+ color: _white,
+ fontSize: 14,
+ ),
+ ),
+ ),
+ ],
),
),
pw.SizedBox(height: 12),
pw.Text(
- "This sheet is one part of a recovery key. If $accountEmail loses access, this and any one other can recover their account.",
+ "Store this somewhere safe",
+ style: pw.TextStyle(
+ color: _white,
+ fontSize: 16,
+ fontWeight: pw.FontWeight.bold,
+ lineSpacing: 3,
+ ),
+ ),
+ pw.SizedBox(height: 6),
+ pw.Text(
+ "This is part of a legacy kit and can be used with any other part to\nget access to $accountEmail's Ente account",
style: const pw.TextStyle(
color: PdfColor(1, 1, 1, 0.86),
- fontSize: 12,
- lineSpacing: 3,
+ fontSize: 11,
+ lineSpacing: 2,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ pw.Widget _personIcon() {
+ return pw.SizedBox(
+ width: 12,
+ height: 12,
+ child: pw.Stack(
+ children: [
+ pw.Positioned(
+ left: 4,
+ top: 2,
+ child: pw.Container(
+ width: 4,
+ height: 4,
+ decoration: const pw.BoxDecoration(
+ color: _white,
+ shape: pw.BoxShape.circle,
+ ),
+ ),
+ ),
+ pw.Positioned(
+ left: 2.5,
+ top: 6.5,
+ child: pw.Container(
+ width: 7,
+ height: 3.5,
+ decoration: const pw.BoxDecoration(
+ color: _white,
+ borderRadius: pw.BorderRadius.all(pw.Radius.circular(3)),
+ ),
),
),
],
@@ -381,7 +514,7 @@ class LegacyKitPdfService {
) {
return pw.Container(
width: 592,
- height: 429,
+ height: 406,
padding: const pw.EdgeInsets.all(24),
decoration: const pw.BoxDecoration(
color: _dark,
@@ -398,7 +531,7 @@ class LegacyKitPdfService {
pw.Container(
width: 200,
height: 200,
- padding: const pw.EdgeInsets.all(20),
+ padding: const pw.EdgeInsets.all(25),
decoration: const pw.BoxDecoration(
color: _white,
borderRadius: pw.BorderRadius.all(pw.Radius.circular(20)),
@@ -408,26 +541,13 @@ class LegacyKitPdfService {
data: qrPayload,
),
),
- pw.SizedBox(height: 6),
- pw.Text(
- "OR",
- style: pw.TextStyle(
- color: _white,
- fontSize: 16,
- fontWeight: pw.FontWeight.bold,
- ),
- ),
- pw.Text(
- "copy code text",
- style: const pw.TextStyle(color: _lightText, fontSize: 12),
- ),
- pw.SizedBox(height: 6),
+ pw.SizedBox(height: 32),
pw.Container(
width: 242,
height: 126,
padding: const pw.EdgeInsets.all(12),
decoration: pw.BoxDecoration(
- color: _green,
+ color: _copyCodeBackground,
border: pw.Border.all(
color: _white,
width: 1,
@@ -438,7 +558,7 @@ class LegacyKitPdfService {
),
child: pw.Center(
child: pw.Text(
- copyCode,
+ _displayCopyCode(copyCode),
textAlign: pw.TextAlign.center,
style: pw.TextStyle(
color: _background,
@@ -455,35 +575,24 @@ class LegacyKitPdfService {
pw.Spacer(),
pw.SizedBox(
width: 266,
+ height: 358,
child: pw.Column(
mainAxisAlignment: pw.MainAxisAlignment.center,
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
_instruction(
"1.",
- "Get one other sheet. The other holders are:",
+ "Get another part of the kit from",
extra: _holderChips(otherShares),
- bottomPadding: 24,
- ),
- _instruction(
- "2.",
- "Go to ${displayRecoveryUrl(recoveryUrl)} and click Start recovery",
- bottomPadding: 24,
- ),
- _instruction(
- "3.",
- "Scan the QR codes from both sheets",
- bottomPadding: 24,
),
+ pw.SizedBox(height: 31),
+ _visitInstruction(recoveryUrl),
+ pw.SizedBox(height: 31),
+ _instruction("3.", "Upload both parts"),
+ pw.SizedBox(height: 31),
_instruction(
"4.",
- "Wait through the recovery period (if one is set).",
- bottomPadding: 24,
- ),
- _instruction(
- "5.",
- "Return to the site to get the recovery key",
- bottomPadding: 0,
+ "Change the password to gain\naccount access",
),
],
),
@@ -497,42 +606,92 @@ class LegacyKitPdfService {
String number,
String text, {
pw.Widget? extra,
- double bottomPadding = 16,
}) {
- return pw.Padding(
- padding: pw.EdgeInsets.only(bottom: bottomPadding),
- child: pw.Row(
- crossAxisAlignment: pw.CrossAxisAlignment.start,
- children: [
- pw.SizedBox(
- width: 20,
- child: pw.Text(
- number,
- style: const pw.TextStyle(color: _muted, fontSize: 14),
+ return _instructionContent(
+ number,
+ pw.Text(
+ text,
+ style: const pw.TextStyle(
+ color: _white,
+ fontSize: 14,
+ lineSpacing: 3,
+ ),
+ ),
+ extra: extra,
+ );
+ }
+
+ String _displayCopyCode(String copyCode) {
+ const chunkSize = 36;
+ final compactCode = copyCode.replaceAll(RegExp(r"\s+"), "");
+ final chunks = <String>[];
+ for (var index = 0; index < compactCode.length; index += chunkSize) {
+ final nextIndex = index + chunkSize;
+ final end =
+ nextIndex > compactCode.length ? compactCode.length : nextIndex;
+ chunks.add(compactCode.substring(index, end));
+ }
+ return chunks.join("\n");
+ }
+
+ pw.Widget _visitInstruction(String recoveryUrl) {
+ const textStyle = pw.TextStyle(
+ color: _white,
+ fontSize: 14,
+ lineSpacing: 3,
+ );
+ return _instructionContent(
+ "2.",
+ pw.RichText(
+ text: pw.TextSpan(
+ style: textStyle,
+ children: [
+ const pw.TextSpan(text: "Visit "),
+ pw.TextSpan(
+ text: displayRecoveryUrl(recoveryUrl),
+ style: const pw.TextStyle(
+ color: _white,
+ decoration: pw.TextDecoration.underline,
+ ),
),
+ ],
+ ),
+ ),
+ );
+ }
+
+ pw.Widget _instructionContent(
+ String number,
+ pw.Widget content, {
+ pw.Widget? extra,
+ }) {
+ return pw.Row(
+ crossAxisAlignment: pw.CrossAxisAlignment.start,
+ children: [
+ pw.SizedBox(
+ width: 14,
+ child: pw.Text(
+ number,
+ style: const pw.TextStyle(color: _muted, fontSize: 14),
),
- pw.SizedBox(width: 4),
- pw.Expanded(
- child: pw.Column(
- crossAxisAlignment: pw.CrossAxisAlignment.start,
- children: [
- pw.Text(
- text,
- style: const pw.TextStyle(
- color: _white,
- fontSize: 14,
- lineSpacing: 3,
- ),
+ ),
+ pw.SizedBox(width: 10),
+ pw.Expanded(
+ child: pw.Column(
+ crossAxisAlignment: pw.CrossAxisAlignment.start,
+ children: [
+ content,
+ if (extra != null) ...[
+ pw.SizedBox(height: 8),
+ pw.Padding(
+ padding: const pw.EdgeInsets.only(left: 8),
+ child: extra,
),
- if (extra != null) ...[
- pw.SizedBox(height: 8),
- extra,
- ],
],
- ),
+ ],
),
- ],
- ),
+ ),
+ ],
);
}
@@ -540,18 +699,23 @@ class LegacyKitPdfService {
return pw.Wrap(
spacing: 6,
runSpacing: 6,
- children: shares.map(_holderChip).toList(growable: false),
+ children: shares
+ .asMap()
+ .entries
+ .map((entry) => _holderChip(entry.value, entry.key))
+ .toList(growable: false),
);
}
- pw.Widget _holderChip(LegacyKitShare share) {
+ pw.Widget _holderChip(LegacyKitShare share, int chipIndex) {
final initial = share.partName.trim().isEmpty
? "?"
: share.partName.trim()[0].toUpperCase();
+ final chipColor = _holderChipColors[chipIndex % _holderChipColors.length];
return pw.Container(
padding: const pw.EdgeInsets.fromLTRB(4, 4, 10, 4),
decoration: const pw.BoxDecoration(
- color: PdfColor.fromInt(0xFF0A0A0A),
+ color: _chipBackground,
// The PDF renderer does not clamp pill radii like Flutter does.
borderRadius: pw.BorderRadius.all(pw.Radius.circular(16)),
),
@@ -561,8 +725,8 @@ class LegacyKitPdfService {
pw.Container(
width: 24,
height: 24,
- decoration: const pw.BoxDecoration(
- color: PdfColor.fromInt(0xFFFFA939),
+ decoration: pw.BoxDecoration(
+ color: chipColor,
shape: pw.BoxShape.circle,
),
child: pw.Center(
@@ -575,7 +739,7 @@ class LegacyKitPdfService {
pw.SizedBox(width: 6),
pw.Text(
share.partName,
- style: const pw.TextStyle(color: _muted, fontSize: 12),
+ style: const pw.TextStyle(color: _textLight, fontSize: 12),
),
],
),
@@ -593,7 +757,8 @@ class _SheetAssets {
final String? heroBgLeftSvg;
final String? heroBgRightSvg;
final String? logoSvg;
- final String? enteWordmarkSvg;
+ final String? enteLogoBlackSvg;
+ final String? enteComBadgeSvg;
final pw.ThemeData? theme;
const _SheetAssets({
@@ -601,7 +766,8 @@ class _SheetAssets {
required this.heroBgLeftSvg,
required this.heroBgRightSvg,
required this.logoSvg,
- required this.enteWordmarkSvg,
+ required this.enteLogoBlackSvg,
+ required this.enteComBadgeSvg,
required this.theme,
});
}