fix(security): 修复支付密码页面加载失败时静默降级为设置模式的 bug
加载状态失败时改为显示错误提示和重试按钮,避免误导用户认为未设置支付密码。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a1d284b6b5
commit
405e7e407e
|
|
@ -31,6 +31,7 @@ class _ChangePaymentPasswordPageState
|
|||
bool _isSubmitting = false;
|
||||
bool _hasPaymentPassword = false;
|
||||
bool _isLoading = true;
|
||||
bool _isLoadError = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -60,7 +61,7 @@ class _ChangePaymentPasswordPageState
|
|||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_hasPaymentPassword = false;
|
||||
_isLoadError = true;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
|
@ -160,7 +161,24 @@ class _ChangePaymentPasswordPageState
|
|||
Color(0xFFD4AF37)),
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
: _isLoadError
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.red, size: 48),
|
||||
const SizedBox(height: 12),
|
||||
const Text('加载失败,请重试', style: TextStyle(color: Colors.red)),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _loadStatus,
|
||||
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFFD4AF37)),
|
||||
child: const Text('重试', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
|
|
|||
Loading…
Reference in New Issue