revert back http

This commit is contained in:
hannathkadher
2025-01-09 12:58:42 +04:00
parent 339a242e74
commit d0b853b188
2 changed files with 19 additions and 43 deletions

View File

@ -52,7 +52,6 @@ class SpaceModelPage extends StatelessWidget {
products: products, products: products,
allTags: allTagValues, allTags: allTagValues,
onLoad: (newModel) { onLoad: (newModel) {
context.read<SpaceModelBloc>().add( context.read<SpaceModelBloc>().add(
CreateSpaceModel( CreateSpaceModel(
newSpaceModel: newModel), newSpaceModel: newModel),
@ -67,7 +66,10 @@ class SpaceModelPage extends StatelessWidget {
} }
// Render existing space model // Render existing space model
final model = spaceModels[index]; final model = spaceModels[index];
return SpaceModelCardWidget(model: model); return Container(
margin: const EdgeInsets.all(8.0),
child: SpaceModelCardWidget(model: model),
);
}, },
), ),
), ),
@ -90,6 +92,7 @@ class SpaceModelPage extends StatelessWidget {
Widget _buildAddContainer() { Widget _buildAddContainer() {
return Container( return Container(
margin: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: ColorsManager.whiteColors, color: ColorsManager.whiteColors,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
@ -111,7 +114,7 @@ class SpaceModelPage extends StatelessWidget {
child: Center( child: Center(
child: Container( child: Container(
width: 60, width: 60,
height: 60, height: 0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: ColorsManager.neutralGray, color: ColorsManager.neutralGray,
@ -133,14 +136,14 @@ class SpaceModelPage extends StatelessWidget {
double _calculateChildAspectRatio(BuildContext context) { double _calculateChildAspectRatio(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
if (screenWidth > 1600) { if (screenWidth > 1600) {
return 3; return 2; // Taller cards for larger screens
} }
if (screenWidth > 1200) { if (screenWidth > 1200) {
return 5; return 3; // Adjusted height for medium screens
} else if (screenWidth > 800) { } else if (screenWidth > 800) {
return 5; return 3.5; // Adjusted height for smaller screens
} else { } else {
return 6.0; return 4.0; // Default ratio for smallest screens
} }
} }

View File

@ -1,7 +1,4 @@
import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:syncrow_web/services/api/http_interceptor.dart'; import 'package:syncrow_web/services/api/http_interceptor.dart';
import 'package:syncrow_web/services/locator.dart'; import 'package:syncrow_web/services/locator.dart';
import 'package:syncrow_web/utils/constants/api_const.dart'; import 'package:syncrow_web/utils/constants/api_const.dart';
@ -35,56 +32,32 @@ class HTTPService {
bool showServerMessage = true, bool showServerMessage = true,
}) async { }) async {
try { try {
// Log the request path and query parameters
debugPrint('GET Request: $path');
if (queryParameters != null) {
debugPrint('Query Parameters: $queryParameters');
}
// Perform the HTTP GET request
final response = await client.get( final response = await client.get(
path, path,
queryParameters: queryParameters, queryParameters: queryParameters,
); );
return expectedResponseModel(response.data);
// Log the raw response data
debugPrint('Response Data: ${response.data}');
// Process the response using the expected model function
final result = expectedResponseModel(response.data);
return result;
} catch (error) { } catch (error) {
// Log the error details rethrow;
debugPrint('Error in GET Request: $error');
rethrow; // Re-throw the error to propagate it further
} }
} }
Future<T> post<T>({ Future<T> post<T>(
required String path, {required String path,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
Options? options, Options? options,
dynamic body, dynamic body,
bool showServerMessage = true, bool showServerMessage = true,
required T Function(dynamic) expectedResponseModel, required T Function(dynamic) expectedResponseModel}) async {
}) async {
try { try {
final bodyString = body is Map || body is List
? jsonEncode(body)
: body?.toString() ?? 'null';
print("POST Request: $path, Body: $bodyString, Query: $queryParameters");
final response = await client.post( final response = await client.post(
path, path,
data: body, data: body,
queryParameters: queryParameters, queryParameters: queryParameters,
options: options, options: options,
); );
print("POST Response: ${response.data.toString()}");
return expectedResponseModel(response.data); return expectedResponseModel(response.data);
} catch (error) { } catch (error) {
print("POST Error: $error");
rethrow; rethrow;
} }
} }