hi, in flutter I have tow widgets TextFormField and DropdownButton in a Row But as you see in the picture they are not in the same line
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
width: HDW().fullWidth(context: context, width: 0.35),
height: HDW().fullHeight(context: context, height: 0.08),
child: TextFormField(
controller: sectionTextEditingController,
onChanged: (n) {
homeController.setSectionNo(n);
},
keyboardType: TextInputType.number,
),
),
SizedBox(
width: HDW().fullWidth(context: context, width: 0.35),
height: HDW().fullHeight(context: context, height: 0.08),
child:
DropdownButton<String?>(
items: homeController.sections
.map((e) => DropdownMenuItem<String?>(
value: e,
child: Text( e,textAlign: TextAlign.start,style: TextStyle(fontFamily: font),),
),)
.toList(),
value: homeController.selectedLetter.isNotEmpty
? homeController.selectedLetter
: null,
onChanged: (value) {
homeController.setSectionLetter(value!);
},
hint: Text(
'تحديد',
style: TextStyle(fontFamily: font),
),
isExpanded: true,
icon: const Icon(Icons.keyboard_arrow_down),
),
),
],
)
for note
double fullHeight({ required BuildContext context, double height = 1, }) => height * MediaQuery.of(context).size.height;
Setting isDense: true
on DropdownButton
will solve the bottom padding,
child: DropdownButton<String?>(
isDense: true,
but when it large size, textFiled is needed to be
child: TextFormField(
expands: true,
maxLines: null,
minLines: null,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.