From 5ba9e5cda8bb27d291fb1c8348af803834492ec2 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 31 Oct 2024 14:58:53 -0700 Subject: [PATCH] shorten did uri in `QrCodePage` --- lib/features/qr/qr_code_page.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/features/qr/qr_code_page.dart b/lib/features/qr/qr_code_page.dart index 738e6a8a..3589f002 100644 --- a/lib/features/qr/qr_code_page.dart +++ b/lib/features/qr/qr_code_page.dart @@ -61,7 +61,6 @@ class QrCodePage extends HookConsumerWidget { children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: Grid.sm), - // TODO(ethan-tbd): remove portable did copy feature child: ListTile( trailing: IconButton( icon: const Icon(Icons.copy), @@ -81,7 +80,7 @@ class QrCodePage extends HookConsumerWidget { ), title: Center( child: AutoSizeText( - did.uri, + _shortenUri(did.uri), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.bold, ), @@ -142,4 +141,8 @@ class QrCodePage extends HookConsumerWidget { dataModuleShape: QrDataModuleShape.square, ), ); + + String _shortenUri(String uri) => uri.length <= 25 + ? uri + : '${uri.substring(0, 25)}...${uri.substring(uri.length - 7)}'; }