Implementation
Widget appContainer(){
var gap = style['hloc']['gap'];
return Container(
width: style['hloc']['containerWidth'],
padding: EdgeInsets.all(style['hloc']['containerPadding']),
decoration: BoxDecoration(
color: style['hloc']['containerColor'], //背景色
borderRadius: BorderRadius.all(
//圆角
Radius.circular(style['hloc']['containerRadius']),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['time']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${Tools.dateToFormat('yyyy-MM-dd HH:mm',p.mKData?['time'])}',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['open']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${Tools.toFixed(p.mKData?['open'], widget.propertys['priceDigits'])}',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['high']}',
style: style['hloc']['labelTextStyle'],
),
// Spacer(), // 自动填充剩余空间
Text(
'${Tools.toFixed(p.mKData?['high'], widget.propertys['priceDigits'])}',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['low']}',
style: style['hloc']['labelTextStyle'],
),
// Spacer(), // 自动填充剩余空间
Text(
'${Tools.toFixed(p.mKData?['low'], widget.propertys['priceDigits'])}',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['close']}',
style: style['hloc']['labelTextStyle'],
),
// Spacer(), // 自动填充剩余空间
Text(
'${Tools.toFixed(p.mKData?['close'], widget.propertys['priceDigits'])}',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['changes']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${p.mPreKData != null?Tools.toFixed(p.mKData?['close'] - p.mPreKData?['close'], widget.propertys['priceDigits']):"-"}',
style: p.mPreKData != null?(p.mKData?['close'] - p.mPreKData?['close']>=0?style['hloc']['valueUpTextStyle']:style['hloc']['valueDownTextStyle']):style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['change']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${p.mPreKData != null?Tools.toFixed(((p.mKData?['close'] - p.mPreKData?['close']) / p.mPreKData?['close']) * 100, 2):"-"}%',
style: p.mPreKData != null?(p.mKData?['close'] - p.mPreKData?['close']>=0?style['hloc']['valueUpTextStyle']:style['hloc']['valueDownTextStyle']):style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['amp']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${p.mPreKData != null?Tools.toFixed(((p.mKData?['high'] - p.mPreKData?['low']) / p.mPreKData?['close']) * 100, 2):"-"}%',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['volume']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${Tools.bigNumWithStr(p.mKData?['volume'],3) }',
style: style['hloc']['valueTextStyle'],
),
],
),
SizedBox(height: gap),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.propertys['i18n']['amo']}',
style: style['hloc']['labelTextStyle'],
),
Text(
'${Tools.bigNumWithStr(p.mKData?['amo'],3) }',
style: style['hloc']['valueTextStyle'],
),
],
),
if(p.mKData?['history'].isNotEmpty)
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(height: gap),
GestureDetector(
onTap: () {
widget.notify({
'take': TakeType['clickTradeMarks'],
'codeId': widget.propertys['codeId'],
'data': p.mKData?['history'][0],
});
},
child: Row(
children: [
Text(
'${p.mKData?['history'][0]['tip']}',
style: p.mKData?['history'][0]['price'] == 'low'?style['hloc']['valueDownTextStyle']:style['hloc']['valueUpTextStyle'],
),
Spacer(),
Text(
'${p.mKData?['history'][0]['avgPrice']} (${p.mKData?['history'][0]['totalNum']}) ',
style: style['hloc']['labelTextStyle'],
),
SvgPicture.asset(
style['hloc']['rightArrowIcon'],
colorFilter: ColorFilter.mode(style['hloc']['rightArrowIconColor'], BlendMode.srcIn),
),
],
),
),
if(p.mKData?['history'].length == 2)
SizedBox(height: gap),
if(p.mKData?['history'].length == 2)
GestureDetector(
onTap: () {
widget.notify({
'take': TakeType['clickTradeMarks'],
'codeId': widget.propertys['codeId'],
'data': p.mKData?['history'][1],
});
},
child: Row(
children: [
Text(
'${p.mKData?['history'][1]['tip']}',
style: p.mKData?['history'][1]['price'] == 'low'?style['hloc']['valueDownTextStyle']:style['hloc']['valueUpTextStyle'],
),
Spacer(),
Text(
'${p.mKData?['history'][1]['avgPrice']} (${p.mKData?['history'][1]['totalNum']}) ',
style: style['hloc']['labelTextStyle'],
),
SvgPicture.asset(
style['hloc']['rightArrowIcon'],
colorFilter: ColorFilter.mode(style['hloc']['rightArrowIconColor'], BlendMode.srcIn),
),
],
),
),
]
),
],
),
);
}