hora picker
This commit is contained in:
@@ -18,6 +18,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||||
|
|
||||||
DateTime? _selectedDate;
|
DateTime? _selectedDate;
|
||||||
|
TimeOfDay? _selectedTime;
|
||||||
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime? picked = await showDatePicker(
|
final DateTime? picked = await showDatePicker(
|
||||||
@@ -34,6 +35,18 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _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 FirebaseStorage storage = FirebaseStorage.instance;
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
var _ciudad = '';
|
var _ciudad = '';
|
||||||
@@ -237,9 +250,18 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
onTap: () {
|
||||||
|
_selectTime(context);
|
||||||
|
},
|
||||||
|
readOnly: true,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
suffixIcon: Icon(Icons.arrow_drop_down),
|
suffixIcon: Icon(Icons.arrow_drop_down),
|
||||||
hintText: 'Hora'),
|
hintText: 'Hora',
|
||||||
|
),
|
||||||
|
controller: TextEditingController(
|
||||||
|
text: _selectedTime == null
|
||||||
|
? ''
|
||||||
|
: ' ${_selectedTime!.format(context)}'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user