简体   繁体   English

如何在 Flutter 中对齐 TextFormField 旁边的文本?

[英]How to align Text next to TextFormField in Flutter?

I have a Text widget (the +357) next to a TextFormField widget (the 12345678) like here:我在TextFormField小部件(12345678)旁边有一个Text小部件(+357),如下所示: 在此处输入图像描述

They are put in a row (with the icon as well).它们排成一排(也带有图标)。

The problem is when there is error text in the TextFormField , the error text displaces the TextFormField entirely:问题是当TextFormField中有错误文本时,错误文本会完全取代TextFormField

在此处输入图像描述

How can I keep the TextFormField in its place even when there is an error text to be displayed??即使要显示错误文本,我怎样才能将TextFormField保持在原位?

note: if it turns that showing some code is needed just ask about it, as I think that I explained it clearly above.注意:如果需要显示一些代码,请询问它,因为我认为我在上面已经解释得很清楚了。

Try to add the property crossAxisAlignment: CrossAxisAlignment.start to your row尝试将属性crossAxisAlignment: CrossAxisAlignment.start添加到您的行

Row(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
        ...                      
    ],
),

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

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