简体   繁体   中英

How can i concat text into "Text widget" with "snapshot.data" Flutter

I want to concat text inside a Text widget that contains an snapshot.data, but i couldn't do that for now. This is my code:

                               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,
                                      ),
                                    ),
                                  ],
                                ),

what i want is something like this

在此处输入图像描述

You can use string interpolation and make it without + operator something like this,

Text("this is sample text ${snapshot.data!.docChanges[index].doc["calCourse"]}"),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM