skip to Main Content

image description here

so how to create it? I tried to find out but still can’t find a way

2

Answers


  1. You can simply use a dropdown widget and wrap it with visibility widget which will be updated on the basis of that button click:

            bool visible=false;
    
            ElevatedButton(onPressed: (){
              visible=!visible;    //onPressing the click button it will update visible variable
            }, child: Text('Click')),
    
            Visibility(
              visible: visible,    //which will make the dropdown visible
                child: DropdownButton(items: items, onChanged: (){}))
    
    Login or Signup to reply.
  2. Make use of Visibility widget

    bool isDropDownVisible = false
    
     Visibility(
     visible: isDropDownVisible,
     child: DropdownButton(
     // DropDown Code
     )
    

    Now while onButtonClick set it as a below:

    setState(() {
    isCheckSelected =! isCheckSelected;
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search