remove unused code

This commit is contained in:
mohammad
2025-03-06 12:51:30 +03:00
parent 254485235d
commit 54a250ea2f
3 changed files with 7 additions and 243 deletions

View File

@ -32,9 +32,6 @@ class LinkSpaceToModelBloc
List<String> spacesList = List<String> spacesList =
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? []; spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
spacesListIds = spacesList; spacesListIds = spacesList;
for (var spaceId in spacesList) {
print('spaceId===$spaceId');
}
} }
hasSelectedSpaces = hasSelectedSpaces =
spaceBloc.state.selectedCommunities.any((communityId) { spaceBloc.state.selectedCommunities.any((communityId) {
@ -43,12 +40,12 @@ class LinkSpaceToModelBloc
return spacesList.isNotEmpty; return spacesList.isNotEmpty;
}); });
if (hasSelectedSpaces) { if (hasSelectedSpaces) {
print("At least one space is selected."); debugPrint("At least one space is selected.");
} else { } else {
print("No spaces selected."); debugPrint("No spaces selected.");
} }
} catch (e) { } catch (e) {
print("Error in _getSpaceIds: $e"); debugPrint("Error in _getSpaceIds: $e");
} }
} }

View File

@ -1,235 +1,9 @@
// import 'package:flutter/material.dart';
// import 'package:flutter_bloc/flutter_bloc.dart';
// import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
// import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_model_bloc.dart';
// import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_model_event.dart';
// import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
// import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart';
// import 'package:syncrow_web/utils/color_manager.dart';
// class LinkSpaceModelSpacesDialog extends StatefulWidget {
// final SpaceTemplateModel spaceModel;
// LinkSpaceModelSpacesDialog({super.key, required this.spaceModel});
// @override
// State<LinkSpaceModelSpacesDialog> createState() =>
// _LinkSpaceModelSpacesDialogState();
// }
// class _LinkSpaceModelSpacesDialogState
// extends State<LinkSpaceModelSpacesDialog> {
// TextEditingController searchController = TextEditingController();
// @override
// void initState() {
// context.read<SpaceModelBloc>().add(SpaceModelSelectedIdsEvent());
// super.initState();
// }
// @override
// Widget build(BuildContext context) {
// return AlertDialog(
// contentPadding: EdgeInsets.zero,
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
// backgroundColor: Colors.white,
// content: SizedBox(
// width: MediaQuery.of(context).size.width * 0.4,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(15.0),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// const Center(
// child: Text(
// "Link Space Model to Spaces",
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: Colors.blueAccent,
// ),
// ),
// ),
// const Divider(),
// const SizedBox(height: 16),
// _buildDetailRow(
// "Space model name:", widget.spaceModel.modelName),
// _buildDetailRow("Creation date and time:",
// widget.spaceModel.createdAt.toString()),
// _buildDetailRow("Created by:", "Admin"),
// const SizedBox(height: 12),
// const Text(
// "Link to:",
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// const Text(
// "Please select all the spaces where you would like to link the Routine.",
// style: TextStyle(fontSize: 12, color: Colors.grey),
// ),
// const SizedBox(height: 8),
// Expanded(
// child: SizedBox(
// child: Column(
// children: [
// Expanded(
// flex: 7,
// child: Container(
// color: ColorsManager.whiteColors,
// child: SpaceTreeView(
// isSide: true,
// onSelect: () {
// context.read<SpaceModelBloc>().add(
// SpaceModelSelectedIdsEvent());
// })))
// ],
// ),
// ),
// ),
// const SizedBox(
// height: 20,
// ),
// ],
// ),
// ),
// ),
// // Buttons
// Row(
// children: [
// Expanded(
// child: Container(
// height: 50,
// decoration: const BoxDecoration(
// border: Border(
// right: BorderSide(
// color: ColorsManager.grayColor,
// width: 0.5,
// ),
// top: BorderSide(
// color: ColorsManager.grayColor,
// width: 1,
// ),
// ),
// ),
// child: _buildButton("Cancel", Colors.grey, () {
// Navigator.of(context).pop();
// }),
// ),
// ),
// Expanded(
// child: Container(
// height: 50,
// decoration: const BoxDecoration(
// border: Border(
// left: BorderSide(
// color: ColorsManager.grayColor,
// width: 0.5,
// ),
// top: BorderSide(
// color: ColorsManager.grayColor,
// width: 1.0,
// ),
// ),
// ),
// child: _buildButton(
// "Confirm", ColorsManager.onSecondaryColor, () {
// final spaceModelBloc = context.read<SpaceModelBloc>();
// if (!spaceModelBloc.hasSelectedSpaces) {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content:
// Text("Please select at least one space")),
// );
// return;
// } else {
// // spaceModelBloc.add(LinkSpaceModelEvent(
// // selectedSpaceMode: widget.spaceModel.uuid));
// spaceModelBloc.add(ValidateSpaceModelEvent(context: context));
// }
// Future.delayed(const Duration(seconds: 3), () {
// Navigator.of(context).pop();
// Navigator.of(context).pop();
// // showDialog(
// // context: context,
// // builder: (BuildContext dialogContext) {
// // return const LinkingSuccessful();
// // },
// // );
// showDialog(
// context: context,
// builder: (BuildContext dialogContext) {
// return const ConfirmOverwriteDialog();
// },
// );
// });
// }),
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// );
// }
// // Method to build a detail row
// Widget _buildDetailRow(String label, String value) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 4),
// child: Row(
// children: [
// Expanded(
// child: Text(
// label,
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// ),
// const SizedBox(width: 8),
// Expanded(
// child: Text(
// value,
// style:
// TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
// ),
// ),
// ],
// ),
// );
// }
// Widget _buildButton(String text, Color color, VoidCallback onPressed) {
// return InkWell(
// onTap: onPressed,
// child: Center(
// child: Text(
// text,
// style: TextStyle(
// color: color, fontWeight: FontWeight.w400, fontSize: 14),
// ),
// ),
// );
// }
// }
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart'; import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_event.dart'; import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_event.dart';
import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_state.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/overwrite_dialog.dart';
import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/color_manager.dart';
class LinkSpaceModelSpacesDialog extends StatefulWidget { class LinkSpaceModelSpacesDialog extends StatefulWidget {
@ -244,9 +18,6 @@ class LinkSpaceModelSpacesDialog extends StatefulWidget {
class _LinkSpaceModelSpacesDialogState class _LinkSpaceModelSpacesDialogState
extends State<LinkSpaceModelSpacesDialog> { extends State<LinkSpaceModelSpacesDialog> {
final TextEditingController _searchController = TextEditingController();
bool _isLoading = false;
@override @override
void initState() { void initState() {
context.read<LinkSpaceToModelBloc>().add(LinkSpaceModelSelectedIdsEvent()); context.read<LinkSpaceToModelBloc>().add(LinkSpaceModelSelectedIdsEvent());
@ -420,14 +191,15 @@ Widget _buildDetailRow(String label, String value) {
Expanded( Expanded(
child: Text( child: Text(
label, label,
style: TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
value, value,
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black), style: const TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
), ),
), ),
], ],

View File

@ -2,7 +2,6 @@ import 'package:syncrow_web/pages/spaces_management/space_model/models/create_sp
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
import 'package:syncrow_web/services/api/http_service.dart'; import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart'; import 'package:syncrow_web/utils/constants/api_const.dart';
import 'package:syncrow_web/utils/constants/temp_const.dart';
class SpaceModelManagementApi { class SpaceModelManagementApi {
Future<List<SpaceTemplateModel>> listSpaceModels( Future<List<SpaceTemplateModel>> listSpaceModels(
@ -66,11 +65,6 @@ class SpaceModelManagementApi {
required String projectId, required String projectId,
required List<String> spaceUuids, required List<String> spaceUuids,
required bool isOverWrite}) async { required bool isOverWrite}) async {
print(spaceModelUuid);
print(projectId);
print(spaceUuids);
print(isOverWrite);
final response = await HTTPService().post( final response = await HTTPService().post(
path: ApiEndpoints.linkSpaceModel path: ApiEndpoints.linkSpaceModel
.replaceAll('{projectId}', projectId) .replaceAll('{projectId}', projectId)
@ -93,6 +87,7 @@ class SpaceModelManagementApi {
expectedResponseModel: (json) { expectedResponseModel: (json) {
return json; return json;
}); });
return response;
} }
Future<bool> deleteSpaceModel(String spaceModelUuid, String projectId) async { Future<bool> deleteSpaceModel(String spaceModelUuid, String projectId) async {