Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

feat: shorten did uri in QrCodePage #329

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)}';
}
Loading