mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor SpaceDetailsWidgets: Simplify layout and improve responsiveness in SpaceDetailsDevicesBox and SpaceSubSpacesBox. Update SpaceDetailsForm to enhance dialog width for better user experience. This refactor enhances maintainability and aligns with Clean Architecture principles.
This commit is contained in:
@ -4,7 +4,6 @@ import 'package:syncrow_web/pages/space_management_v2/modules/space_details/doma
|
|||||||
import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart';
|
import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
||||||
|
|
||||||
class SpaceDetailsDevicesBox extends StatelessWidget {
|
class SpaceDetailsDevicesBox extends StatelessWidget {
|
||||||
const SpaceDetailsDevicesBox({super.key, required this.space});
|
const SpaceDetailsDevicesBox({super.key, required this.space});
|
||||||
@ -13,14 +12,10 @@ class SpaceDetailsDevicesBox extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
if (space.productAllocations.isNotEmpty ||
|
if (space.productAllocations.isNotEmpty ||
|
||||||
space.subspaces
|
space.subspaces.any((subspace) => subspace.productAllocations.isNotEmpty)) {
|
||||||
.any((subspace) => subspace.productAllocations.isNotEmpty))
|
return Container(
|
||||||
SizedBox(
|
width: double.infinity,
|
||||||
width: context.screenWidth * 0.25,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.textFieldGreyColor,
|
color: ColorsManager.textFieldGreyColor,
|
||||||
@ -70,21 +65,22 @@ class SpaceDetailsDevicesBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
)
|
} else {
|
||||||
else
|
return TextButton(
|
||||||
TextButton(
|
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
),
|
),
|
||||||
child: const ButtonContentWidget(
|
child: const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: ButtonContentWidget(
|
||||||
svgAssets: Assets.addIcon,
|
svgAssets: Assets.addIcon,
|
||||||
label: 'Add Devices',
|
label: 'Add Devices',
|
||||||
// disabled: isTagsAndSubspaceModelDisabled,
|
// disabled: isTagsAndSubspaceModelDisabled,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -34,6 +34,7 @@ class SpaceDetailsForm extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.whiteColors,
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: context.screenHeight * 0.3,
|
height: context.screenHeight * 0.3,
|
||||||
|
width: context.screenWidth * 0.5,
|
||||||
child: Row(
|
child: Row(
|
||||||
spacing: 20,
|
spacing: 20,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -8,7 +8,6 @@ import 'package:syncrow_web/pages/space_management_v2/modules/space_details/pres
|
|||||||
import 'package:syncrow_web/pages/space_management_v2/modules/update_space/presentation/bloc/space_details_model_bloc/space_details_model_bloc.dart';
|
import 'package:syncrow_web/pages/space_management_v2/modules/update_space/presentation/bloc/space_details_model_bloc/space_details_model_bloc.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
||||||
|
|
||||||
class SpaceSubSpacesBox extends StatelessWidget {
|
class SpaceSubSpacesBox extends StatelessWidget {
|
||||||
const SpaceSubSpacesBox({super.key, required this.subspaces});
|
const SpaceSubSpacesBox({super.key, required this.subspaces});
|
||||||
@ -17,26 +16,25 @@ class SpaceSubSpacesBox extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
if (subspaces.isEmpty) {
|
||||||
children: [
|
return TextButton(
|
||||||
if (subspaces.isEmpty)
|
|
||||||
TextButton(
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
overlayColor: ColorsManager.transparentColor,
|
overlayColor: ColorsManager.transparentColor,
|
||||||
),
|
),
|
||||||
onPressed: () => _showSubSpacesDialog(context),
|
onPressed: () => _showSubSpacesDialog(context),
|
||||||
child: const ButtonContentWidget(
|
child: const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: ButtonContentWidget(
|
||||||
svgAssets: Assets.addIcon,
|
svgAssets: Assets.addIcon,
|
||||||
label: 'Create Sub Spaces',
|
label: 'Create Sub Spaces',
|
||||||
disabled: false,
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
else
|
);
|
||||||
SizedBox(
|
} else {
|
||||||
width: context.screenWidth * 0.25,
|
return Container(
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.textFieldGreyColor,
|
color: ColorsManager.textFieldGreyColor,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
@ -49,19 +47,15 @@ class SpaceSubSpacesBox extends StatelessWidget {
|
|||||||
spacing: 8.0,
|
spacing: 8.0,
|
||||||
runSpacing: 8.0,
|
runSpacing: 8.0,
|
||||||
children: [
|
children: [
|
||||||
...subspaces.map(
|
...subspaces.map((e) => SubspaceNameDisplayWidget(subSpace: e)),
|
||||||
(e) => SubspaceNameDisplayWidget(subSpace: e),
|
|
||||||
),
|
|
||||||
EditChip(
|
EditChip(
|
||||||
onTap: () => _showSubSpacesDialog(context),
|
onTap: () => _showSubSpacesDialog(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _showSubSpacesDialog(BuildContext context) {
|
void _showSubSpacesDialog(BuildContext context) {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
|
Reference in New Issue
Block a user