mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 07:52:27 +00:00
dont use context in async block
This commit is contained in:
@ -7,12 +7,12 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class TimePickerWidget extends StatefulWidget {
|
||||
final String title;
|
||||
const TimePickerWidget({
|
||||
TimePickerWidget({
|
||||
super.key,
|
||||
required this.onTimePicked,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
late NonBookableSpacesBloc nonBookableSpacesBloc;
|
||||
final void Function(TimeOfDay? timePicked) onTimePicked;
|
||||
@override
|
||||
State<TimePickerWidget> createState() => _TimePickerWidgetState();
|
||||
@ -20,6 +20,13 @@ class TimePickerWidget extends StatefulWidget {
|
||||
|
||||
class _TimePickerWidgetState extends State<TimePickerWidget> {
|
||||
TimeOfDay? timePicked;
|
||||
@override
|
||||
void initState() {
|
||||
widget.nonBookableSpacesBloc = context.read<NonBookableSpacesBloc>();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
@ -42,7 +49,7 @@ class _TimePickerWidgetState extends State<TimePickerWidget> {
|
||||
);
|
||||
widget.onTimePicked(tempTime);
|
||||
timePicked = tempTime;
|
||||
context.read<NonBookableSpacesBloc>().add(CheckConfigurValidityEvent());
|
||||
widget.nonBookableSpacesBloc.add(CheckConfigurValidityEvent());
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
|
Reference in New Issue
Block a user