import 'package:flutter/material.dart';
import 'package:rkm/widgets/text_default.dart';
import '../config/color_palette.dart';
import '../config/const_variable.dart';

class DropDownButtonDefault extends StatelessWidget {
  var onChanged;
  String? select;
  String title;
  double fontSize;
  List list;
  double width;
  double widthContainer;

  DropDownButtonDefault({
    required this.onChanged,
    required this.select,
    required this.title,
    required this.list,
    required this.width,
    this.fontSize = 15,
    this.widthContainer = 300
});

  @override
  Widget build(BuildContext context) {

    return Column(
      children: [
        Container(
          width: width,
          margin: ConstVariable().marginHightInput,
          color: ColorPalette.white,
          child: DropdownButtonHideUnderline(
            child: DropdownButton(
                hint: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 8.0),
                  child: TextDefault(text: title,fontSize: ConstVariable().fontSizeInput,textAlign: TextAlign.end,color: Colors.black,),
                ),
                value: select,
                items: list.map((value) => DropdownMenuItem(
                  value: value,
                  child: Container(
                    width: widthContainer,
                    child: Padding(
                      padding: EdgeInsets.symmetric(horizontal: 10.0),
                      child: TextDefault(
                        text: value,
                        fontSize: fontSize,
                        color: Colors.black,
                      ),
                    ),
                  ),
                )
                ).toList(),
                onChanged:onChanged
            ),
          ),
        ),
      ],
    );
  }
}
