import 'package:mohem_flutter_app/theme/colors.dart'; import 'package:mohem_flutter_app/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/theme/colors.dart'; import 'package:mohem_flutter_app/utils/utils.dart'; import '../txt.dart'; class DropdownField extends StatefulWidget { String? hint; List? list; DropdownField({this.hint, this.list}); @override State createState() => _DropdownFieldState(); } class _DropdownFieldState extends State { String? dropdownValue; @override Widget build(BuildContext context) { return Container( decoration: containerColorRadiusBorderWidth( Colors.transparent, 4, borderColor, 0.5, ), margin: EdgeInsets.all(2), padding: EdgeInsets.only(left: 8, right: 8), child: DropdownButton( value: dropdownValue, icon: const Icon(Icons.keyboard_arrow_down_sharp), elevation: 16, iconSize: 16, iconEnabledColor: borderColor, iconDisabledColor: borderColor, isExpanded: true, style: const TextStyle(color: Colors.black), hint: Txt( widget.hint ?? "", txtType: TxtType.heading1, bold: false, color: borderColor, ), underline: Container( height: 0, ), onChanged: (String? newValue) { setState(() { dropdownValue = newValue!; }); }, items: (widget.list ?? [ 'One', 'Two', 'Free', 'Four', ]) .map>( (String value) { return DropdownMenuItem( value: value, child: Txt( value, txtType: TxtType.heading1, bold: false, ), ); }, ).toList(), ), ); } }