import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';

class FormBuilderFieldsDropDown {
  static Widget build(
    AmbitoTheme theme,
    String name,
    String label,
    String? initial,
    List<String> options,
  ) {
    return FormBuilderDropdown(
      name: name,
      isDense: true,
      initialValue: initial,
      decoration: InputDecoration(
        fillColor: theme.currentColorScheme.onPrimary,
        filled: true,
        labelText: label,
        hintText: label,
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(8),
        ),
      ),
      items: options
          .map(
            (option) => DropdownMenuItem(
              alignment: AlignmentDirectional.centerStart,
              value: option,
              child: Text(option),
            ),
          )
          .toList(),
    );
  }
}
