如何使用 "snapshot.data" Flutter 将文本连接到 "Text widget"
How can i concat text into "Text widget" with "snapshot.data" Flutter
我想在包含 snapshot.data 的文本小部件中连接文本,但我现在不能这样做。这是我的代码:
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"]}"),
我想在包含 snapshot.data 的文本小部件中连接文本,但我现在不能这样做。这是我的代码:
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"]}"),