How can I add two additional items in list in dropdown items? One textfield for search and one for text button.
Asked
Active
Viewed 150 times
0

Md. Yeasin Sheikh
- 54,221
- 7
- 29
- 56

arcthurus
- 75
- 6
-
Can share you code base please? Screenshot with desired design could be also very helpful. :) – DrzwiPercepcji Mar 06 '23 at 18:24
1 Answers
0
The key point using button on DropdownButton
is to set enabled: false
on DropdownMenuItem
. and for the constraints you can use top-level LayoutBuilder.
DropdownButton(
items: [
DropdownMenuItem(
child: SizedBox(width: 200, child: CupertinoTextField()),
enabled: false,
value: "search",
),
DropdownMenuItem(
child: SizedBox(
width: 200,
child: TextButton(
onPressed: () {
//if you like to close uncomment below line
// Navigator.of(context).pop();
},
child: Text("tap"),
),
),
enabled: false,
value: "search",
),
DropdownMenuItem(
child: Text("a"),
value: "a",
),
],
onChanged: (value) {},
),

Md. Yeasin Sheikh
- 54,221
- 7
- 29
- 56