feat(app): 接入金币充值与会员商品下单
This commit is contained in:
1 parent
ec2db6842e
commit
730e38622f
21 files changed
+1325
-1
No files matched your search
@@ -13,6 +13,8 @@ import '../../core/theme/app_colors.dart';
|
||||
import '../../core/theme/app_dimens.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/widgets/empty_state.dart';
|
||||
import '../store/recharge_page.dart';
|
||||
import '../store/vip_page.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
/// 金币钱包:余额、累计收支与最近流水。
|
||||
@@ -56,6 +58,53 @@ class _WalletPageState extends State<WalletPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _storeActions(AppLocalizations l10n, WalletController wallet) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
key: const Key('wallet-top-up'),
|
||||
onPressed: () => _openRecharge(wallet),
|
||||
icon: const Icon(Icons.add_card_rounded, size: 16),
|
||||
label: Text(l10n.topUpWallet),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppColors.blue,
|
||||
foregroundColor: AppColors.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
key: const Key('wallet-vip'),
|
||||
onPressed: () => _openVip(wallet),
|
||||
icon: const Icon(Icons.workspace_premium_outlined, size: 16),
|
||||
label: Text(l10n.vipMembership),
|
||||
style: OutlinedButton.styleFrom(foregroundColor: AppColors.gold),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _openRecharge(WalletController wallet) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => RechargePage(
|
||||
onPurchased: () => unawaited(wallet.load()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openVip(WalletController wallet) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => VipPage(onPurchased: () => unawaited(wallet.load())),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _body(AppLocalizations l10n, WalletController wallet) {
|
||||
if (wallet.loading && wallet.snapshot == null) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@@ -77,6 +126,8 @@ class _WalletPageState extends State<WalletPage> {
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 28),
|
||||
children: [
|
||||
_BalanceHero(wallet: snapshot.wallet),
|
||||
const SizedBox(height: 12),
|
||||
_storeActions(l10n, wallet),
|
||||
const SizedBox(height: 14),
|
||||
Row(
|
||||
children: [
|
||||
|
||||
Reference in new issue
Block a user