Skip to content

Commit

Permalink
feat: shorten did uri in QrCodePage (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd authored Nov 4, 2024
1 parent 12ab233 commit 67a2a33
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/features/qr/qr_code_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
),
Expand Down Expand Up @@ -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)}';
}

0 comments on commit 67a2a33

Please sign in to comment.