Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 抽头上产生颤振的文本字段_Flutter_Flutter Layout - Fatal编程技术网

Flutter 抽头上产生颤振的文本字段

Flutter 抽头上产生颤振的文本字段,flutter,flutter-layout,Flutter,Flutter Layout,目前,我正在我的项目中尝试构建facebook风格的评论系统。我很接近,但我不知道如何解决这个问题。我正试图在回复按钮下方生成一个文本字段,就像在facebook上一样。我真的需要帮助。谢谢 代码如下: class _MedPreCState extends State<MedPreC> { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold

目前,我正在我的项目中尝试构建facebook风格的评论系统。我很接近,但我不知道如何解决这个问题。我正试图在回复按钮下方生成一个文本字段,就像在facebook上一样。我真的需要帮助。谢谢

代码如下:

    class _MedPreCState extends State<MedPreC> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
          body: Padding(
        padding: const EdgeInsets.only(left: 20, right: 20, top: 20),
        child: Column(
          children: [
            Row(
              children: [
                CircleAvatar(
                  maxRadius: 12,
                  backgroundColor: Colors.indigo,
                  child: Icon(Icons.person),
                ),
                Padding(
                  padding: EdgeInsets.only(
                    left: 10.0,
                    right: 10.0,
                  ),
                  child: Container(
                    height: 30,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: Colors.grey[400]),
                    child: Center(child: Text('This is a random comment.')),
                  ),
                )
              ],
            ),
            SizedBox(
              height: 10,
            ),
            Padding(
              padding: const EdgeInsets.only(left: 40),
              child: Row(
                children: [
                  Text('2h', style: TextStyle(fontWeight: FontWeight.w600)),
                  SizedBox(
                    width: MediaQuery.of(context).size.width * 0.1,
                  ),
                  Text('Like', style: TextStyle(fontWeight: FontWeight.w600)),
                  SizedBox(
                    width: MediaQuery.of(context).size.width * 0.1,
                  ),
                  InkWell(
                    onTap: () {},
                    child: Text(
                      'Reply',
                      style: TextStyle(fontWeight: FontWeight.w600),
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
      )),
    );
  }
}
class\u MedPreCState扩展状态{
@凌驾
小部件构建(构建上下文){
返回安全区(
孩子:脚手架(
主体:填充物(
填充:仅限常量边集(左:20,右:20,顶部:20),
子:列(
儿童:[
划船(
儿童:[
圆形(
最大半径:12,
背景颜色:Colors.indigo,
子:图标(Icons.person),
),
填充物(
填充:仅限边缘设置(
左:10.0,
右图:10.0,
),
子:容器(
身高:30,
装饰:盒子装饰(
边界半径:边界半径。圆形(10),
颜色:颜色。灰色[400]),
child:Center(child:Text('这是一个随机注释'),
),
)
],
),
大小盒子(
身高:10,
),
填充物(
填充:仅限常量边集(左:40),
孩子:排(
儿童:[
文本('2h',样式:TextStyle(fontWeight:fontWeight.w600)),
大小盒子(
宽度:MediaQuery.of(context).size.width*0.1,
),
Text('Like',style:TextStyle(fontwweight:fontwweight.w600)),
大小盒子(
宽度:MediaQuery.of(context).size.width*0.1,
),
墨水池(
onTap:(){},
子:文本(
"答复",,
样式:TextStyle(fontWeight:fontWeight.w600),
),
),
],
),
)
],
),
)),
);
}
}

这是我的输出。

您可以使用列表将容器保存在:

点击回复时,这如何帮助我创建文本字段?每次用户输入新的注释时,我都有点困惑。将此注释添加到您的列表中,使用列表生成器,您可以构建Widget。我可以获得代码片段的帮助吗?我真的不知道如何实现它。如果你能告诉我怎么做就太好了。谢谢您的快速回复,顺便说一句:D