Top Up Balance logic and Added fixes for routing

This commit is contained in:
Arseni
2025-12-05 20:29:43 +03:00
parent f7bf3138ac
commit bf39b1d401
27 changed files with 972 additions and 175 deletions

View File

@@ -12,11 +12,13 @@ import 'package:pweb/providers/carousel.dart';
class WalletCarousel extends StatefulWidget {
final List<Wallet> wallets;
final ValueChanged<Wallet> onWalletChanged;
final ValueChanged<Wallet> onTopUp;
const WalletCarousel({
super.key,
required this.wallets,
required this.onWalletChanged,
required this.onTopUp,
});
@override
@@ -33,6 +35,11 @@ class _WalletCarouselState extends State<WalletCarousel> {
_pageController = PageController(
viewportFraction: WalletCardConfig.viewportFraction,
);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.wallets.isNotEmpty) {
widget.onWalletChanged(widget.wallets[_currentPage]);
}
});
}
@override
@@ -83,7 +90,10 @@ class _WalletCarouselState extends State<WalletCarousel> {
itemBuilder: (context, index) {
return Padding(
padding: WalletCardConfig.cardPadding,
child: WalletCard(wallet: widget.wallets[index]),
child: WalletCard(
wallet: widget.wallets[index],
onTopUp: () => widget.onTopUp(widget.wallets[index]),
),
);
},
),
@@ -110,4 +120,4 @@ class _WalletCarouselState extends State<WalletCarousel> {
],
);
}
}
}