代码如下:
@override
Widget build(BuildContext context) {
Get.put<HotAndColdBarViewController>(HotAndColdBarViewController());
return Container(
alignment: Alignment.centerLeft,
width: 1.sw,
color: Colors.white70,
child: Obx(
() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'red_avg_message'.trParams({
's': (controller.appearedSum.value / 49).toStringAsFixed(2)
}),
style: TextStyle(fontSize: 13.sp, color: Colors.red),
),
Text(
'blue_avg_message'.trParams({
's': (controller.notAppearedSum.value / 49).toStringAsFixed(2)
}),
style: TextStyle(fontSize: 13.sp, color: Colors.blue),
),
],
),
),
);
}
翻译文件:
const Map<String, String> en_US = {
...
'red_avg_message': '...(Avg: @s issue)',
'blue_avg_message': '...(Avg: @s issue)',
...
};
'@s'是关键