CWA-201 | added scroll controller to wallet list page

This commit is contained in:
Oleksandr Sobol 2020-04-23 22:26:37 +03:00
parent 07aaf77167
commit 28d8cd43dc

View file

@ -28,6 +28,7 @@ class WalletListBody extends StatefulWidget {
class WalletListBodyState extends State<WalletListBody> { class WalletListBodyState extends State<WalletListBody> {
final moneroIcon = Image.asset('assets/images/monero.png', height: 24, width: 24); final moneroIcon = Image.asset('assets/images/monero.png', height: 24, width: 24);
WalletListStore _walletListStore; WalletListStore _walletListStore;
ScrollController scrollController = ScrollController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -64,6 +65,7 @@ class WalletListBodyState extends State<WalletListBody> {
width: double.infinity, width: double.infinity,
child: CustomScrollView( child: CustomScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
controller: scrollController,
slivers: <Widget>[ slivers: <Widget>[
SliverPersistentHeader( SliverPersistentHeader(
pinned: false, pinned: false,
@ -105,8 +107,11 @@ class WalletListBodyState extends State<WalletListBody> {
if (index == 0) { if (index == 0) {
return GestureDetector( return GestureDetector(
onTap: () => walletMenu.action( onTap: () {
walletMenu.listItems.indexOf(item), wallet, isCurrentWallet), scrollController.animateTo(0.0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
walletMenu.action(
walletMenu.listItems.indexOf(item), wallet, isCurrentWallet);
},
child: Container( child: Container(
height: 108, height: 108,
width: 108, width: 108,
@ -127,8 +132,11 @@ class WalletListBodyState extends State<WalletListBody> {
} }
return GestureDetector( return GestureDetector(
onTap: () => walletMenu.action( onTap: () {
walletMenu.listItems.indexOf(item), wallet, isCurrentWallet), scrollController.animateTo(0.0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
walletMenu.action(
walletMenu.listItems.indexOf(item), wallet, isCurrentWallet);
},
child: Container( child: Container(
height: 108, height: 108,
width: 108, width: 108,