mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
finished ac devices
This commit is contained in:
@ -9,9 +9,6 @@ class RoutineDevices extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Get the RoutineBloc instance from the parent
|
||||
final routineBloc = context.read<RoutineBloc>();
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) => DeviceManagementBloc()..add(FetchDevices()),
|
||||
child: BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
||||
@ -26,32 +23,28 @@ class RoutineDevices extends StatelessWidget {
|
||||
.toList();
|
||||
|
||||
// Provide the RoutineBloc to the child widgets
|
||||
return BlocProvider.value(
|
||||
value: routineBloc,
|
||||
child: BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, routineState) {
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
children: deviceList.asMap().entries.map((entry) {
|
||||
final device = entry.value;
|
||||
return DraggableCard(
|
||||
imagePath: device.getDefaultIcon(device.productType),
|
||||
title: device.name ?? '',
|
||||
deviceData: {
|
||||
'key': UniqueKey().toString(),
|
||||
'imagePath':
|
||||
device.getDefaultIcon(device.productType),
|
||||
'title': device.name ?? '',
|
||||
'deviceId': device.uuid,
|
||||
'productType': device.productType,
|
||||
'functions': device.functions,
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, routineState) {
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
children: deviceList.asMap().entries.map((entry) {
|
||||
final device = entry.value;
|
||||
return DraggableCard(
|
||||
imagePath: device.getDefaultIcon(device.productType),
|
||||
title: device.name ?? '',
|
||||
deviceData: {
|
||||
'device': device,
|
||||
'imagePath': device.getDefaultIcon(device.productType),
|
||||
'title': device.name ?? '',
|
||||
'deviceId': device.uuid,
|
||||
'productType': device.productType,
|
||||
'functions': device.functions,
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
|
Reference in New Issue
Block a user