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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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_Dart - Fatal编程技术网

Flutter 文本字段中的标签文本不会居中?

Flutter 文本字段中的标签文本不会居中?,flutter,dart,Flutter,Dart,我试图将我的labelText集中在文本字段中,但我无法让它集中在我的生活中。有人看到一个显而易见的问题会导致这种情况吗?谢谢 Container( width: MediaQuery.of(context).size.width * .85, height: M

我试图将我的labelText集中在文本字段中,但我无法让它集中在我的生活中。有人看到一个显而易见的问题会导致这种情况吗?谢谢

                      Container(
                        width:
                        MediaQuery.of(context).size.width * .85,
                        height:
                        MediaQuery.of(context).size.height * .12,
                        decoration: BoxDecoration(
                            color: Colors.white,
                            border: Border.all(color: Colors.white),
                            borderRadius: BorderRadius.all(
                                Radius.circular(12))),
                        child: TextField(
                          textAlign: TextAlign.center,
                          controller: _notesEditingController,
                          obscureText: false,
                          decoration: InputDecoration(
                              contentPadding: EdgeInsets.symmetric(vertical: 40.0),
                              fillColor: Colors.white,
                              border: OutlineInputBorder(
                                borderRadius: BorderRadius.all(
                                    Radius.circular(12.0)),
                              ),
                              labelText: 'notes',
                              labelStyle: TextStyle(
                                color: Color.fromRGBO(105, 105, 105, 10),
                              )),
                        ),
                      ),

请尝试此操作,替换
labelText
并使用
hintText

Container(
   child: TextField(
     textAlign: TextAlign.center,
     decoration: InputDecoration(
       hintText: 'Center the text',
     ),
   ),
)

您需要创建自定义组件,请检查下面的