before rediense

This commit is contained in:
Felipe
2024-02-26 14:46:26 -05:00
parent 37b6665002
commit a1e367bdf3
10 changed files with 341 additions and 164 deletions
+53
View File
@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
class GenderDropdown extends StatefulWidget {
final Function(String) onChanged;
const GenderDropdown({super.key, required this.onChanged});
@override
State<GenderDropdown> createState() => _GenderDropdownState();
}
class _GenderDropdownState extends State<GenderDropdown> {
String? selectedGender;
@override
Widget build(BuildContext context) {
return InputDecorator(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
prefixIcon: const Icon(Icons.groups),
contentPadding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 7.0,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
isExpanded: true,
value: selectedGender,
hint: const Text(
'Selecciona tu género',
style: TextStyle(fontSize: 16.0),
),
onChanged: (String? newValue) {
setState(() {
selectedGender = newValue;
widget.onChanged(selectedGender!);
});
},
items: ['Masculino', 'Femenino', 'Otro']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
);
}
}