Flutter 嵌套小部件中的颤振换行文本

Flutter 嵌套小部件中的颤振换行文本,flutter,Flutter,我的文本小部件未包装,导致溢出,但似乎缺少添加flex/expanded的正确位置 它说“//让这个文本包装”的地方是我想包装的文本小部件 Padding( padding: const EdgeInsets.only(top: 8.0), child: Text(snapshot.data[index].message_text, //get this text to wrap style: TextStyle( color: Colors

我的
文本
小部件未包装,导致溢出,但似乎缺少添加flex/expanded的正确位置

它说
“//让这个文本包装”
的地方是我想包装的
文本
小部件

Padding(
    padding: const EdgeInsets.only(top: 8.0),
    child: Text(snapshot.data[index].message_text, //get this text to wrap
        style: TextStyle(
          color: Colors.grey,
          fontSize: 15.0,
          fontWeight: FontWeight.bold,
        ),
      overflow: TextOverflow.visible,
    ),
  ),
完整代码:
@覆盖
小部件构建(构建上下文){
返回脚手架(
appBar:新appBar(标题:文本(“注释”),
主体:容器(
子:列(
儿童:[
扩大(
子:容器(
装饰:盒子装饰(
颜色:颜色,白色,
borderRadius:仅限borderRadius(
左上:半径。圆形(30.0),
右上角:半径。圆形(30.0),
),
),
孩子:ClipRRect(
borderRadius:仅限borderRadius(
左上:半径。圆形(30.0),
右上角:半径。圆形(30.0),
),
子项:新的刷新指示器(
儿童:
容器(
孩子:未来建设者(
future:getAllCommentsForAd(此.ad_id_传入),
生成器:(BuildContext上下文,异步快照){
如果(snapshot.data==null){
返回容器(
儿童:中心(
子项:文本(“加载…”),
)
);
}否则{
返回ListView.builder(
收缩膜:对,
itemCount:snapshot.data.length,
itemBuilder:(构建上下文,int索引){
//返回列表块(
//领先:CircleAvatar(
//半径:35.0,
//backgroundImage:新的网络映像(snapshot.data[index].imageUrl),
//                            ),
//标题:文本(快照.数据[索引].电子邮件),
//                        );
返回手势检测器(
onTap:()=>(
打印(“点击那个”)
//导航器。推(
//背景,
//材料路线(
//生成器:()=>MessageScreenRoom(
//snapshot.data[index],this.logged\u in\u user\u id
//                                      ),
//                                    ),
//                                  )
),
子:容器(
页边距:仅限边距(
排名:5.0,
底部:5.0,
右:1.0,
左:10.0,
),
衬垫:
边缘组。对称(水平:20.0,垂直:10.0),
装饰:盒子装饰(
颜色:snapshot.data[index].hearted?Colors.lime[50]:Colors.white,
borderRadius:仅限borderRadius(
右上角:半径。圆形(20.0),
右下角:半径。圆形(20.0),
左上:半径。圆形(20.0),
左下角:半径。圆形(20.0),
)),
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
扩大(
孩子:排(
儿童:[
圆形(
半径:35.0,
backgroundImage:新的网络映像(snapshot.data[index].imageUrl),
),
大小盒子(
宽度:10.0,
),
纵队(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
文本(快照.数据[索引])。用户名,
样式:TextStyle(
颜色:颜色。灰色,
字体大小:15.0,
fontWeight:fontWeight.bold,
)),
填充物(
填充:仅限常量边集(顶部:8.0),
子项:文本(快照.数据[索引])。消息_
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: new AppBar(title: Text("Comments")),
        body: Container(
          child: Column(
            children: <Widget>[
              Expanded(
                child: Container(
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(30.0),
                      topRight: Radius.circular(30.0),
                    ),
                  ),
                  child: ClipRRect(
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(30.0),
                      topRight: Radius.circular(30.0),
                    ),
                    child: new RefreshIndicator(
                      child:
                      Container(
                        child: FutureBuilder(
                            future: getAllCommentsForAd(this.ad_id_passed_in),
                            builder: (BuildContext context, AsyncSnapshot snapshot) {
                              if (snapshot.data == null) {
                                return Container(
                                    child: Center(
                                      child: Text("Loading..."),
                                    )
                                );
                              } else {
                                return ListView.builder(
                                  shrinkWrap: true,
                                  itemCount: snapshot.data.length,
                                  itemBuilder: (BuildContext context, int index) {
//                        return ListTile(
//                          leading:   CircleAvatar(
//                              radius: 35.0,
//                              backgroundImage:  new NetworkImage(snapshot.data[index].imageUrl),
//                            ),
//                          title: Text(snapshot.data[index].email),
//                        );

                                    return GestureDetector(
                                      onTap: () => (
                                      print("tapped that")
//                                  Navigator.push(
//                                    context,
//                                    MaterialPageRoute(
//                                      builder: (_) => MessageScreenRoom(
//                                          snapshot.data[index],this.logged_in_user_id
//                                      ),
//                                    ),
//                                  )
                                      ),
                                      child: Container(
                                        margin: EdgeInsets.only(
                                          top: 5.0,
                                          bottom: 5.0,
                                          right: 1.0,
                                          left: 10.0,
                                        ),
                                        padding:
                                        EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
                                        decoration: BoxDecoration(
                                            color: snapshot.data[index].hearted ? Colors.lime[50] : Colors.white,
                                            borderRadius: BorderRadius.only(
                                              topRight: Radius.circular(20.0),
                                              bottomRight: Radius.circular(20.0),
                                              topLeft: Radius.circular(20.0),
                                              bottomLeft: Radius.circular(20.0),
                                            )),
                                        child: Row(
                                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                          children: <Widget>[


                                            Expanded(
                                              child: Row(
                                                children: <Widget>[
                                                  CircleAvatar(
                                                    radius: 35.0,
                                                    backgroundImage:  new NetworkImage(snapshot.data[index].imageUrl),
                                                  ),
                                                  SizedBox(
                                                    width: 10.0,
                                                  ),
                                                  Column(
                                                    crossAxisAlignment: CrossAxisAlignment.start,
                                                    children: <Widget>[
                                                      Text(snapshot.data[index].user_name,
                                                          style: TextStyle(
                                                            color: Colors.grey,
                                                            fontSize: 15.0,
                                                            fontWeight: FontWeight.bold,
                                                          )),

                                                      Padding(
                                                        padding: const EdgeInsets.only(top: 8.0),
                                                        child: Text(snapshot.data[index].message_text, //get this text to wrap
                                                            style: TextStyle(
                                                              color: Colors.grey,
                                                              fontSize: 15.0,
                                                              fontWeight: FontWeight.bold,
                                                            )),
                                                      ),
                                                      SizedBox(
                                                        height: 10.0,
                                                      ),
                                                      Container(
                                                        width: MediaQuery.of(context).size.width * 0.45,
                                                        child: Text(
                                                          "",
                                                          style: TextStyle(
                                                            color: Colors.blueGrey,
                                                            fontSize: 15.0,
                                                            fontWeight: FontWeight.w600,
                                                          ),
                                                          overflow: TextOverflow.ellipsis,
                                                        ),
                                                      )
                                                    ],
                                                  ),
                                                ],
                                              ),
                                            ),


                                            Column(
                                              children: <Widget>[
                                                Text("",
                                                    style: TextStyle(
                                                        color: Colors.grey,
                                                        fontSize: 15.0,
                                                        fontWeight: FontWeight.bold)),
                                                SizedBox(
                                                  height: 5.0,
                                                ),
                                                snapshot.data[index].hearted
                                                    ? Container(
                                                    width: 40.0,
                                                    height: 20.0,
                                                    alignment: Alignment.center,
                                                    child: Icon(Icons.favorite, color: Colors.red, size: 30),

                                                )
                                                    : Icon(Icons.favorite_border, color: Colors.red, size: 30),
                                              ],
                                            ),
                                          ],
                                        ),
                                      ),
                                    );

                                  },
                                );
                              }
                            }
                        ),
                      ),
                      onRefresh: refreshMessages,
                    ),
                  ),
                ),

              ),
             // _buildMessageComposer(),

              Row(
                children: <Widget>[
                  Expanded(child: TextField(
                    textCapitalization: TextCapitalization.sentences,
                    controller: text_message_controller,
                    onChanged: (value){

                    },
                    decoration: InputDecoration.collapsed(hintText: '   Leave a comment...'),
                  )),
                  IconButton(
                      icon: Icon(Icons.send),
                      iconSize: 30.0,
                      color: Theme.of(context).primaryColor,
                      onPressed: () {
                        //send comment TODO: do this comment send
                        sendComment(ad_id_passed_in, this.logged_in_user_id, text_message_controller.text);
                        text_message_controller.clear();
                        setState(() {
                        });




                      })
                ],
              ),


            ],
          ),


        ),

      );
    }