From 9983ea9f782b8efab9136f89f39568cc1ee9318b Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 23 Dec 2022 01:58:44 +0100 Subject: [PATCH] new BalanceBuilder Widget --- lib/screens/myWallets/wallets_home.dart | 72 +++++++++++++++---------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/lib/screens/myWallets/wallets_home.dart b/lib/screens/myWallets/wallets_home.dart index 836fd30..3188b62 100644 --- a/lib/screens/myWallets/wallets_home.dart +++ b/lib/screens/myWallets/wallets_home.dart @@ -238,18 +238,23 @@ class WalletsHome extends StatelessWidget { WalletData? defaultWallet = myWalletProvider.getDefaultWallet(); final screenWidth = MediaQuery.of(context).size.width; - int nTule = 2; + int nTule; if (screenWidth >= 900) { nTule = 4; } else if (screenWidth >= 650) { nTule = 3; + } else { + nTule = 2; } // Offset followDragAnchorStrategy( // Draggable d, BuildContext context, Offset point) { // return Offset(d.feedbackOffset.dx - 30, d.feedbackOffset.dy - 0); // } + showTutorial(); + // Future.delayed(const Duration(seconds: 1), showTutorial); + return CustomScrollView(slivers: [ const SliverToBoxAdapter(child: SizedBox(height: 20)), SliverGrid.count( @@ -375,10 +380,9 @@ class WalletsHome extends StatelessWidget { ), )), Stack(children: [ - balanceBuilder( - context, - repository.address, - repository.address == + BalanceBuilder( + address: repository.address, + isDefault: repository.address == defaultWallet.address), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -434,29 +438,6 @@ class WalletsHome extends StatelessWidget { ]); } - Widget balanceBuilder(context, String address, bool isDefault) { - return Container( - width: double.infinity, - color: isDefault ? orangeC : yellowC, - child: Padding( - padding: - const EdgeInsets.only(left: 5, right: 5, top: 38, bottom: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Opacity( - opacity: 0.7, - child: Balance( - address: address, - size: 16, - color: isDefault ? Colors.white : Colors.black, - loadingColor: isDefault ? yellowC : orangeC), - ) - ], - )), - ); - } - Widget addNewDerivation(context) { final myWalletProvider = Provider.of(context); @@ -518,6 +499,41 @@ class WalletsHome extends StatelessWidget { } } +class BalanceBuilder extends StatelessWidget { + const BalanceBuilder({ + Key? key, + required this.address, + required this.isDefault, + }) : super(key: key); + + final String address; + final bool isDefault; + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + color: isDefault ? orangeC : yellowC, + child: Padding( + padding: + const EdgeInsets.only(left: 5, right: 5, top: 38, bottom: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Opacity( + opacity: 0.7, + child: Balance( + address: address, + size: 16, + color: isDefault ? Colors.white : Colors.black, + loadingColor: isDefault ? yellowC : orangeC), + ) + ], + )), + ); + } +} + class CustomClipperOval extends CustomClipper { @override Rect getClip(Size size) {