dropdown_button2
dropdown_button2 copied to clipboard
wrong drop menu postion
Hi , when I type on other edit text and return to drop menu I found the menu is opened in wrong position as this video shows
https://github.com/AhmedLSayed9/dropdown_button2/assets/16393042/9c51f395-c520-48d4-920c-6e660aaae427
Can you provide a minimal sample that produces the issue, please? Also, What version are you using?
Can you provide a minimal sample that produces the issue, please? Also, What version are you using?
using dropdown_button2: ^2.3.9
here is code sample
` Padding workerJobDropMenuWidget() {
return Padding(
padding: EdgeInsets.symmetric(vertical: 8.0.h),
child: Obx(() => DropdownButtonFormField2<WorkerJob>(
focusNode: controller.workerJobFocusNode,
isExpanded: true,
decoration: dropMenuInputDecoration,
hint: Text(
'select_worker_job'.tr,
// style: const TextStyle(fontSize: 14),
),
value: controller.selectedWorkerJob.value.id == null
? null
: controller.selectedWorkerJob.value,
items: controller.workerJobList
.map((WorkerJob item) => DropdownMenuItem<WorkerJob>(
value: item,
child: Text(
Get.locale!.languageCode == "ar"
? item.arName!
: item.enName!,
style: const TextStyle(
fontSize: 14,
),
),
))
.toList(),
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) {
if (value == null) {
return 'pls_select_worker_job'.tr;
}
return null;
},
onChanged: (WorkerJob? value) =>
controller.selectedWorkerJob.value = value!,
onSaved: (WorkerJob? value) {
controller.selectedWorkerJob.value = value!;
},
style: Get.textTheme.bodyLarge!,
buttonStyleData: const ButtonStyleData(
padding: EdgeInsets.only(left: 8),
),
iconStyleData: const IconStyleData(
icon: Icon(
Icons.keyboard_arrow_down,
color: Colors.black,
weight: 2,
),
iconSize: 24,
),
dropdownStyleData: DropdownStyleData(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
),
),
)),
);
}`
full class
`class AddWorkerStepOne extends GetWidget<AddWorkerController> {
final ScrollController scrollController = ScrollController();
AddWorkerStepOne({
super.key,
});
@override
Widget build(BuildContext context) {
// scroll to bottom when page is loaded
WidgetsBinding.instance.addPostFrameCallback((_) {
scrollController.animateTo(
scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut,
);
});
return Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
controller: scrollController,
reverse: true,
child: Form(
key: controller.stepOneFormKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('main_worker_data'.tr, style: Get.textTheme.titleLarge!),
16.verticalSpace,
Text('complete_worker_data'.tr,
style: Get.textTheme.bodyMedium!),
30.verticalSpace,
const WorkerNameTitle(),
WorkerNameEditText(controller: controller),
32.verticalSpace,
const WorkerJobTitle(),
workerJobDropMenuWidget(),
32.verticalSpace,
const WorkerSalaryTitle(),
SalaryEditText(controller: controller),
32.verticalSpace,
Text('worker_years_of_experience'.tr,
style: Get.textTheme.bodyLarge!),
yearsOfExperienceDropMenuWidget(),
32.verticalSpace,
Text('about_worker_bio'.tr, style: Get.textTheme.bodyLarge!),
WorkerBioTextEditField(controller: controller),
16.verticalSpace,
NextBtn(controller: controller),
32.verticalSpace,
],
),
),
),
),
);
}`
Can you test the code using latest beta version? Also, I need a working sample without dependencies to be able to test it.
Hi @AhmedLSayed9 I tested with the beta verison and it fixed , but when i try to type one other edit text widget and return to drop menu i notice there is space between menu and edit text as this video shows
https://github.com/AhmedLSayed9/dropdown_button2/assets/16393042/c5b3eb90-f650-4abe-8b6f-29e979a49c05
@heshesh2010 Can you provider a minimal working sample?
@heshesh2010 Can you provider a minimal working sample?
it was my mistake that i wrapped the drop-menu widget with reversed SingleChildScrollView with reverse: true,
do u know why then set reverse: true i got this animating behaviour on drop menu list space ?
do u know why then set reverse: true i got this animating behaviour on drop menu list space ?
I'm not sure what's the reason tbh. It needs a reproducible sample and further investigating.