forked from eatvio/eatvio_app
plans filters ready
This commit is contained in:
@@ -116,7 +116,7 @@ class AppRouter {
|
||||
final data = state.extra as Map<String, dynamic>;
|
||||
return AboutPlanScreen(
|
||||
plan: data['plan'] as PlanModel,
|
||||
// index: data['index'] as int,
|
||||
index: data['index'] as int,
|
||||
navigateToComments: data['navigateToComments'] as bool,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -2,4 +2,5 @@ const String baseUrl = 'https://dev2.eatvio.com';
|
||||
|
||||
const List<int> durationValues = [7, 14, 21];
|
||||
|
||||
const List<String> typeValues = ['veg', 'light', 'carb', 'meat'];
|
||||
const List<String> dietTypeValues = ['veg', 'light', 'carb', 'meat'];
|
||||
const List<String> planTypeValues = ['fit', 'slim', 'wellness', 'behavior'];
|
||||
|
||||
@@ -79,7 +79,7 @@ Future<void> init() async {
|
||||
sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl(), dietsRepository: sl()));
|
||||
sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl()));
|
||||
sl.registerFactory<ChatSelectCubit>(() => ChatSelectCubit(chatRepository: sl()));
|
||||
sl.registerFactory<PlansCubit>(() => PlansCubit(feedRepository: sl()));
|
||||
sl.registerFactory<PlansCubit>(() => PlansCubit(feedRepository: sl(), planRepository: sl()));
|
||||
sl.registerFactory<SettingsCubit>(() => SettingsCubit(profileRepository: sl(), settingsRepository: sl()));
|
||||
sl.registerFactory<RegisterConsultantCubit>(() => RegisterConsultantCubit(consultantRepository: sl()));
|
||||
sl.registerFactory<DiaryCubit>(() => DiaryCubit(diaryRepository: sl(), glossaryRepository: sl()));
|
||||
|
||||
@@ -26,6 +26,8 @@ class Meta with _$Meta {
|
||||
@JsonKey(name: "per_page") required int perPage,
|
||||
@JsonKey(name: "to") required dynamic to,
|
||||
@JsonKey(name: "total") required int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice,
|
||||
}) = _Meta;
|
||||
|
||||
factory Meta.fromJson(Map<String, Object?> json) => _$MetaFromJson(json);
|
||||
|
||||
@@ -262,6 +262,10 @@ mixin _$Meta {
|
||||
dynamic get to => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total")
|
||||
int get total => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total_min_price")
|
||||
int? get totalMinPrice => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total_max_price")
|
||||
int? get totalMaxPrice => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this Meta to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -285,7 +289,9 @@ abstract class $MetaCopyWith<$Res> {
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total});
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -311,6 +317,8 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta>
|
||||
Object? perPage = null,
|
||||
Object? to = freezed,
|
||||
Object? total = null,
|
||||
Object? totalMinPrice = freezed,
|
||||
Object? totalMaxPrice = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
currentPage: null == currentPage
|
||||
@@ -345,6 +353,14 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta>
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice: freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice: freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +380,9 @@ abstract class _$$MetaImplCopyWith<$Res> implements $MetaCopyWith<$Res> {
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total});
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -387,6 +405,8 @@ class __$$MetaImplCopyWithImpl<$Res>
|
||||
Object? perPage = null,
|
||||
Object? to = freezed,
|
||||
Object? total = null,
|
||||
Object? totalMinPrice = freezed,
|
||||
Object? totalMaxPrice = freezed,
|
||||
}) {
|
||||
return _then(_$MetaImpl(
|
||||
currentPage: null == currentPage
|
||||
@@ -421,6 +441,14 @@ class __$$MetaImplCopyWithImpl<$Res>
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice: freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice: freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -436,7 +464,9 @@ class _$MetaImpl implements _Meta {
|
||||
@JsonKey(name: "path") this.path,
|
||||
@JsonKey(name: "per_page") required this.perPage,
|
||||
@JsonKey(name: "to") required this.to,
|
||||
@JsonKey(name: "total") required this.total})
|
||||
@JsonKey(name: "total") required this.total,
|
||||
@JsonKey(name: "total_min_price") this.totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") this.totalMaxPrice})
|
||||
: _links = links;
|
||||
|
||||
factory _$MetaImpl.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -472,10 +502,16 @@ class _$MetaImpl implements _Meta {
|
||||
@override
|
||||
@JsonKey(name: "total")
|
||||
final int total;
|
||||
@override
|
||||
@JsonKey(name: "total_min_price")
|
||||
final int? totalMinPrice;
|
||||
@override
|
||||
@JsonKey(name: "total_max_price")
|
||||
final int? totalMaxPrice;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Meta(currentPage: $currentPage, from: $from, lastPage: $lastPage, links: $links, path: $path, perPage: $perPage, to: $to, total: $total)';
|
||||
return 'Meta(currentPage: $currentPage, from: $from, lastPage: $lastPage, links: $links, path: $path, perPage: $perPage, to: $to, total: $total, totalMinPrice: $totalMinPrice, totalMaxPrice: $totalMaxPrice)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -492,7 +528,11 @@ class _$MetaImpl implements _Meta {
|
||||
(identical(other.path, path) || other.path == path) &&
|
||||
(identical(other.perPage, perPage) || other.perPage == perPage) &&
|
||||
const DeepCollectionEquality().equals(other.to, to) &&
|
||||
(identical(other.total, total) || other.total == total));
|
||||
(identical(other.total, total) || other.total == total) &&
|
||||
(identical(other.totalMinPrice, totalMinPrice) ||
|
||||
other.totalMinPrice == totalMinPrice) &&
|
||||
(identical(other.totalMaxPrice, totalMaxPrice) ||
|
||||
other.totalMaxPrice == totalMaxPrice));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -506,7 +546,9 @@ class _$MetaImpl implements _Meta {
|
||||
path,
|
||||
perPage,
|
||||
const DeepCollectionEquality().hash(to),
|
||||
total);
|
||||
total,
|
||||
totalMinPrice,
|
||||
totalMaxPrice);
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -533,7 +575,9 @@ abstract class _Meta implements Meta {
|
||||
@JsonKey(name: "path") final String? path,
|
||||
@JsonKey(name: "per_page") required final int perPage,
|
||||
@JsonKey(name: "to") required final dynamic to,
|
||||
@JsonKey(name: "total") required final int total}) = _$MetaImpl;
|
||||
@JsonKey(name: "total") required final int total,
|
||||
@JsonKey(name: "total_min_price") final int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") final int? totalMaxPrice}) = _$MetaImpl;
|
||||
|
||||
factory _Meta.fromJson(Map<String, dynamic> json) = _$MetaImpl.fromJson;
|
||||
|
||||
@@ -561,6 +605,12 @@ abstract class _Meta implements Meta {
|
||||
@override
|
||||
@JsonKey(name: "total")
|
||||
int get total;
|
||||
@override
|
||||
@JsonKey(name: "total_min_price")
|
||||
int? get totalMinPrice;
|
||||
@override
|
||||
@JsonKey(name: "total_max_price")
|
||||
int? get totalMaxPrice;
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -32,6 +32,8 @@ _$MetaImpl _$$MetaImplFromJson(Map<String, dynamic> json) => _$MetaImpl(
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
to: json['to'],
|
||||
total: (json['total'] as num).toInt(),
|
||||
totalMinPrice: (json['total_min_price'] as num?)?.toInt(),
|
||||
totalMaxPrice: (json['total_max_price'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
@@ -44,6 +46,8 @@ Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
'per_page': instance.perPage,
|
||||
'to': instance.to,
|
||||
'total': instance.total,
|
||||
'total_min_price': instance.totalMinPrice,
|
||||
'total_max_price': instance.totalMaxPrice,
|
||||
};
|
||||
|
||||
_$LinkImpl _$$LinkImplFromJson(Map<String, dynamic> json) => _$LinkImpl(
|
||||
|
||||
@@ -13,12 +13,24 @@ extension DateTimeExtension on DateTime {
|
||||
}
|
||||
return DateFormat(pattern, locale).format(this);
|
||||
}
|
||||
|
||||
bool isYesterday(DateTime date) {
|
||||
final DateTime localDate = date.isUtc ? date.toLocal() : date;
|
||||
final yesterday = DateTime.now().subtract(const Duration(days: 1));
|
||||
return yesterday.day == localDate.day && yesterday.month == localDate.month && yesterday.year == localDate.year;
|
||||
}
|
||||
|
||||
bool isToday(DateTime date) {
|
||||
final DateTime localDate = date.isUtc ? date.toLocal() : date;
|
||||
final now = DateTime.now();
|
||||
return now.day == localDate.day && now.month == localDate.month && now.year == localDate.year;
|
||||
}
|
||||
}
|
||||
|
||||
String calculateDifference(DateTime dateTime) {
|
||||
if (dateTime.difference(DateTime.now()).inDays == 0) {
|
||||
if (dateTime.isToday(dateTime)) {
|
||||
return 'Сегодня';
|
||||
} else if (dateTime.difference(DateTime.now()).inDays == -1) {
|
||||
} else if (dateTime.isYesterday(dateTime)) {
|
||||
return 'Вчера';
|
||||
} else {
|
||||
return dateTime.format('d MMMM', 'ru');
|
||||
|
||||
@@ -40,6 +40,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.counter = const SizedBox.shrink(),
|
||||
super.key,
|
||||
this.hasError = false,
|
||||
this.readOnly = false,
|
||||
});
|
||||
final Widget? counter;
|
||||
final Alignment? alignment;
|
||||
@@ -76,16 +77,18 @@ class CustomTextFormField extends StatelessWidget {
|
||||
final bool expands;
|
||||
final TextAlignVertical? textAlignVertical;
|
||||
final bool hasError;
|
||||
final bool readOnly;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: TextFormField(
|
||||
child: TextFormField(
|
||||
readOnly: readOnly,
|
||||
textAlignVertical: textAlignVertical,
|
||||
expands: expands,
|
||||
minLines: minLines,
|
||||
maxLength: maxLength,
|
||||
onChanged: onChanged,
|
||||
onChanged: onChanged,
|
||||
controller: controller,
|
||||
focusNode: focusNode ?? null,
|
||||
autofocus: autofocus,
|
||||
|
||||
Reference in New Issue
Block a user