add bloc builder to use the context

This commit is contained in:
Rafeek-Khoudare
2025-06-27 17:16:41 +03:00
parent 1a4ced195a
commit 0c0bf96c07

View File

@ -3,6 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/device_managment/curtain_module/bloc/curtain_module_bloc.dart';
import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/curtain_movment_widget.dart';
import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/prefrences_dialog.dart';
import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart';
import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedule_control_button.dart';
import 'package:syncrow_web/pages/device_managment/shared/icon_name_status_container.dart';
import 'package:syncrow_web/services/batch_control_devices_service.dart';
import 'package:syncrow_web/services/control_device_service.dart';
@ -24,7 +26,11 @@ class CurtainModuleItems extends StatelessWidget with HelperResponsiveLayout {
controlDeviceService: RemoteControlDeviceService(),
batchControlDevicesService: RemoteBatchControlDevicesService())
..add(FetchCurtainModuleStatusEvent(deviceId: deviceId)),
child: _buildStatusControls(context),
child: BlocBuilder<CurtainModuleBloc, CurtainModuleState>(
builder: (context, state) {
return _buildStatusControls(context);
},
),
);
}
@ -41,19 +47,28 @@ class CurtainModuleItems extends StatelessWidget with HelperResponsiveLayout {
height: 10,
),
SizedBox(
height: 120,
height: 140,
width: 350,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: IconNameStatusContainer(
isFullIcon: false,
name: 'Schedules',
icon: Assets.schedule,
onTap: () {},
status: false,
textColor: ColorsManager.blackColor,
child: ScheduleControlButton(
onTap: () {
showDialog<void>(
context: context,
builder: (ctx) => BlocProvider.value(
value:
BlocProvider.of<CurtainModuleBloc>(context),
child: BuildScheduleView(
deviceUuid: deviceId,
category: 'CUR_2',
),
));
},
mainText: '',
subtitle: 'Scheduling',
iconPath: Assets.scheduling,
),
),
const SizedBox(