Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/lib/models/card_info_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class CardInfoModel {
class NetBankingModel {
String? bankKey;
String? bankName;
String? logoUrl;

NetBankingModel({this.bankKey, this.bankName});
NetBankingModel({this.bankKey, this.bankName, this.logoUrl});
}

class WalletModel {
Expand Down
33 changes: 33 additions & 0 deletions example/lib/payment_slection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ class _PaymentSelectionPageState extends State<PaymentSelectionPage> {
);
},
);
attachBankLogosAsync();
}

attachBankLogosAsync() async {
if (netBankingList?.isNotEmpty != true)
return;
for (var netBank in netBankingList!) {
if (netBank.bankKey?.isNotEmpty == true) {
String? logoUrl = await _razorpay.getBankLogoUrl(netBank.bankKey!);
netBank.logoUrl = logoUrl;
}
}
}

configurePaymentWallets() {
Expand Down Expand Up @@ -297,7 +309,25 @@ class _PaymentSelectionPageState extends State<PaymentSelectionPage> {
return ListView.builder(
itemCount: netBankingList?.length,
itemBuilder: (context, item) {
Widget? leadingWidget;
if (netBankingList?[item].logoUrl?.isNotEmpty == true) {
leadingWidget = Image.network(
netBankingList![item].logoUrl!,
height: 32.0,
width: 32.0,
errorBuilder: (context, obj, stkTrc) => SizedBox(
height: 32.0,
width: 32.0,
child: Center(
child: Text(
"Error", style: TextStyle(color: Colors.redAccent),
),
),
),
);
}
return ListTile(
leading: leadingWidget,
title: Text(netBankingList?[item].bankName ?? ''),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {
Expand Down Expand Up @@ -580,6 +610,9 @@ class _PaymentSelectionPageState extends State<PaymentSelectionPage> {
await _razorpay.getCardsNetwork("4111111111111111");
print(cardNetwork); */

/*final bankLogo = await _razorpay.getBankLogoUrl('HDFC');
print('Bank Logo URL : $bankLogo');*/

/* final walletLogo
await _razorpay.getWalletLogoUrl('paytm');
print('Wallet URL : $walletLogo'); */
Expand Down
6 changes: 6 additions & 0 deletions lib/razorpay_flutter_customui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class Razorpay {
return isCredAppPresent;
}

Future<String> getBankLogoUrl(String bankCode) async {
final bankLogoUrl =
await _channel.invokeMethod('getBankLogoUrl', bankCode);
return bankLogoUrl;
}

Future<String> getWalletLogoUrl(String walletName) async {
final walletLogoUrl =
await _channel.invokeMethod('getWalletLogoUrl', walletName);
Expand Down