forked from eatvio/eatvio_app
feat(feed): add recipes screen
This commit is contained in:
@@ -21,33 +21,31 @@ LocationModel _$LocationModelFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$LocationModel {
|
||||
List<String> get locations => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: 'response_body')
|
||||
String get responseBody => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$LocationModelCopyWith<LocationModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
$LocationModelCopyWith<LocationModel> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LocationModelCopyWith<$Res> {
|
||||
factory $LocationModelCopyWith(
|
||||
LocationModel value, $Res Function(LocationModel) then) =
|
||||
_$LocationModelCopyWithImpl<$Res, LocationModel>;
|
||||
factory $LocationModelCopyWith(LocationModel value, $Res Function(LocationModel) then) = _$LocationModelCopyWithImpl<$Res, LocationModel>;
|
||||
|
||||
@useResult
|
||||
$Res call(
|
||||
{List<String> locations,
|
||||
@JsonKey(name: 'response_body') String responseBody});
|
||||
$Res call({List<String> locations, @JsonKey(name: 'response_body') String responseBody});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel>
|
||||
implements $LocationModelCopyWith<$Res> {
|
||||
class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel> implements $LocationModelCopyWith<$Res> {
|
||||
_$LocationModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -71,25 +69,17 @@ class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LocationModelImplCopyWith<$Res>
|
||||
implements $LocationModelCopyWith<$Res> {
|
||||
factory _$$LocationModelImplCopyWith(
|
||||
_$LocationModelImpl value, $Res Function(_$LocationModelImpl) then) =
|
||||
__$$LocationModelImplCopyWithImpl<$Res>;
|
||||
abstract class _$$LocationModelImplCopyWith<$Res> implements $LocationModelCopyWith<$Res> {
|
||||
factory _$$LocationModelImplCopyWith(_$LocationModelImpl value, $Res Function(_$LocationModelImpl) then) = __$$LocationModelImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{List<String> locations,
|
||||
@JsonKey(name: 'response_body') String responseBody});
|
||||
$Res call({List<String> locations, @JsonKey(name: 'response_body') String responseBody});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LocationModelImplCopyWithImpl<$Res>
|
||||
extends _$LocationModelCopyWithImpl<$Res, _$LocationModelImpl>
|
||||
implements _$$LocationModelImplCopyWith<$Res> {
|
||||
__$$LocationModelImplCopyWithImpl(
|
||||
_$LocationModelImpl _value, $Res Function(_$LocationModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
class __$$LocationModelImplCopyWithImpl<$Res> extends _$LocationModelCopyWithImpl<$Res, _$LocationModelImpl> implements _$$LocationModelImplCopyWith<$Res> {
|
||||
__$$LocationModelImplCopyWithImpl(_$LocationModelImpl _value, $Res Function(_$LocationModelImpl) _then) : super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
@@ -113,15 +103,12 @@ class __$$LocationModelImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LocationModelImpl implements _LocationModel {
|
||||
const _$LocationModelImpl(
|
||||
{required final List<String> locations,
|
||||
@JsonKey(name: 'response_body') required this.responseBody})
|
||||
: _locations = locations;
|
||||
const _$LocationModelImpl({required final List<String> locations, @JsonKey(name: 'response_body') required this.responseBody}) : _locations = locations;
|
||||
|
||||
factory _$LocationModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LocationModelImplFromJson(json);
|
||||
factory _$LocationModelImpl.fromJson(Map<String, dynamic> json) => _$$LocationModelImplFromJson(json);
|
||||
|
||||
final List<String> _locations;
|
||||
|
||||
@override
|
||||
List<String> get locations {
|
||||
if (_locations is EqualUnmodifiableListView) return _locations;
|
||||
@@ -143,22 +130,18 @@ class _$LocationModelImpl implements _LocationModel {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LocationModelImpl &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._locations, _locations) &&
|
||||
(identical(other.responseBody, responseBody) ||
|
||||
other.responseBody == responseBody));
|
||||
const DeepCollectionEquality().equals(other._locations, _locations) &&
|
||||
(identical(other.responseBody, responseBody) || other.responseBody == responseBody));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,
|
||||
const DeepCollectionEquality().hash(_locations), responseBody);
|
||||
int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_locations), responseBody);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith =>
|
||||
__$$LocationModelImplCopyWithImpl<_$LocationModelImpl>(this, _$identity);
|
||||
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith => __$$LocationModelImplCopyWithImpl<_$LocationModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -169,21 +152,19 @@ class _$LocationModelImpl implements _LocationModel {
|
||||
}
|
||||
|
||||
abstract class _LocationModel implements LocationModel {
|
||||
const factory _LocationModel(
|
||||
{required final List<String> locations,
|
||||
@JsonKey(name: 'response_body') required final String responseBody}) =
|
||||
const factory _LocationModel({required final List<String> locations, @JsonKey(name: 'response_body') required final String responseBody}) =
|
||||
_$LocationModelImpl;
|
||||
|
||||
factory _LocationModel.fromJson(Map<String, dynamic> json) =
|
||||
_$LocationModelImpl.fromJson;
|
||||
factory _LocationModel.fromJson(Map<String, dynamic> json) = _$LocationModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
List<String> get locations;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'response_body')
|
||||
String get responseBody;
|
||||
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -6,15 +6,12 @@ part of 'location_model.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$LocationModelImpl _$$LocationModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LocationModelImpl(
|
||||
locations:
|
||||
(json['locations'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
_$LocationModelImpl _$$LocationModelImplFromJson(Map<String, dynamic> json) => _$LocationModelImpl(
|
||||
locations: (json['locations'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
responseBody: json['response_body'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LocationModelImplToJson(_$LocationModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
Map<String, dynamic> _$$LocationModelImplToJson(_$LocationModelImpl instance) => <String, dynamic>{
|
||||
'locations': instance.locations,
|
||||
'response_body': instance.responseBody,
|
||||
};
|
||||
|
||||
@@ -19,15 +19,13 @@ mixin _$RegistrationState {
|
||||
UserRegistrationSheet get sheet => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$RegistrationStateCopyWith<RegistrationState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
$RegistrationStateCopyWith<RegistrationState> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RegistrationStateCopyWith<$Res> {
|
||||
factory $RegistrationStateCopyWith(
|
||||
RegistrationState value, $Res Function(RegistrationState) then) =
|
||||
_$RegistrationStateCopyWithImpl<$Res, RegistrationState>;
|
||||
factory $RegistrationStateCopyWith(RegistrationState value, $Res Function(RegistrationState) then) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>;
|
||||
|
||||
@useResult
|
||||
$Res call({UserRegistrationSheet sheet});
|
||||
|
||||
@@ -35,12 +33,12 @@ abstract class $RegistrationStateCopyWith<$Res> {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
|
||||
implements $RegistrationStateCopyWith<$Res> {
|
||||
class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> implements $RegistrationStateCopyWith<$Res> {
|
||||
_$RegistrationStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -67,11 +65,10 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegistrationStateImplCopyWith<$Res>
|
||||
implements $RegistrationStateCopyWith<$Res> {
|
||||
factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value,
|
||||
$Res Function(_$RegistrationStateImpl) then) =
|
||||
abstract class _$$RegistrationStateImplCopyWith<$Res> implements $RegistrationStateCopyWith<$Res> {
|
||||
factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, $Res Function(_$RegistrationStateImpl) then) =
|
||||
__$$RegistrationStateImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call({UserRegistrationSheet sheet});
|
||||
@@ -81,12 +78,9 @@ abstract class _$$RegistrationStateImplCopyWith<$Res>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegistrationStateImplCopyWithImpl<$Res>
|
||||
extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl>
|
||||
class __$$RegistrationStateImplCopyWithImpl<$Res> extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl>
|
||||
implements _$$RegistrationStateImplCopyWith<$Res> {
|
||||
__$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value,
|
||||
$Res Function(_$RegistrationStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
__$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, $Res Function(_$RegistrationStateImpl) _then) : super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
@@ -118,9 +112,7 @@ class _$RegistrationStateImpl implements _RegistrationState {
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegistrationStateImpl &&
|
||||
(identical(other.sheet, sheet) || other.sheet == sheet));
|
||||
(other.runtimeType == runtimeType && other is _$RegistrationStateImpl && (identical(other.sheet, sheet) || other.sheet == sheet));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -129,19 +121,16 @@ class _$RegistrationStateImpl implements _RegistrationState {
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
|
||||
__$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(
|
||||
this, _$identity);
|
||||
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _RegistrationState implements RegistrationState {
|
||||
const factory _RegistrationState(
|
||||
{required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl;
|
||||
const factory _RegistrationState({required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl;
|
||||
|
||||
@override
|
||||
UserRegistrationSheet get sheet;
|
||||
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
CustomTextFormField(
|
||||
controller: emailController,
|
||||
textInputType: TextInputType.emailAddress,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
hintText: 'Введите email',
|
||||
textInputAction: TextInputAction.next,
|
||||
onChanged: (newValue) {
|
||||
|
||||
@@ -19,30 +19,28 @@ class _RegistrationService implements RegistrationService {
|
||||
String? baseUrl;
|
||||
|
||||
@override
|
||||
Future<Map<String, String>> register(
|
||||
{required Map<String, dynamic> sheet}) async {
|
||||
Future<Map<String, String>> register({required Map<String, dynamic> sheet}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(sheet);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(
|
||||
_setStreamType<Map<String, String>>(Options(
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_setStreamType<Map<String, String>>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/register',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/register',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
final _value = _result.data!.cast<String, String>();
|
||||
return _value;
|
||||
}
|
||||
@@ -53,23 +51,22 @@ class _RegistrationService implements RegistrationService {
|
||||
final queryParameters = <String, dynamic>{r'user_address': query};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _result = await _dio
|
||||
.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_address',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_address',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
final _value = LocationModel.fromJson(_result.data!);
|
||||
return _value;
|
||||
}
|
||||
@@ -86,31 +83,28 @@ class _RegistrationService implements RegistrationService {
|
||||
};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _result = await _dio
|
||||
.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_coordinate',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_coordinate',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
final _value = LocationModel.fromJson(_result.data!);
|
||||
return _value;
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||
if (T != dynamic &&
|
||||
!(requestOptions.responseType == ResponseType.bytes ||
|
||||
requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T == String) {
|
||||
requestOptions.responseType = ResponseType.plain;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user