feat(mining-app): 兑换页面价格改为只读,使用实时价格
- 价格输入框改为只读模式,用户不能修改 - 始终使用后端返回的实时价格 - 价格会随实时刷新自动更新 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cfa3979a97
commit
533ad3ba82
|
|
@ -363,8 +363,8 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
// 可用积分值(现金)
|
||||
final availableCash = asset?.availableCash ?? '0';
|
||||
|
||||
// 设置默认价格
|
||||
if (_priceController.text.isEmpty && priceInfo != null) {
|
||||
// 始终使用实时价格(价格不可修改)
|
||||
if (priceInfo != null) {
|
||||
_priceController.text = currentPrice;
|
||||
}
|
||||
|
||||
|
|
@ -573,8 +573,8 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
),
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
// 价格输入
|
||||
_buildInputField('价格', _priceController, '请输入价格', '积分值'),
|
||||
// 价格显示(只读,使用实时价格)
|
||||
_buildInputField('价格', _priceController, '实时价格', '积分值', readOnly: true),
|
||||
const SizedBox(height: 16),
|
||||
// 数量输入 - 带"全部"按钮
|
||||
// 卖出时使用交易账户积分股余额(只能卖出交易账户的,挖矿账户需要先划转)
|
||||
|
|
@ -757,8 +757,9 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
String label,
|
||||
TextEditingController controller,
|
||||
String hint,
|
||||
String suffix,
|
||||
) {
|
||||
String suffix, {
|
||||
bool readOnly = false,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
@ -774,7 +775,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
Container(
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: _bgGray,
|
||||
color: readOnly ? _bgGray.withOpacity(0.7) : _bgGray,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
|
|
@ -782,7 +783,13 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
Expanded(
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
readOnly: readOnly,
|
||||
enabled: !readOnly,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: readOnly ? _grayText : _darkText,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: const TextStyle(
|
||||
|
|
|
|||
Loading…
Reference in New Issue