mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
add bloc builder to use the context
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user