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 创建具有圆角且在颤振中没有激活指示器的TextFormField_Flutter_Flutter Layout - Fatal编程技术网

Flutter 创建具有圆角且在颤振中没有激活指示器的TextFormField

Flutter 创建具有圆角且在颤振中没有激活指示器的TextFormField,flutter,flutter-layout,Flutter,Flutter Layout,我正在尝试实现一个用户输入,代码如下 目前,我只有一个容器,其中包含一行,其中包含4个容器,每个容器包含一个TextFormField。我如何实现上述目标 Padding( padding: const EdgeInsets.all(8.0), child: new Form( child: Container( color: Colors.blue[100], height:

我正在尝试实现一个用户输入,代码如下

目前,我只有一个容器,其中包含一行,其中包含4个容器,每个容器包含一个TextFormField。我如何实现上述目标

   Padding(
     padding: const EdgeInsets.all(8.0),
         child: new Form(
            child: Container(
               color: Colors.blue[100],
               height: 100.0,
               width: 350.0,
               child: Row(
                  mainAxisAlignment:
                      MainAxisAlignment.spaceEvenly,
                      children: <Widget>[
                        Container(
                         color: Colors.amber,
                         height: 50.0,
                         width: 50.0,
                         child: TextFormField(),
                          ),

                          Container(
                            color: Colors.amber,
                            height: 50.0,
                            width: 50.0,
                            child: TextFormField(),
                             ),
                           Container(
                           color: Colors.amber,
                           height: 50.0,
                           width: 50.0,
                            child: TextFormField(),
                            ),
                            Container(
                           color: Colors.amber,
                           height: 50.0,
                           width: 50.0,
                            child: TextFormField(),
                            ),

                      ),
                                  ],
填充(
填充:常数边集全部(8.0),
儿童:新表格(
子:容器(
颜色:颜色。蓝色[100],
高度:100.0,
宽度:350.0,
孩子:排(
主轴对准:
MainAxisAlignment.space,
儿童:[
容器(
颜色:颜色。琥珀色,
身高:50.0,
宽度:50.0,
子项:TextFormField(),
),
容器(
颜色:颜色。琥珀色,
身高:50.0,
宽度:50.0,
子项:TextFormField(),
),
容器(
颜色:颜色。琥珀色,
身高:50.0,
宽度:50.0,
子项:TextFormField(),
),
容器(
颜色:颜色。琥珀色,
身高:50.0,
宽度:50.0,
子项:TextFormField(),
),
),
],
我创建了一个小示例,我认为这将有助于您实现同样的想法

  • 您需要使用
    FoucusNode
  • 您可以从装饰属性中更改边框和其他装饰设置,但如果您想更改颜色之类的内容,最好使用
    主题
    小部件并从中更改主题
  • 如果要阻止用户键入多个Charter,请使用
    LengthLimitingTextInputFormatter
  • 您也可以从装饰中获得圆角和特定的边框

    decoration: InputDecoration(
        contentPadding: const EdgeInsets.all(8.0),
        border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(5.0),
        ),
        hintText: "0",
    ),
    

这真的很有帮助。我还需要一种方法来保存输入的数字。在输入最后一个数字后,我如何阻止它迭代。顺便说一下,这是一个firebase代码验证码。因此,最后,我需要提交它,在输入所有数字后,我如何保存用户输入的内容。数字应该保持不变,并且当我提交时。用户可能需要删除一个数字,从右到左,这是怎么发生的。这就是为什么我使用TextFormField,TextField似乎需要很多手动解决方法。我可以在这里给出答案,但这是另一个问题,所以使焦点节点移动的部分只是删除它,而不会直接移动tlyi创造了这个,希望它能有所帮助