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';
|
final availableCash = asset?.availableCash ?? '0';
|
||||||
|
|
||||||
// 设置默认价格
|
// 始终使用实时价格(价格不可修改)
|
||||||
if (_priceController.text.isEmpty && priceInfo != null) {
|
if (priceInfo != null) {
|
||||||
_priceController.text = currentPrice;
|
_priceController.text = currentPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -573,8 +573,8 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// 价格输入
|
// 价格显示(只读,使用实时价格)
|
||||||
_buildInputField('价格', _priceController, '请输入价格', '积分值'),
|
_buildInputField('价格', _priceController, '实时价格', '积分值', readOnly: true),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// 数量输入 - 带"全部"按钮
|
// 数量输入 - 带"全部"按钮
|
||||||
// 卖出时使用交易账户积分股余额(只能卖出交易账户的,挖矿账户需要先划转)
|
// 卖出时使用交易账户积分股余额(只能卖出交易账户的,挖矿账户需要先划转)
|
||||||
|
|
@ -757,8 +757,9 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
String label,
|
String label,
|
||||||
TextEditingController controller,
|
TextEditingController controller,
|
||||||
String hint,
|
String hint,
|
||||||
String suffix,
|
String suffix, {
|
||||||
) {
|
bool readOnly = false,
|
||||||
|
}) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -774,7 +775,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
Container(
|
Container(
|
||||||
height: 44,
|
height: 44,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _bgGray,
|
color: readOnly ? _bgGray.withOpacity(0.7) : _bgGray,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
@ -782,7 +783,13 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
readOnly: readOnly,
|
||||||
|
enabled: !readOnly,
|
||||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: readOnly ? _grayText : _darkText,
|
||||||
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: hint,
|
hintText: hint,
|
||||||
hintStyle: const TextStyle(
|
hintStyle: const TextStyle(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue