这是我弄的
太丑了,我希望能改改,弄得更好看点,而且里面的净值小数点我希望可以标红或标绿,根据正负号来决定颜色,如何处理
代码:
Container(
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('基金代码:'+_funds[index].id),
Text(_funds[index].name),
Text(_funds[index].type),
Text('第一天:'+(_funds[index].d1 ?? 'null')),
Text('第二天:'+(_funds[index].d2 ?? 'null')),
Text('第三天:'+(_funds[index].d3 ?? 'null')),
Text('第四天:'+(_funds[index].d4 ?? 'null')),
Text('第五天:'+(_funds[index].d5 ?? 'null')),
],
),
),
Column(
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green, // 按钮背景颜色
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), // 设置按钮圆角
),
),
onPressed: () {
print("Selected: ${_funds[index].name} - ${_funds[index].type} 打印自选");
},
child: Text('自选'),
),
SizedBox(width: 8.0), // 添加间隔
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red, // 按钮背景颜色
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), // 设置按钮圆角
),
),
onPressed: () {
print("Selected: ${_funds[index].name} - ${_funds[index].type} 打印买入");
},
child: Text('买入'),
),
SizedBox(width: 8.0), // 添加间隔
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue, // 按钮背景颜色
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), // 设置按钮圆角
),
),
onPressed: () {
print("Selected: ${_funds[index].name} - ${_funds[index].type} 打印打印");
},
child: Text('打印'),
),
],
),
],
),
);
Opacity 组件可以控制该组件的透明度改变 , 修改 opacity 属性 , 可以改变组件的透明度效果 , 0 是完全透明 , 1 是完全不透明 ;
/// 透明度可变组件
Opacity(
opacity: appBarAlpha,
child: Container(
height: 80,
decoration: BoxDecoration(color: Colors.white),
child: Center(
child: Padding(
padding: EdgeInsets.only(top: 20),
child: Text("标题透明渐变"),
),
),
),
),