feat : segment page
This commit is contained in:
@@ -6,7 +6,6 @@ class DioRemote implements IHttpClient {
|
||||
late Dio dio;
|
||||
final AppInterceptor interceptors;
|
||||
|
||||
|
||||
DioRemote({this.baseUrl, required this.interceptors});
|
||||
|
||||
@override
|
||||
@@ -90,6 +89,7 @@ class DioRemote implements IHttpClient {
|
||||
Map<String, String>? headers,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
T Function(Map<String, dynamic> json)? fromJson,
|
||||
}) async {
|
||||
final response = await dio.put(
|
||||
path,
|
||||
@@ -100,6 +100,11 @@ class DioRemote implements IHttpClient {
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
cancelToken: ApiHandler.globalCancelToken,
|
||||
);
|
||||
|
||||
if (fromJson != null && response.data is Map<String, dynamic>) {
|
||||
response.data = fromJson(response.data);
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
@@ -109,6 +114,7 @@ class DioRemote implements IHttpClient {
|
||||
dynamic data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
Map<String, String>? headers,
|
||||
T Function(Map<String, dynamic> json)? fromJson,
|
||||
}) async {
|
||||
final response = await dio.delete<T>(
|
||||
path,
|
||||
|
||||
@@ -149,6 +149,7 @@ class AppColor {
|
||||
static const Color mediumGreyDarker = Color(
|
||||
0xFF323232,
|
||||
); // #323232 rgb(50, 50, 50)
|
||||
static const Color customGrey = Color(0xFF808081); // #808081 rgb(128, 128, 129)
|
||||
//endregion
|
||||
|
||||
//region ---Light Grey Colors ---
|
||||
|
||||
@@ -143,9 +143,6 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/key.svg
|
||||
SvgGenImage get key => const SvgGenImage('assets/icons/key.svg');
|
||||
|
||||
/// File path: assets/icons/killogram.svg
|
||||
SvgGenImage get killogram => const SvgGenImage('assets/icons/killogram.svg');
|
||||
|
||||
/// File path: assets/icons/liveStock.svg
|
||||
SvgGenImage get liveStock => const SvgGenImage('assets/icons/liveStock.svg');
|
||||
|
||||
@@ -285,7 +282,6 @@ class $AssetsIconsGen {
|
||||
inside,
|
||||
inspection,
|
||||
key,
|
||||
killogram,
|
||||
liveStock,
|
||||
lock,
|
||||
logout,
|
||||
@@ -468,9 +464,6 @@ class $AssetsVecGen {
|
||||
/// File path: assets/vec/key.svg.vec
|
||||
SvgGenImage get keySvg => const SvgGenImage.vec('assets/vec/key.svg.vec');
|
||||
|
||||
/// File path: assets/vec/killogram.svg.vec
|
||||
SvgGenImage get killogramSvg => const SvgGenImage.vec('assets/vec/killogram.svg.vec');
|
||||
|
||||
/// File path: assets/vec/liveStock.svg.vec
|
||||
SvgGenImage get liveStockSvg => const SvgGenImage.vec('assets/vec/liveStock.svg.vec');
|
||||
|
||||
@@ -610,7 +603,6 @@ class $AssetsVecGen {
|
||||
insideSvg,
|
||||
inspectionSvg,
|
||||
keySvg,
|
||||
killogramSvg,
|
||||
liveStockSvg,
|
||||
lockSvg,
|
||||
logoutSvg,
|
||||
|
||||
@@ -110,6 +110,11 @@ bool _isRetryableError(dynamic error) {
|
||||
|
||||
String _getErrorMessage(dynamic error) {
|
||||
if (error is DioException) {
|
||||
final responseData = error.response?.data;
|
||||
if (responseData is Map<String, dynamic> && responseData['result'] != null) {
|
||||
return responseData['result'].toString();
|
||||
}
|
||||
|
||||
switch (error.type) {
|
||||
case DioExceptionType.connectionTimeout:
|
||||
return 'خطا در اتصال - زمان اتصال تمام شد';
|
||||
|
||||
Reference in New Issue
Block a user