mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HourPickerDialog extends StatefulWidget {
|
||||
@ -16,7 +18,7 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Initialize the selectedHour with the initial time passed to the dialog
|
||||
selectedHour = '${widget.initialTime.hour.toString().padLeft(2, '0')}:00';
|
||||
selectedHour = widget.initialTime.hour.toString().padLeft(2, '0') + ':00';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -26,7 +28,7 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
content: DropdownButton<String>(
|
||||
value: selectedHour, // Show the currently selected hour
|
||||
items: List.generate(24, (index) {
|
||||
final hour = index.toString().padLeft(2, '0');
|
||||
String hour = index.toString().padLeft(2, '0');
|
||||
return DropdownMenuItem<String>(
|
||||
value: '$hour:00',
|
||||
child: Text('$hour:00'),
|
||||
@ -35,16 +37,14 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
onChanged: (String? newValue) {
|
||||
if (newValue != null) {
|
||||
setState(() {
|
||||
selectedHour =
|
||||
newValue; // Update the selected hour without closing the dialog
|
||||
selectedHour = newValue; // Update the selected hour without closing the dialog
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pop(null), // Close the dialog without selection
|
||||
onPressed: () => Navigator.of(context).pop(null), // Close the dialog without selection
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
|
Reference in New Issue
Block a user