颤振在点击时生成文本字段

时间:2020-10-24 04:35:18

标签: flutter flutter-layout

目前,我正在尝试在我的项目中构建Facebook风格评论系统。我很接近,但是我不知道该如何解决。我正在尝试在回复按钮下方生成一个Textfield,就像在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),
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
      )),
    );
  }
}

这是我的输出。enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用列表将容器保存在:https://flutter.dev/docs/cookbook/lists/long-lists