CWA-201 | added scroll controller to wallet list page
Oleksandr Sobol committed
Apr 23, 2020 at 22:26 UTC
28d8cd43dca3f3027cd2076e74490fdf27299cd8
1 file changed
+12
-4
lib/src/screens/wallet_list/wallet_list_page.dart
+12
-4
@@ -28,6 +28,7 @@ class WalletListBody extends StatefulWidget {
28
class WalletListBodyState extends State<WalletListBody> {
29
final moneroIcon = Image.asset('assets/images/monero.png', height: 24, width: 24);
30
WalletListStore _walletListStore;
31
+ ScrollController scrollController = ScrollController();
32
33
@override
34
Widget build(BuildContext context) {
@@ -64,6 +65,7 @@ class WalletListBodyState extends State<WalletListBody> {
65
width: double.infinity,
66
child: CustomScrollView(
67
scrollDirection: Axis.horizontal,
68
+ controller: scrollController,
69
slivers: <Widget>[
70
SliverPersistentHeader(
71
pinned: false,
@@ -105,8 +107,11 @@ class WalletListBodyState extends State<WalletListBody> {
107
108
if (index == 0) {
109
return GestureDetector(
108
- onTap: () => walletMenu.action(
109
- walletMenu.listItems.indexOf(item), wallet, isCurrentWallet),
110
+ onTap: () {
111
+ scrollController.animateTo(0.0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
112
+ walletMenu.action(
113
+ walletMenu.listItems.indexOf(item), wallet, isCurrentWallet);
114
+ },
115
child: Container(
116
height: 108,
117
width: 108,
@@ -127,8 +132,11 @@ class WalletListBodyState extends State<WalletListBody> {
132
}
133
134
return GestureDetector(
130
- onTap: () => walletMenu.action(
131
- walletMenu.listItems.indexOf(item), wallet, isCurrentWallet),
135
+ onTap: () {
136
+ scrollController.animateTo(0.0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
137
+ walletMenu.action(
138
+ walletMenu.listItems.indexOf(item), wallet, isCurrentWallet);
139
+ },
140
child: Container(
141
height: 108,
142
width: 108,