[英]How do I add a predefined text before the snapshot.data in flutter
[英]How can i concat text into "Text widget" with "snapshot.data" Flutter
我想在包含 snapshot.data 的 Text 小部件中连接文本,但我现在不能这样做。 这是我的代码:
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
snapshot.data!.docChanges[index]
.doc['entCourse'],
style: TextStyle(
fontSize: 13,
color: Colors.grey,
),
),
Text(
// i think here would be the text to concat: 'Valoration is:'
snapshot.data!.docChanges[index]
.doc['valCourse'],
style: TextStyle(
fontSize: 8,
color: Colors.yellowAccent,
),
),
],
),
我想要的是这样的
您可以使用字符串插值并使其不使用 + 运算符,如下所示,
Text("this is sample text ${snapshot.data!.docChanges[index].doc["calCourse"]}"),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.