diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index 36d6114..241a1a2 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -18,6 +18,7 @@ class _ServiceScreenState extends State { final DateFormat formatter = DateFormat('dd/MM/yyyy'); DateTime? _selectedDate; + TimeOfDay? _selectedTime; Future _selectDate(BuildContext context) async { final DateTime? picked = await showDatePicker( @@ -34,6 +35,18 @@ class _ServiceScreenState extends State { } } + Future _selectTime(BuildContext context) async { + final TimeOfDay? pickedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (pickedTime != null) { + setState(() { + _selectedTime = pickedTime; + }); + } + } + final FirebaseStorage storage = FirebaseStorage.instance; final uid = AuthenticationRepository.instance.getCurrentUserUid(); var _ciudad = ''; @@ -237,9 +250,18 @@ class _ServiceScreenState extends State { SizedBox( width: 150, child: TextFormField( + onTap: () { + _selectTime(context); + }, + readOnly: true, decoration: const InputDecoration( - suffixIcon: Icon(Icons.arrow_drop_down), - hintText: 'Hora'), + suffixIcon: Icon(Icons.arrow_drop_down), + hintText: 'Hora', + ), + controller: TextEditingController( + text: _selectedTime == null + ? '' + : ' ${_selectedTime!.format(context)}'), ), ), ],