mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
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:
@ -6,14 +6,20 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
|||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class SpaceDetailsDevicesBox extends StatelessWidget {
|
class SpaceDetailsDevicesBox extends StatelessWidget {
|
||||||
const SpaceDetailsDevicesBox({super.key, required this.space});
|
const SpaceDetailsDevicesBox({
|
||||||
|
required this.space,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
final SpaceDetailsModel space;
|
final SpaceDetailsModel space;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (space.productAllocations.isNotEmpty ||
|
final productAllocations = space.productAllocations;
|
||||||
space.subspaces.any((subspace) => subspace.productAllocations.isNotEmpty)) {
|
final subspaces = space.subspaces;
|
||||||
|
final isAnySubspaceHasProductAllocations =
|
||||||
|
subspaces.any((subspace) => subspace.productAllocations.isNotEmpty);
|
||||||
|
if (productAllocations.isNotEmpty || isAnySubspaceHasProductAllocations) {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
Reference in New Issue
Block a user