我尝试使两者高度相等,但它仅适用于一台设备,但对于差异设备,它会发生变化
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Age",
),
SizedBox(
height: DeviceSize.isTablet ? 12 : 6),
TextFormField(
controller: ageController,
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "Age",
isDense: true,
errorText: ageErrorMessage,
),
),
],
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Gender",
style: textStyle,
),
SizedBox(
height: DeviceSize.isTablet ? 12 : 6),
DropdownButtonHideUnderline(
child: DropdownButtonFormField<String>(
isExpanded: true,
decoration: const InputDecoration(
border: OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(
horizontal: 8.0, vertical: 14.5)),
hint: Text(
'Gender',
style: textStyle,
),
value: selectedGender,
validator: validate,
borderRadius: BorderRadius.circular(20),
items: genders.map((String gender) {
return DropdownMenuItem<String>(
value: gender,
child: Text(
gender,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w400),
),
);
}).toList(),
onChanged: (String? value) {},
),
),
],
),
)
],
),
),
我尝试了sizedbox,Container,甚至下拉按钮等等,但没有效果,但它只是破坏了整个程序......
我需要正确且好的方法来对齐所有设备的高度。
您可以尝试为 TextField 和 Dropdown 使用固定高度