Refactor SpaceDetailsDevicesBox: Improve readability by extracting variables for product allocations and subspaces. This change enhances code clarity and maintainability in line with Clean Architecture principles.

This commit is contained in:
Faris Armoush
2025-07-03 15:27:06 +03:00
parent 58e99f95b2
commit c07ddb0ccd

View File

@ -6,14 +6,20 @@ import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class SpaceDetailsDevicesBox extends StatelessWidget {
const SpaceDetailsDevicesBox({super.key, required this.space});
const SpaceDetailsDevicesBox({
required this.space,
super.key,
});
final SpaceDetailsModel space;
@override
Widget build(BuildContext context) {
if (space.productAllocations.isNotEmpty ||
space.subspaces.any((subspace) => subspace.productAllocations.isNotEmpty)) {
final productAllocations = space.productAllocations;
final subspaces = space.subspaces;
final isAnySubspaceHasProductAllocations =
subspaces.any((subspace) => subspace.productAllocations.isNotEmpty);
if (productAllocations.isNotEmpty || isAnySubspaceHasProductAllocations) {
return Container(
width: double.infinity,
padding: const EdgeInsets.all(8.0),