mercredi 11 août 2021

Custom dropdown flutter with checkbox

enter image description here

I am new in flutter. It is custom dropdown with rounded corners in all borders. And also drop down menu with checked box listed with it.

I tried few example with render object. but i dont know how to get this design.

Can anyone help me with this design?

Example

class _DropdowncustomState extends State<Dropdowncustom> {
  late String valueChoose;
  List listitem = [
    "Item 1","Item 1","Item 1","Item 1","Item 1"
  ];
  List _gender = [ 'Male','Female','Other'];
  String  ? _genderval;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          padding: EdgeInsets.only(left:10,right:10),

          decoration: BoxDecoration(
            border: Border.all(color:Colors.transparent),
            borderRadius: BorderRadius.all(Radius.circular(30)),
            color: Colors.white,
          ),
          child: DropdownButton(
            hint: Text('Gender'),
            dropdownColor: Colors.white,



            // dropdownColor: Colors.grey[200],
            value: _genderval,
             isExpanded: true,
            onChanged: (value)
            {
              setState(() {
                _genderval= value as String?;
              });
            },
            items: _gender.map((value)
            {
              return DropdownMenuItem(
                value: value,
                child: Text(value) ,);
            }



            ).toList(),

          ),

        ),


      ),
    );
  }
}



Aucun commentaire:

Enregistrer un commentaire