简体   繁体   English

Flutter 生成文本框

[英]Flutter generating textfield on tap

Currently I am experimenting with constructing facebook style comment system in my project.目前我正在尝试在我的项目中构建 facebook 风格的评论系统。 I am close to it, but I do not know how do I solve this.我接近它,但我不知道如何解决这个问题。 I am trying to generate a Textfield just below the reply button like its done in facebook. I really need help with this.我正在尝试在回复按钮下方生成一个文本字段,就像在 facebook 中所做的那样。我真的需要帮助。 Thanks!谢谢!

Here is the code:这是代码:

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

Here is my output.这是我的 output。 在此处输入图像描述

you can use list to save your container in: https://flutter.dev/docs/cookbook/lists/long-lists您可以使用列表将容器保存在: https://flutter.dev/docs/cookbook/lists/long-lists

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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