Improve seed grid sizing (#2687)
What changed, and why it matters
This commit adjusts how a wallet's recovery seed phrase is displayed on screen. It makes the grid of seed words resize automatically based on screen width and tweaks text wrapping and line spacing so the words fit better. There is no security-relevant change here.
No security action required. Treat as a normal UI/layout improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies lib/src/widgets/seedphrase_grid_widget.dart, a Flutter UI widget that renders a mnemonic seed phrase grid. It replaces a hardcoded crossAxisCount of 3 with a computed value based on MediaQuery screen width, desired tile width, spacing, and padding, and clamps the result to at least 1. It also enables softWrap and removes maxLines constraints on the index label, and reduces text height from 1.9 to 1. These are purely presentational/layout changes.
Changed components
lib/src/widgets/seedphrase_grid_widget.dartInspect captured patch +19 / −3
diff --git a/lib/src/widgets/seedphrase_grid_widget.dart b/lib/src/widgets/seedphrase_grid_widget.dart
index fb6c62d3..df8535f5 100644
--- a/lib/src/widgets/seedphrase_grid_widget.dart
+++ b/lib/src/widgets/seedphrase_grid_widget.dart
@@ -8,13 +8,27 @@ class SeedPhraseGridWidget extends StatelessWidget {
final List<String> list;
+
+
@override
Widget build(BuildContext context) {
+
+ double desiredTileWidth = 120;
+ double spacing = 4;
+ double padding = 4;
+ double screenWidth = MediaQuery.of(context).size.width;
+
+ int crossAxisCount =
+ ((screenWidth + spacing - (2 * padding)) / (desiredTileWidth + spacing))
+ .floor();
+
+ if (crossAxisCount < 1) crossAxisCount = 1;
+
return GridView.builder(
itemCount: list.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 3,
- childAspectRatio: 2.8,
+ crossAxisCount: crossAxisCount,
+ childAspectRatio: 2.6,
mainAxisSpacing: 8.0,
crossAxisSpacing: 8.0,
),
@@ -41,6 +55,8 @@ class SeedPhraseGridWidget extends StatelessWidget {
fontWeight: FontWeight.w700,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
),
+ softWrap: true,
+ maxLines: null,
),
),
const SizedBox(width: 6),
@@ -48,7 +64,7 @@ class SeedPhraseGridWidget extends StatelessWidget {
child: Text(
'${item[0].toLowerCase()}${item.substring(1)}',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
- height: 1.9,
+ height: 1,
fontWeight: FontWeight.w700,
color: Theme.of(context).colorScheme.onSurface,
),
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.