Top Up Balance logic and Added fixes for routing
This commit is contained in:
@@ -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> {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user