I want to show my own page on dropdown button tap, then item selected on page should be set as dropdown button value.
So basically, I need DropdownButton without any popup on tap. When I use onTap
still default popup will be shown, how to prevent that?
CodePudding user response:
why you don't use a button instead? or you can try to create an Inkwell put a container on its child and make it look like a button and write your code inside Inkwell OnTap(){}
CodePudding user response:
1- Pass null to items
parameter to disable the button.
2- You'll notice icon's color will be grey with disabled button, you can change it by setting color
of the icon you send to icon
parameter or send color directly to iconDisabledColor
parameter.
3- You'll not use value
parameter, instead you'll just use hint
to show both your hint and your value. and update it using your state management after you pick new value from your own page.
4- Wrap your DropdownButton with GestureDetector
or InkWell
to show your own page when you tap on the button.
5- If you want to customize your DropdownButton shape, size and more. You can try my new package DropdownButton2. It's simple, easy, based on Flutter's core DropdownButton and have lots of features.