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