0

How can I add two additional items in list in dropdown items? One textfield for search and one for text button. enter image description here

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
arcthurus
  • 75
  • 6

1 Answers1

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