如何使TextFormField文本在validate上显示在TextFormField行下方

时间:2019-05-23 03:02:44

标签: dart flutter

这是我目前面临的情况,因为我希望红色文本显示在该行的下方而不是上方,因为它看起来有点像这样:

enter image description here

          new Container(
            width: MediaQuery.of(context).size.width,
            margin: const EdgeInsets.only(left: 40.0, right: 40.0, top: 10.0),
            alignment: Alignment.center,
            decoration: BoxDecoration(
              border: Border(
                bottom: BorderSide(
                    color: Color.fromRGBO(58, 66, 86, 1.0),
                    width: 0.5,
                    style: BorderStyle.solid),
              ),
            ),
            padding: const EdgeInsets.only(left: 0.0, right: 10.0),
            child: new Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.start,
              children: <Widget>[
                new Expanded(
                  child: TextFormField( // LOGIN SCREEN EMAIL
                    maxLines: 1,
                    keyboardType: TextInputType.emailAddress,
                    autofocus: false,
                    textAlign: TextAlign.left,
                    decoration: InputDecoration(
                      border: InputBorder.none,
                      hintText: LOGIN_SCREEN_EMAIL_HINT,
                      hintStyle: TextStyle(color: Colors.grey),
                    ),
                    validator: (value) => value.isEmpty ? LOGIN_SCREEN_EMAIL_WARNING : null,
                    onSaved: (value) => _email = value,
                  ),
                ),
              ],
            ),
          ),

1 个答案:

答案 0 :(得分:1)

根据您的代码,该行不是文本字段的行。它是容器的底部边框。尝试删除容器底部边框并使用TextFromField边框线

df['col1', 'col2'] = df['col1', 'col2'].map(lambda x,y :'%.0f' % x, '%.3f' % y)