import 'package:flutter/material.dart'; class CustomDropdown extends StatelessWidget { final List items; final List? values; final ValueChanged onChanged; final dynamic value; final String? hint; final String? label; final double radius; final double height; final double width; final Color? color; const CustomDropdown({ super.key, required this.items, this.values, required this.onChanged, this.value, this.hint, this.label, this.radius = 12, this.width = double.infinity, this.height = 70, this.color, }); @override Widget build(BuildContext context) { final borderColor = color ?? const Color(0xFF4B4B4B); OutlineInputBorder border(Color c) => OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(radius)), borderSide: BorderSide(color: c), ); return Column( children: [ if (label != null) ...[ Align( alignment: Alignment.bottomLeft, child: Text( label!, style: const TextStyle(fontSize: 14, letterSpacing: 0), ), ), const SizedBox(height: 8), ], SizedBox( width: width, height: height, child: Center( child: DropdownButtonFormField( dropdownColor: Colors.white, decoration: InputDecoration( enabledBorder: border(borderColor), focusedBorder: border(borderColor), disabledBorder: border(borderColor), errorBorder: border(borderColor), focusedErrorBorder: border(borderColor), contentPadding: const EdgeInsets.symmetric( horizontal: 12, vertical: 16, ), ), initialValue: value, onChanged: onChanged, hint: hint != null ? Text(hint!) : null, items: List>.generate(items.length, ( int index, ) { final dynamic itemValue = values != null ? values![index] : index; return DropdownMenuItem( value: itemValue, child: items[index], ); }), ), ), ), ], ); } }