import 'package:animated_custom_dropdown/custom_dropdown.dart';
import 'package:flutter/material.dart';
import 'package:hoshan/ui/theme/colors.dart';
import 'package:hoshan/ui/theme/text.dart';

class MultiSelectDropdown extends StatelessWidget {
  final String hintText;
  final List<dynamic> items;
  final Function(List<dynamic>)? onListChanged;
  final Widget Function(BuildContext context, dynamic item, bool isSelected,
      Function() onItemSelect)? child;
  const MultiSelectDropdown(
      {super.key,
      required this.hintText,
      this.onListChanged,
      this.child,
      required this.items});

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.rtl,
      child: CustomDropdown<dynamic>.multiSelect(
        items: items,
        // initialItems: ['item1'],
        hintText: hintText,
        listItemBuilder: child,
        decoration: CustomDropdownDecoration(
            hintStyle: AppTextStyles.body4.copyWith(color: AppColors.gray[700]),
            closedFillColor: Theme.of(context).scaffoldBackgroundColor),
        onListChanged: onListChanged,
      ),
    );
  }
}
