build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Implementation

@override
Widget build(BuildContext context) {
  var theme = Theme.of(context);
  var ls = items.mapList(
    (e) => DropdownMenuItem<T>(
      value: e.value,
      child: Center(child: Text(e.label.toString())),
    ),
  );
  return DropdownButtonFormField<T>(
    initialValue: value,
    isExpanded: true,
    style: TextStyle(fontSize: 14, color: theme.textTheme.labelMedium?.color ?? Colors.black87),
    alignment: AlignmentDirectional.centerEnd,
    items: ls,
    hint: hint,
    onChanged: (e) {
      value = e;
      updateState();
      if (onChanged != null) {
        onChanged!(value);
      }
    },
  );
}