import 'package:flutter/material.dart'; import '../themes/themes.dart'; class AppDropdownModel extends StatelessWidget { final String? etiqueta; final String? hint; final T? selectedValue; final void Function(T?)? onChanged; final List>? items; const AppDropdownModel({ super.key, this.etiqueta, this.hint, this.selectedValue, this.onChanged, required this.items, }); double _getFontSize(BuildContext context) { double screenWidth = MediaQuery.of(context).size.width; if (screenWidth < 480) { return 12; } else if (screenWidth < 800) { return 15; } return 16; } @override Widget build(BuildContext context) { double fontSize = _getFontSize(context); TextStyle dropdownTextStyle = TextStyle(fontSize: fontSize); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( etiqueta.toString(), style: TextStyle( fontSize: fontSize, fontWeight: FontWeight.bold, ), ), const SizedBox( height: 5, ), Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15)), // width: size.width, child: DropdownButtonFormField( hint: Text('$hint', style: dropdownTextStyle), style: dropdownTextStyle, borderRadius: BorderRadius.circular(10), icon: Icon( Icons.arrow_drop_down_circle, color: AppTheme.primary, ), decoration: InputDecoration( // labelText: 'Seleccione una salida reciente', floatingLabelStyle: TextStyle( color: AppTheme.primary, fontSize: fontSize, ), labelStyle: TextStyle(color: Colors.grey, fontSize: fontSize), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(15), borderSide: BorderSide(color: AppTheme.primary), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(15), borderSide: const BorderSide(color: Colors.grey), ), ), value: selectedValue, items: items, onChanged: onChanged, ), ), ], ); } }