π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][auth] Fix QR code min size and constrain account/issuer text to single line
Prateek Sunal31ae06241b2f
diff --git a/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart b/mobile/apps/auth/lib/onboarding/view/view_qr_page.dartindex 17c3342bdb..5c6e2f8b12 100644--- a/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart+++ b/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart@@ -17,6 +17,8 @@ class ViewQrPage extends StatelessWidget {Widget build(BuildContext context) {final screenWidth = MediaQuery.of(context).size.width;final double qrSize = min(screenWidth - 80, 300.0);+ final double qrCodeSize =+ max(qrSize - 100, 150.0); // Ensure minimum size of 150final enteTextTheme = getEnteTextTheme(context);final l10n = context.l10n;@@ -29,11 +31,7 @@ class ViewQrPage extends StatelessWidget {// QR text color - always black for scanabilityconst qrTextColor = textBaseLight;- // Get account name, truncate if too long- final String accountName = (code?.account ?? '').length > 30- ? '${(code?.account ?? '').substring(0, 27)}...'- : code?.account ?? '';-+ final String accountName = code?.account ?? '';final String issuerName = code?.issuer ?? '';return Scaffold(@@ -63,31 +61,45 @@ class ViewQrPage extends StatelessWidget {crossAxisAlignment: CrossAxisAlignment.center,children: [// Account name at top center (inside border)- Text(- accountName,- style: enteTextTheme.largeBold.copyWith(- color: qrTextColor,- fontSize: 20,+ ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: qrCodeSize + 40,+ ),+ child: Text(+ accountName,+ style: enteTextTheme.largeBold.copyWith(+ color: qrTextColor,+ fontSize: 20,+ ),+ textAlign: TextAlign.center,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,),- textAlign: TextAlign.center,),if (issuerName.isNotEmpty) ...[const SizedBox(height: 4),- Text(- issuerName,- style: enteTextTheme.small.copyWith(- color: qrTextColor.withValues(alpha: 0.7),- fontSize: 14,+ ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: qrCodeSize,+ ),+ child: Text(+ issuerName,+ style: enteTextTheme.small.copyWith(+ color: qrTextColor.withValues(alpha: 0.7),+ fontSize: 14,+ ),+ textAlign: TextAlign.center,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,),- textAlign: TextAlign.center,),],const SizedBox(height: 20),// QR Code with pretty stylingSizedBox(- width: qrSize - 100,- height: qrSize - 100,+ width: qrCodeSize,+ height: qrCodeSize,child: PrettyQrView(qrImage: QrImage(QrCode.fromData(diff --git a/mobile/apps/auth/lib/ui/qr_code_dialog.dart b/mobile/apps/auth/lib/ui/qr_code_dialog.dartindex 8aa39912d7..7b449dce35 100644--- a/mobile/apps/auth/lib/ui/qr_code_dialog.dart+++ b/mobile/apps/auth/lib/ui/qr_code_dialog.dart@@ -84,11 +84,7 @@ class _QrCodeDialogState extends State<QrCodeDialog> {.replaceAll('algorithm=sha256', 'algorithm=SHA256').replaceAll('algorithm=sha512', 'algorithm=SHA512');- // Get account name, truncate if too long- final String accountName = (widget.code.account).length > 30- ? '${(widget.code.account).substring(0, 27)}...'- : widget.code.account;-+ final String accountName = widget.code.account;final String issuerName = widget.code.issuer;// QR text color - always black for scanability@@ -164,23 +160,37 @@ class _QrCodeDialogState extends State<QrCodeDialog> {crossAxisAlignment: CrossAxisAlignment.center,children: [// Account name at top center (inside border)- Text(- accountName,- style: enteTextTheme.largeBold.copyWith(- color: qrTextColor,- fontSize: 20,+ ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: qrCodeSize + 40,+ ),+ child: Text(+ accountName,+ style: enteTextTheme.largeBold.copyWith(+ color: qrTextColor,+ fontSize: 20,+ ),+ textAlign: TextAlign.center,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,),- textAlign: TextAlign.center,),if (issuerName.isNotEmpty) ...[const SizedBox(height: 4),- Text(- issuerName,- style: enteTextTheme.small.copyWith(- color: qrTextColor.withValues(alpha: 0.7),- fontSize: 14,+ ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: qrCodeSize,+ ),+ child: Text(+ issuerName,+ style: enteTextTheme.small.copyWith(+ color: qrTextColor.withValues(alpha: 0.7),+ fontSize: 14,+ ),+ textAlign: TextAlign.center,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,),- textAlign: TextAlign.center,),],const SizedBox(height: 20),diff --git a/mobile/apps/auth/pubspec.lock b/mobile/apps/auth/pubspec.lockindex e467295970..eca0279ead 100644--- a/mobile/apps/auth/pubspec.lock+++ b/mobile/apps/auth/pubspec.lock@@ -1354,7 +1354,7 @@ packages:description:path: "."ref: HEAD- resolved-ref: "912bf168492c90ee2a20b2997926372eb18adb0f"+ resolved-ref: "80ebafb9c99ac22520092b008579013d2fcffbe1"url: "https://github.com/ente-io/flutter_pretty_qr_fork"source: gitversion: "3.5.0"