diff --git a/lib/pages/spaces_management/widgets/dialogs/create_space_dialog.dart b/lib/pages/spaces_management/widgets/dialogs/create_space_dialog.dart index 62d9fe0e..b7a17b76 100644 --- a/lib/pages/spaces_management/widgets/dialogs/create_space_dialog.dart +++ b/lib/pages/spaces_management/widgets/dialogs/create_space_dialog.dart @@ -323,18 +323,21 @@ class CreateSpaceDialogState extends State { spacing: 8, runSpacing: 8, children: [ - for (var product in selectedProducts) + for (var i = 0; i < selectedProducts.length; i++) ...[ HoverableButton( - iconPath: _mapIconToProduct(product.productId, products), - text: 'x${product.count}', + iconPath: _mapIconToProduct(selectedProducts[i].productId, products), + text: 'x${selectedProducts[i].count}', onTap: () { setState(() { - selectedProducts.remove(product); + selectedProducts.remove(selectedProducts[i]); }); // Handle button tap }, ), - // Add Button + if (i < selectedProducts.length - 1) + const SizedBox(width: 2), // Add space except after the last button + ], + const SizedBox(width: 2), GestureDetector( onTap: () { showDialog(