简体   繁体   English

我是 flutter 的新手,我正在尝试创建此布局

[英]I am new to flutter and i am trying to create this layout

How can i create this layout in flutter.如何在 flutter 中创建此布局。 when i click raised button the name and number is saved and you get two new textformfield to enter another business owner data当我单击凸起按钮时,名称和号码已保存,您将获得两个新的 textformfield 以输入另一个企业主数据

initially there will be two textformfield to enter owner details as shown in first image if there are many co-founders then he can press the raised button and two new blank form field will be shown最初将有两个文本表单字段来输入所有者详细信息,如第一张图片所示,如果有很多联合创始人,那么他可以按下凸起的按钮,将显示两个新的空白表单字段

image1图像1

end result can look like this second image最终结果可能看起来像第二张图片

i tried multiple times but wasn't able to implement it correctly.我尝试了多次,但无法正确实施。 Any help is appreciated.任何帮助表示赞赏。

One ideal way to do this would be to use a ListView to hold your TextFields .一种理想的方法是使用ListView来保存您的TextFields It'll first hold your initial TextFields , then a Column placeholder that can add additional TextFields when you tap your button AddOwner.它首先会保存您的初始TextFields ,然后是一个Column占位符,当您点击按钮 AddOwner 时可以添加其他TextFields A simplified example:一个简化的例子:

  ListView(
    children: <Widget>[
      TextFormField(
        decoration: InputDecoration(labelText: 'name'),
      ),
      TextFormField(
        decoration: InputDecoration(labelText: 'phone'),
      ),
      Column(children: additionalTextFields,),
    ],
  ),

And in your AddOwner button, you'll call the method to add more entries as you wish:在您的 AddOwner 按钮中,您将调用该方法以根据需要添加更多条目:

  var additionalTextFields = List<Widget>();

  void _addNewTextFields() {
    setState(() {
      additionalTextFields.add(
        TextFormField(
          decoration: InputDecoration(labelText: 'name'),
        ),
      );
      additionalTextFields.add(
        TextFormField(
          decoration: InputDecoration(labelText: 'phone'),
        ),
      );
    });
  }

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

相关问题 我正在尝试在 flutter 中使用地图功能 - i am trying to use map function in flutter 当我创建一个新的空活动时,布局 R.layout.layoutname 没有解析? - When I am create a new empty activity the layout R.layout.layoutname is not resolved? 我正在尝试在Android中创建属性页 - I am trying to create a properties page in Android 我正在尝试在Android中创建滑动视图 - I am trying to create a swipe view in Android 我正在尝试创建一个动态微调器 - I am trying to create a dynamic spinner 我正在尝试在 Kotlin 中创建一个带有 sqlite 的表 - I am trying to create a table with sqlite in Kotlin 我正在尝试创建一个点击侦听器,它会在点击后打开一个新活动 - i am trying to create a click listener that will open a new activity once it it clicked 我正在尝试使用 Flutter 制作计算器应用程序的副本 UI,但我遇到了一些问题 - I am trying to make a replica UI of a calculator app using Flutter and I am stuck in a few things 我正在尝试运行我的 flutter 应用程序,但出现这些错误? - I am trying to run my flutter app and I am getting these errors? 你好,我是 Android 新手,我试图让一个数字在递增时脉动或闪烁 - Hello, I am new to Android and I am trying to get a number to pulse or blink when it is incremented
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM