new BalanceBuilder Widget

This commit is contained in:
poka 2022-12-23 01:58:44 +01:00
parent 0ab955b2da
commit 9983ea9f78
1 changed files with 44 additions and 28 deletions

View File

@ -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<Object> 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: <Widget>[
const SliverToBoxAdapter(child: SizedBox(height: 20)),
SliverGrid.count(
@ -375,10 +380,9 @@ class WalletsHome extends StatelessWidget {
),
)),
Stack(children: <Widget>[
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<MyWalletsProvider>(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<Rect> {
@override
Rect getClip(Size size) {