Refactor CommunityStructureHeaderActionButtons to simplify null handling for selectedSpace and improve widget structure. Ensure buttons are always displayed when selectedSpace is not null, enhancing readability and maintainability.

This commit is contained in:
Faris Armoush
2025-07-15 12:49:37 +03:00
parent f832c5d884
commit df39fca050

View File

@ -19,11 +19,12 @@ class CommunityStructureHeaderActionButtons extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (selectedSpace == null) return const SizedBox.shrink();
return Wrap( return Wrap(
alignment: WrapAlignment.end, alignment: WrapAlignment.end,
spacing: 10, spacing: 10,
children: [ children: [
if (selectedSpace != null) ...[
CommunityStructureHeaderButton( CommunityStructureHeaderButton(
label: 'Edit', label: 'Edit',
svgAsset: Assets.editSpace, svgAsset: Assets.editSpace,
@ -40,7 +41,6 @@ class CommunityStructureHeaderActionButtons extends StatelessWidget {
onPressed: () => onDelete(selectedSpace!), onPressed: () => onDelete(selectedSpace!),
), ),
], ],
],
); );
} }
} }