feat : home page
This commit is contained in:
44
packages/core/lib/utils/map_utils.dart
Normal file
44
packages/core/lib/utils/map_utils.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:rasadyar_core/presentation/utils/data_time_utils.dart';
|
||||
|
||||
Map<String, dynamic> buildQueryParams({
|
||||
Map<String, dynamic>? queryParams,
|
||||
String? search,
|
||||
String? value,
|
||||
int? page,
|
||||
int? pageSize,
|
||||
DateTime? fromDate,
|
||||
DateTime? toDate,
|
||||
|
||||
}) {
|
||||
final params = <String, dynamic>{};
|
||||
|
||||
if (queryParams != null) {
|
||||
params.addAll(queryParams);
|
||||
}
|
||||
|
||||
if (fromDate != null) {
|
||||
params['date1'] = fromDate.formattedDashedGregorian;
|
||||
}
|
||||
|
||||
if (toDate != null) {
|
||||
params['date2'] = toDate.formattedDashedGregorian;
|
||||
}
|
||||
|
||||
if (search != null && search.isNotEmpty) {
|
||||
params['search'] = search;
|
||||
}
|
||||
|
||||
if (value != null && value.isNotEmpty) {
|
||||
params['value'] = value;
|
||||
}
|
||||
|
||||
if (page != null) {
|
||||
params['page'] = page;
|
||||
}
|
||||
|
||||
if (pageSize != null) {
|
||||
params['page_size'] = pageSize;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
8
packages/core/lib/utils/num_utils.dart
Normal file
8
packages/core/lib/utils/num_utils.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
extension XNumExtension on num? {
|
||||
String get toFormatted {
|
||||
final formatter = NumberFormat('#,###', 'fa_IR');
|
||||
return this == null ? '':formatter.format(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user