mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
added disabled space model button on adding tags and subspace, vice versa
This commit is contained in:
@ -95,6 +95,10 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool isSpaceModelDisabled = (tags != null && tags!.isNotEmpty ||
|
||||||
|
subspaces != null && subspaces!.isNotEmpty);
|
||||||
|
bool isTagsAndSubspaceModelDisabled = (selectedSpaceModel != null);
|
||||||
|
|
||||||
final screenWidth = MediaQuery.of(context).size.width;
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: widget.isEdit
|
title: widget.isEdit
|
||||||
@ -240,11 +244,14 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_showLinkSpaceModelDialog(context);
|
isSpaceModelDisabled
|
||||||
|
? null
|
||||||
|
: _showLinkSpaceModelDialog(context);
|
||||||
},
|
},
|
||||||
child: const ButtonContentWidget(
|
child: ButtonContentWidget(
|
||||||
svgAssets: Assets.link,
|
svgAssets: Assets.link,
|
||||||
label: 'Link a space model',
|
label: 'Link a space model',
|
||||||
|
disabled: isSpaceModelDisabled,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(
|
||||||
@ -333,12 +340,15 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
overlayColor: ColorsManager.transparentColor,
|
overlayColor: ColorsManager.transparentColor,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_showSubSpaceDialog(context, enteredName, [],
|
isTagsAndSubspaceModelDisabled
|
||||||
false, widget.products, subspaces);
|
? null
|
||||||
|
: _showSubSpaceDialog(context, enteredName,
|
||||||
|
[], false, widget.products, subspaces);
|
||||||
},
|
},
|
||||||
child: const ButtonContentWidget(
|
child: ButtonContentWidget(
|
||||||
icon: Icons.add,
|
icon: Icons.add,
|
||||||
label: 'Create Sub Space',
|
label: 'Create Sub Space',
|
||||||
|
disabled: isTagsAndSubspaceModelDisabled,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
@ -492,19 +502,22 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
)
|
)
|
||||||
: TextButton(
|
: TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_showTagCreateDialog(
|
isTagsAndSubspaceModelDisabled
|
||||||
context,
|
? null
|
||||||
enteredName,
|
: _showTagCreateDialog(
|
||||||
widget.isEdit,
|
context,
|
||||||
widget.products,
|
enteredName,
|
||||||
);
|
widget.isEdit,
|
||||||
|
widget.products,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
),
|
),
|
||||||
child: const ButtonContentWidget(
|
child: ButtonContentWidget(
|
||||||
icon: Icons.add,
|
icon: Icons.add,
|
||||||
label: 'Add Devices',
|
label: 'Add Devices',
|
||||||
|
disabled: isTagsAndSubspaceModelDisabled,
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user