Skip to content

Commit e74731b

Browse files
committed
add(ui): reclaim further vertical assets list space
1 parent cbead71 commit e74731b

File tree

4 files changed

+88
-77
lines changed

4 files changed

+88
-77
lines changed

lib/views/wallet/wallet_page/wallet_main/wallet_main.dart

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:math' as math;
32
import 'package:flutter/gestures.dart';
43

54
import 'package:app_theme/app_theme.dart';
@@ -115,9 +114,8 @@ class _WalletMainState extends State<WalletMain>
115114

116115
return PageLayout(
117116
noBackground: true,
118-
header: isMobile
119-
? PageHeader(title: LocaleKeys.wallet.tr())
120-
: null,
117+
header:
118+
isMobile ? PageHeader(title: LocaleKeys.wallet.tr()) : null,
121119
content: Expanded(
122120
child: Listener(
123121
onPointerSignal: _onPointerSignal,
@@ -325,11 +323,11 @@ class _WalletMainState extends State<WalletMain>
325323
_walletHalfLogged = true;
326324
final coinsCount = context.read<CoinsBloc>().state.walletCoins.length;
327325
context.read<AnalyticsBloc>().logEvent(
328-
WalletListHalfViewportReachedEventData(
329-
timeToHalfMs: _walletListStopwatch.elapsedMilliseconds,
330-
walletSize: coinsCount,
331-
),
332-
);
326+
WalletListHalfViewportReachedEventData(
327+
timeToHalfMs: _walletListStopwatch.elapsedMilliseconds,
328+
walletSize: coinsCount,
329+
),
330+
);
333331
}
334332
}
335333

@@ -342,11 +340,11 @@ class _WalletMainState extends State<WalletMain>
342340

343341
if (newOffset == _scrollController.offset) {
344342
context.read<AnalyticsBloc>().logEvent(
345-
ScrollAttemptOutsideContentEventData(
346-
screenContext: 'wallet_page',
347-
scrollDelta: event.scrollDelta.dy,
348-
),
349-
);
343+
ScrollAttemptOutsideContentEventData(
344+
screenContext: 'wallet_page',
345+
scrollDelta: event.scrollDelta.dy,
346+
),
347+
);
350348
return;
351349
}
352350

@@ -415,8 +413,8 @@ class CoinListView extends StatelessWidget {
415413
searchPhrase: searchPhrase,
416414
onAssetItemTap: (assetId) => onAssetItemTap(
417415
context.read<CoinsBloc>().state.coins.values.firstWhere(
418-
(coin) => coin.assetId == assetId,
419-
),
416+
(coin) => coin.assetId == assetId,
417+
),
420418
),
421419
);
422420
}
@@ -436,24 +434,32 @@ class _SliverSearchBarDelegate extends SliverPersistentHeaderDelegate {
436434
final AuthorizeMode mode;
437435

438436
@override
439-
final double minExtent = 132;
437+
double get minExtent =>
438+
isMobile ? (mode == AuthorizeMode.logIn ? 64 : 64) : 68;
440439
@override
441-
final double maxExtent = 155;
440+
double get maxExtent =>
441+
isMobile ? (mode == AuthorizeMode.logIn ? 112 : 64) : 106;
442442

443443
@override
444444
Widget build(
445445
BuildContext context,
446446
double shrinkOffset,
447447
bool overlapsContent,
448448
) {
449-
// return SizedBox.expand();
450-
451-
return WalletManageSection(
452-
withBalance: withBalance,
453-
onSearchChange: onSearchChange,
454-
onWithBalanceChange: onWithBalanceChange,
455-
mode: mode,
456-
pinned: shrinkOffset > 0,
449+
// Apply collapse progress on both mobile and desktop
450+
final collapseProgress =
451+
(shrinkOffset / (maxExtent - minExtent)).clamp(0.0, 1.0);
452+
453+
return SizedBox(
454+
height: (maxExtent - shrinkOffset).clamp(minExtent, maxExtent),
455+
child: WalletManageSection(
456+
withBalance: withBalance,
457+
onSearchChange: onSearchChange,
458+
onWithBalanceChange: onWithBalanceChange,
459+
mode: mode,
460+
pinned: shrinkOffset > 0,
461+
collapseProgress: collapseProgress,
462+
),
457463
);
458464
}
459465

lib/views/wallet/wallet_page/wallet_main/wallet_manage_section.dart

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:web_dex/generated/codegen_loader.g.dart';
88
import 'package:web_dex/model/authorize_mode.dart';
99
import 'package:web_dex/router/state/routing_state.dart';
1010
import 'package:web_dex/router/state/wallet_state.dart';
11-
import 'package:web_dex/shared/widgets/hidden_without_wallet.dart';
1211
import 'package:web_dex/views/wallet/wallet_page/common/coins_list_header.dart';
1312
import 'package:web_dex/views/wallet/wallet_page/wallet_main/wallet_manager_search_field.dart';
1413

@@ -19,13 +18,15 @@ class WalletManageSection extends StatelessWidget {
1918
required this.onSearchChange,
2019
required this.onWithBalanceChange,
2120
required this.pinned,
21+
this.collapseProgress = 0.0,
2222
super.key,
2323
});
2424
final bool withBalance;
2525
final AuthorizeMode mode;
2626
final Function(bool) onWithBalanceChange;
2727
final Function(String) onSearchChange;
2828
final bool pinned;
29+
final double collapseProgress;
2930

3031
@override
3132
Widget build(BuildContext context) {
@@ -43,8 +44,8 @@ class WalletManageSection extends StatelessWidget {
4344
bool get isAuthenticated => mode == AuthorizeMode.logIn;
4445
Widget _buildDesktopSection(BuildContext context) {
4546
final ThemeData theme = Theme.of(context);
46-
return Padding(
47-
padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
47+
return Container(
48+
padding: const EdgeInsets.fromLTRB(16, 10, 16, 10),
4849
child: Column(
4950
mainAxisSize: MainAxisSize.min,
5051
children: [
@@ -57,13 +58,13 @@ class WalletManageSection extends StatelessWidget {
5758
child: WalletManagerSearchField(onChange: onSearchChange),
5859
),
5960
),
60-
if (isAuthenticated ) ...[
61-
Spacer(),
61+
if (isAuthenticated) ...[
62+
const Spacer(),
6263
CoinsWithBalanceCheckbox(
6364
withBalance: withBalance,
6465
onWithBalanceChange: onWithBalanceChange,
6566
),
66-
SizedBox(width: 24),
67+
const SizedBox(width: 24),
6768
UiPrimaryButton(
6869
buttonKey: const Key('add-assets-button'),
6970
onPressed: () => _onAddAssetsPress(context),
@@ -76,8 +77,14 @@ class WalletManageSection extends StatelessWidget {
7677
],
7778
],
7879
),
79-
Spacer(),
80-
CoinsListHeader(isAuth: mode == AuthorizeMode.logIn),
80+
// Collapse the column headers on desktop
81+
if (collapseProgress < 1.0) ...[
82+
SizedBox(height: (1.0 - collapseProgress) * 8),
83+
Opacity(
84+
opacity: 1.0 - collapseProgress,
85+
child: CoinsListHeader(isAuth: mode == AuthorizeMode.logIn),
86+
),
87+
],
8188
],
8289
),
8390
);
@@ -91,45 +98,43 @@ class WalletManageSection extends StatelessWidget {
9198
child: Column(
9299
mainAxisSize: MainAxisSize.min,
93100
children: [
94-
Row(
95-
children: [
96-
Text(
97-
'Portfolio',
98-
style: theme.textTheme.titleLarge,
99-
),
100-
Spacer(),
101-
if (isAuthenticated)
102-
UiPrimaryButton(
103-
buttonKey: const Key('asset-management-button'),
104-
onPressed: () => _onAddAssetsPress(context),
105-
text: 'Add assets',
106-
height: 36,
107-
width: 147,
108-
borderRadius: 10,
109-
textStyle: theme.textTheme.bodySmall,
110-
),
111-
],
112-
),
113-
const SizedBox(height: 16),
101+
// Search row - always visible
114102
Row(
115103
children: [
116104
Expanded(
117105
child: WalletManagerSearchField(onChange: onSearchChange),
118106
),
119107
],
120108
),
121-
const SizedBox(height: 16),
122-
Row(
123-
children: [
124-
HiddenWithoutWallet(
125-
child: CoinsWithBalanceCheckbox(
126-
withBalance: withBalance,
127-
onWithBalanceChange: onWithBalanceChange,
109+
// Collapsible row with "Add assets" button and zero-balance toggle
110+
// Only show if authenticated (since HiddenWithoutWallet hides content when not authenticated)
111+
if (isAuthenticated && collapseProgress < 1.0) ...[
112+
SizedBox(height: (1.0 - collapseProgress) * 12),
113+
SizedBox(
114+
height: (1.0 - collapseProgress) * 36,
115+
child: Opacity(
116+
opacity: 1.0 - collapseProgress,
117+
child: Row(
118+
children: [
119+
CoinsWithBalanceCheckbox(
120+
withBalance: withBalance,
121+
onWithBalanceChange: onWithBalanceChange,
122+
),
123+
const Spacer(),
124+
UiPrimaryButton(
125+
buttonKey: const Key('asset-management-button'),
126+
onPressed: () => _onAddAssetsPress(context),
127+
text: 'Add assets',
128+
height: 36,
129+
width: 147,
130+
borderRadius: 10,
131+
textStyle: theme.textTheme.bodySmall,
132+
),
133+
],
128134
),
129135
),
130-
],
131-
),
132-
Spacer(),
136+
),
137+
],
133138
],
134139
),
135140
);

packages/komodo_ui_kit/pubspec.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ packages:
9595
description:
9696
path: "packages/komodo_defi_rpc_methods"
9797
ref: dev
98-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
98+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
9999
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
100100
source: git
101101
version: "0.2.0+0"
@@ -104,7 +104,7 @@ packages:
104104
description:
105105
path: "packages/komodo_defi_types"
106106
ref: dev
107-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
107+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
108108
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
109109
source: git
110110
version: "0.2.0+0"
@@ -113,7 +113,7 @@ packages:
113113
description:
114114
path: "packages/komodo_ui"
115115
ref: dev
116-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
116+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
117117
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
118118
source: git
119119
version: "0.2.0+0"

pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ packages:
648648
description:
649649
path: "packages/komodo_cex_market_data"
650650
ref: dev
651-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
651+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
652652
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
653653
source: git
654654
version: "0.0.1"
@@ -657,7 +657,7 @@ packages:
657657
description:
658658
path: "packages/komodo_coin_updates"
659659
ref: dev
660-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
660+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
661661
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
662662
source: git
663663
version: "1.0.0"
@@ -666,7 +666,7 @@ packages:
666666
description:
667667
path: "packages/komodo_coins"
668668
ref: dev
669-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
669+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
670670
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
671671
source: git
672672
version: "0.2.0+0"
@@ -675,7 +675,7 @@ packages:
675675
description:
676676
path: "packages/komodo_defi_framework"
677677
ref: dev
678-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
678+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
679679
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
680680
source: git
681681
version: "0.2.0"
@@ -684,7 +684,7 @@ packages:
684684
description:
685685
path: "packages/komodo_defi_local_auth"
686686
ref: dev
687-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
687+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
688688
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
689689
source: git
690690
version: "0.2.0+0"
@@ -693,7 +693,7 @@ packages:
693693
description:
694694
path: "packages/komodo_defi_rpc_methods"
695695
ref: dev
696-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
696+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
697697
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
698698
source: git
699699
version: "0.2.0+0"
@@ -702,7 +702,7 @@ packages:
702702
description:
703703
path: "packages/komodo_defi_sdk"
704704
ref: dev
705-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
705+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
706706
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
707707
source: git
708708
version: "0.2.0+0"
@@ -711,7 +711,7 @@ packages:
711711
description:
712712
path: "packages/komodo_defi_types"
713713
ref: dev
714-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
714+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
715715
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
716716
source: git
717717
version: "0.2.0+0"
@@ -727,7 +727,7 @@ packages:
727727
description:
728728
path: "packages/komodo_ui"
729729
ref: dev
730-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
730+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
731731
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
732732
source: git
733733
version: "0.2.0+0"
@@ -743,7 +743,7 @@ packages:
743743
description:
744744
path: "packages/komodo_wallet_build_transformer"
745745
ref: dev
746-
resolved-ref: "7dfe68bae615b444240f18c3912bdbaba813ab2d"
746+
resolved-ref: "81ba6438bc2dbab3b88aaa34cebb7a9c3813b667"
747747
url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git"
748748
source: git
749749
version: "0.2.0+0"

0 commit comments

Comments
 (0)