From 58c3551b4e1c96ac11dacc70941e266b9e4767c3 Mon Sep 17 00:00:00 2001 From: wuqifeng <540416539@qq.com> Date: Fri, 9 Oct 2026 22:40:05 +0800 Subject: [PATCH] feat: 隐藏微信支付选项并保留可见性开关 --- lib/pages/shopping/bloc.dart | 6 +++++- lib/pages/shopping/view.dart | 29 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/pages/shopping/bloc.dart b/lib/pages/shopping/bloc.dart index b3abdbd..1ebb5dd 100644 --- a/lib/pages/shopping/bloc.dart +++ b/lib/pages/shopping/bloc.dart @@ -15,13 +15,17 @@ import '../../utils/toast_util.dart'; import 'event.dart'; import 'state.dart'; +const bool isWechatPayOptionVisible = false; + class ShoppingBloc extends Bloc { ProductEntity? _productData; ProductEntity? get productData => _productData; - PaymentChannel _curPaymentChannel = PaymentChannel.wechatPay; + PaymentChannel _curPaymentChannel = isWechatPayOptionVisible + ? PaymentChannel.wechatPay + : PaymentChannel.aliPay; PaymentChannel get curPaymentChannel => _curPaymentChannel; diff --git a/lib/pages/shopping/view.dart b/lib/pages/shopping/view.dart index de81065..c607b9a 100644 --- a/lib/pages/shopping/view.dart +++ b/lib/pages/shopping/view.dart @@ -149,17 +149,26 @@ Widget _paymentWidget() => BlocBuilder( fontFamily: 'PingFangSC-Regular')), ), const SizedBox(height: 18.0), - buildRadioOption( - value: PaymentChannel.wechatPay.payChannelType, - icon: AssetImage('weixin'.assetPng), - text: PaymentChannel.wechatPay.payChannelName, - isSelected: bloc.curPaymentChannel.payChannelType == - PaymentChannel.wechatPay.payChannelType, - onSelect: (newValue) { - bloc.add(ChangePaymentChannelEvent(PaymentChannel.wechatPay)); - }, + Visibility( + visible: isWechatPayOptionVisible, + child: Column( + children: [ + buildRadioOption( + value: PaymentChannel.wechatPay.payChannelType, + icon: AssetImage('weixin'.assetPng), + text: PaymentChannel.wechatPay.payChannelName, + isSelected: bloc.curPaymentChannel.payChannelType == + PaymentChannel.wechatPay.payChannelType, + onSelect: (newValue) { + bloc.add( + ChangePaymentChannelEvent(PaymentChannel.wechatPay), + ); + }, + ), + const SizedBox(height: 15.0), + ], + ), ), - const SizedBox(height: 15.0), buildRadioOption( value: PaymentChannel.aliPay.payChannelType, icon: AssetImage('zhifubao'.assetPng), -- libgit2 0.22.2