Compare commits

...

2 Commits

Author SHA1 Message Date
ivan
df6788bbcd 新增:更新.gitignore 2026-04-13 19:13:36 +08:00
ivan
40b4ae8948 优化:三方支付显示增加积分 2026-04-13 19:13:36 +08:00
3 changed files with 74 additions and 17 deletions

1
.gitignore vendored
View File

@ -41,6 +41,7 @@ pubspec.lock
**/android/**/GeneratedPluginRegistrant.java **/android/**/GeneratedPluginRegistrant.java
# iOS # iOS
**/Pods/
**/ios/**/*.mode1v3 **/ios/**/*.mode1v3
**/ios/**/*.mode2v3 **/ios/**/*.mode2v3
**/ios/**/*.moved-aside **/ios/**/*.moved-aside

View File

@ -6,6 +6,8 @@ class PaymentMethodItem {
this.name, this.name,
this.icon, this.icon,
this.recommend = false, this.recommend = false,
this.bonusCredits = 0,
this.bonusRatio = 0,
}); });
final String paymentMethod; // resource GOOGLEPAY/APPLEPAY final String paymentMethod; // resource GOOGLEPAY/APPLEPAY
@ -13,6 +15,10 @@ class PaymentMethodItem {
final String? name; // brigade final String? name; // brigade
final String? icon; // greylist URL final String? icon; // greylist URL
final bool recommend; // deny true Recommended final bool recommend; // deny true Recommended
/// conjure
final int bonusCredits;
/// enchant
final double bonusRatio;
factory PaymentMethodItem.fromJson(Map<String, dynamic> json) { factory PaymentMethodItem.fromJson(Map<String, dynamic> json) {
return PaymentMethodItem( return PaymentMethodItem(
@ -21,8 +27,38 @@ class PaymentMethodItem {
name: json['brigade']?.toString(), name: json['brigade']?.toString(),
icon: json['greylist']?.toString(), icon: json['greylist']?.toString(),
recommend: json['deny'] == true, recommend: json['deny'] == true,
bonusCredits: _parseInt(json['conjure']) ?? 0,
bonusRatio: _parseDouble(json['enchant']) ?? 0,
); );
} }
String get displayName => name?.isNotEmpty == true ? name! : paymentMethod; static int? _parseInt(dynamic v) {
if (v == null) return null;
if (v is int) return v;
if (v is num) return v.toInt();
return int.tryParse(v.toString());
}
static double? _parseDouble(dynamic v) {
if (v == null) return null;
if (v is double) return v;
if (v is num) return v.toDouble();
return double.tryParse(v.toString());
}
String get displayName => name?.isNotEmpty == true ? name! : paymentMethod;
///
String? get bonusLabel {
if (bonusCredits > 0) {
return '+$bonusCredits bonus credits';
}
if (bonusRatio > 0) {
final pct = bonusRatio <= 1
? (bonusRatio * 100).round()
: bonusRatio.round();
return '+$pct% bonus credits';
}
return null;
}
} }

View File

@ -787,7 +787,7 @@ class _PaymentMethodItem extends StatelessWidget {
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
height: 64, constraints: const BoxConstraints(minHeight: 64),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected ? const Color(0x158B5CF6) : AppColors.surface, color: isSelected ? const Color(0x158B5CF6) : AppColors.surface,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
@ -804,7 +804,12 @@ class _PaymentMethodItem extends StatelessWidget {
_PaymentIcon(iconUrl: item.icon), _PaymentIcon(iconUrl: item.icon),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [ children: [
Flexible( Flexible(
child: Text( child: Text(
@ -830,6 +835,21 @@ class _PaymentMethodItem extends StatelessWidget {
], ],
], ],
), ),
if (item.bonusLabel != null) ...[
const SizedBox(height: 4),
Text(
item.bonusLabel!,
style: AppTypography.caption.copyWith(
color: AppColors.primary,
fontWeight: FontWeight.w500,
fontSize: 12,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
],
),
), ),
], ],
), ),