I want to create dropdown which look like I mention but I am not able to achieve my aspected results
I try to use render box for make custom dropdown but it want feel like actual dropdown
Can anyone help me to get this type of result
I want Result like this:-
My curent ui look like this:-
Here is my code:-
class AppDropDown extends StatefulWidget {
AppDropDown({
Key? key,
required this.dropDownList,
required this.selected,
this.text = "",
}) : super(key: key);
final List<String> dropDownList;
String selected;
final String text;
@override
State<PerytonDropDown> createState() => _PerytonDropDownState();
}
class _PerytonDropDownState extends State<PerytonDropDown> {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.sp),
),
child: Material(
borderRadius: BorderRadius.circular(15.sp),
clipBehavior: Clip.antiAlias,
color: Colors.transparent,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.text.isNotEmpty) (8.0).addHSpace(),
if (widget.text.isNotEmpty) "${widget.text}".grayText(),
SizedBox(
height: 40,
child: DropdownButton<String>(
isExpanded: true,
value: widget.selected,
underline: SizedBox(),
onChanged: (String? value) {
print(value);
setState(() {
widget.selected = value!;
});
},
alignment: Alignment.bottomRight,
borderRadius: BorderRadius.circular(15),
items: widget.dropDownList
.map((item) => DropdownMenuItem(
child: Text(
item,
),
value: item,
))
.toList(),
),
)
],
).pSymmetricOnly(horizontal: 10),
),
);
}
}
CodePudding user response:



