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/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(
|
||||||
|
Reference in New Issue
Block a user