feat : chicken root page , inventory , sale in province
This commit is contained in:
@@ -44,3 +44,4 @@ export 'package:dio/dio.dart' show DioException;
|
||||
//utils
|
||||
export 'utils/logger_utils.dart';
|
||||
export 'utils/safe_call_utils.dart';
|
||||
export 'utils/date_time_utils.dart';
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/infrastructure/remote/interfaces/i_form_data.dart';
|
||||
|
||||
@@ -14,30 +12,42 @@ class DioRemote implements IHttpClient {
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
final dio = Dio(BaseOptions(baseUrl: baseUrl??''));
|
||||
final dio = Dio(BaseOptions(baseUrl: baseUrl ?? ''));
|
||||
if (kDebugMode) {
|
||||
dio.interceptors.add(PrettyDioLogger(
|
||||
requestHeader: true,
|
||||
responseHeader: true,
|
||||
requestBody: true
|
||||
));
|
||||
dio.interceptors.add(
|
||||
PrettyDioLogger(
|
||||
requestHeader: true,
|
||||
responseHeader: true,
|
||||
requestBody: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
_dio = dio;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<DioResponse<T>> get<T>(
|
||||
String path, {
|
||||
Map<String, dynamic>? queryParameters,
|
||||
Map<String, String>? headers,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
String path, {
|
||||
Map<String, dynamic>? queryParameters,
|
||||
Map<String, String>? headers,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
T Function(Map<String, dynamic> json)? fromJson,
|
||||
T Function(List<dynamic> json)? fromJsonList,
|
||||
}) async {
|
||||
final response = await _dio.get(
|
||||
path,
|
||||
queryParameters: queryParameters,
|
||||
options: Options(headers: headers),
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
if (fromJsonList != null && response.data is List) {
|
||||
response.data = fromJsonList(response.data);
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
if (fromJson != null && response.data is Map<String, dynamic>) {
|
||||
response.data = fromJson(response.data);
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
@@ -62,13 +72,14 @@ class DioRemote implements IHttpClient {
|
||||
|
||||
if (fromJson != null) {
|
||||
final rawData = response.data;
|
||||
final parsedData =
|
||||
rawData is Map<String, dynamic> ? fromJson(rawData) : null;
|
||||
final parsedData = rawData is Map<String, dynamic>
|
||||
? fromJson(rawData)
|
||||
: null;
|
||||
response.data = parsedData;
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
return DioResponse<T>(response );
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -57,6 +57,9 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/information.svg
|
||||
SvgGenImage get information => const SvgGenImage('assets/icons/information.svg');
|
||||
|
||||
/// File path: assets/icons/inside.svg
|
||||
SvgGenImage get inside => const SvgGenImage('assets/icons/inside.svg');
|
||||
|
||||
/// File path: assets/icons/inspection.svg
|
||||
SvgGenImage get inspection => const SvgGenImage('assets/icons/inspection.svg');
|
||||
|
||||
@@ -78,6 +81,9 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/message_add.svg
|
||||
SvgGenImage get messageAdd => const SvgGenImage('assets/icons/message_add.svg');
|
||||
|
||||
/// File path: assets/icons/outside.svg
|
||||
SvgGenImage get outside => const SvgGenImage('assets/icons/outside.svg');
|
||||
|
||||
/// File path: assets/icons/pdf_download.svg
|
||||
SvgGenImage get pdfDownload => const SvgGenImage('assets/icons/pdf_download.svg');
|
||||
|
||||
@@ -129,6 +135,9 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/virtual.svg
|
||||
SvgGenImage get virtual => const SvgGenImage('assets/icons/virtual.svg');
|
||||
|
||||
/// File path: assets/icons/whare_house.svg
|
||||
SvgGenImage get whareHouse => const SvgGenImage('assets/icons/whare_house.svg');
|
||||
|
||||
/// List of all assets
|
||||
List<SvgGenImage> get values => [
|
||||
add,
|
||||
@@ -145,6 +154,7 @@ class $AssetsIconsGen {
|
||||
filter,
|
||||
gps,
|
||||
information,
|
||||
inside,
|
||||
inspection,
|
||||
key,
|
||||
liveStock,
|
||||
@@ -152,6 +162,7 @@ class $AssetsIconsGen {
|
||||
map,
|
||||
mapMarker,
|
||||
messageAdd,
|
||||
outside,
|
||||
pdfDownload,
|
||||
pictureFrame,
|
||||
placeHolder,
|
||||
@@ -169,6 +180,7 @@ class $AssetsIconsGen {
|
||||
user,
|
||||
userSquare,
|
||||
virtual,
|
||||
whareHouse,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
class FontFamily {
|
||||
FontFamily._();
|
||||
|
||||
/// Font family: yekan
|
||||
static const String yekan = 'yekan';
|
||||
/// Font family: iranyekanregularfanum
|
||||
static const String iranyekanregularfanum = 'iranyekanregularfanum';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
extension XDataTime on DateTime {
|
||||
String get formattedGregorianDate {
|
||||
|
||||
return "$year/${month.toString().padLeft(2, '0')}/${day.toString().padLeft(2, '0')}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
extension ListExtensions<T> on List<T> {
|
||||
void toggle(T item) {
|
||||
if (contains(item)) {
|
||||
if (length > 1) {
|
||||
|
||||
remove(item);
|
||||
}
|
||||
|
||||
} else {
|
||||
add(item);
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export 'color_utils.dart';
|
||||
export 'list_extensions.dart';
|
||||
export 'list_extensions.dart';
|
||||
export 'data_time_utils.dart';
|
||||
10
packages/core/lib/utils/date_time_utils.dart
Normal file
10
packages/core/lib/utils/date_time_utils.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:persian_datetime_picker/persian_datetime_picker.dart';
|
||||
|
||||
extension xDateTime on String{
|
||||
get toDateTime => DateTime.parse(this);
|
||||
get formattedJalaliDate{
|
||||
final dateTime = DateTime.parse(this);
|
||||
final jalaliDate = Jalali.fromDateTime(dateTime);
|
||||
return "${jalaliDate.year}/${jalaliDate.month.toString().padLeft(2, '0')}/${jalaliDate.day.toString().padLeft(2, '0')}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user