Improve seed grid sizing (#2687)
* Attempt to improve seed grid layout and sizing * Cleanup
tuxsudo committed
Dec 1, 2025 at 23:19 UTC
1d715d3963bb9e6d81fc22fe60f73e4a2ae4062e
1 file changed
+19
-3
lib/src/widgets/seedphrase_grid_widget.dart
+19
-3
@@ -8,13 +8,27 @@ class SeedPhraseGridWidget extends StatelessWidget {
8
9
final List<String> list;
10
11
+
12
+
13
@override
14
Widget build(BuildContext context) {
15
+
16
+ double desiredTileWidth = 120;
17
+ double spacing = 4;
18
+ double padding = 4;
19
+ double screenWidth = MediaQuery.of(context).size.width;
20
+
21
+ int crossAxisCount =
22
+ ((screenWidth + spacing - (2 * padding)) / (desiredTileWidth + spacing))
23
+ .floor();
24
+
25
+ if (crossAxisCount < 1) crossAxisCount = 1;
26
+
27
return GridView.builder(
28
itemCount: list.length,
29
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
16
- crossAxisCount: 3,
17
- childAspectRatio: 2.8,
30
+ crossAxisCount: crossAxisCount,
31
+ childAspectRatio: 2.6,
32
mainAxisSpacing: 8.0,
33
crossAxisSpacing: 8.0,
34
),
@@ -41,6 +55,8 @@ class SeedPhraseGridWidget extends StatelessWidget {
55
fontWeight: FontWeight.w700,
56
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
57
),
58
+ softWrap: true,
59
+ maxLines: null,
60
),
61
),
62
const SizedBox(width: 6),
@@ -48,7 +64,7 @@ class SeedPhraseGridWidget extends StatelessWidget {
64
child: Text(
65
'${item[0].toLowerCase()}${item.substring(1)}',
66
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
51
- height: 1.9,
67
+ height: 1,
68
fontWeight: FontWeight.w700,
69
color: Theme.of(context).colorScheme.onSurface,
70
),