feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -12,8 +12,7 @@ part of 'credentials_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
CredentialsModel _$CredentialsModelFromJson(Map<String, dynamic> json) {
return _CredentialsModel.fromJson(json);
@@ -37,9 +36,8 @@ mixin _$CredentialsModel {
/// @nodoc
abstract class $CredentialsModelCopyWith<$Res> {
factory $CredentialsModelCopyWith(
CredentialsModel value,
$Res Function(CredentialsModel) then,
) = _$CredentialsModelCopyWithImpl<$Res, CredentialsModel>;
CredentialsModel value, $Res Function(CredentialsModel) then) =
_$CredentialsModelCopyWithImpl<$Res, CredentialsModel>;
@useResult
$Res call({String email, String password});
}
@@ -58,32 +56,29 @@ class _$CredentialsModelCopyWithImpl<$Res, $Val extends CredentialsModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? email = null, Object? password = null}) {
return _then(
_value.copyWith(
email:
null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password:
null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
$Res call({
Object? email = null,
Object? password = null,
}) {
return _then(_value.copyWith(
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$CredentialsModelImplCopyWith<$Res>
implements $CredentialsModelCopyWith<$Res> {
factory _$$CredentialsModelImplCopyWith(
_$CredentialsModelImpl value,
$Res Function(_$CredentialsModelImpl) then,
) = __$$CredentialsModelImplCopyWithImpl<$Res>;
factory _$$CredentialsModelImplCopyWith(_$CredentialsModelImpl value,
$Res Function(_$CredentialsModelImpl) then) =
__$$CredentialsModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String email, String password});
@@ -93,30 +88,28 @@ abstract class _$$CredentialsModelImplCopyWith<$Res>
class __$$CredentialsModelImplCopyWithImpl<$Res>
extends _$CredentialsModelCopyWithImpl<$Res, _$CredentialsModelImpl>
implements _$$CredentialsModelImplCopyWith<$Res> {
__$$CredentialsModelImplCopyWithImpl(
_$CredentialsModelImpl _value,
$Res Function(_$CredentialsModelImpl) _then,
) : super(_value, _then);
__$$CredentialsModelImplCopyWithImpl(_$CredentialsModelImpl _value,
$Res Function(_$CredentialsModelImpl) _then)
: super(_value, _then);
/// Create a copy of CredentialsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? email = null, Object? password = null}) {
return _then(
_$CredentialsModelImpl(
email:
null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password:
null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? email = null,
Object? password = null,
}) {
return _then(_$CredentialsModelImpl(
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -159,21 +152,20 @@ class _$CredentialsModelImpl implements _CredentialsModel {
@pragma('vm:prefer-inline')
_$$CredentialsModelImplCopyWith<_$CredentialsModelImpl> get copyWith =>
__$$CredentialsModelImplCopyWithImpl<_$CredentialsModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$CredentialsModelImplToJson(this);
return _$$CredentialsModelImplToJson(
this,
);
}
}
abstract class _CredentialsModel implements CredentialsModel {
const factory _CredentialsModel({
required final String email,
required final String password,
}) = _$CredentialsModelImpl;
const factory _CredentialsModel(
{required final String email,
required final String password}) = _$CredentialsModelImpl;
factory _CredentialsModel.fromJson(Map<String, dynamic> json) =
_$CredentialsModelImpl.fromJson;

View File

@@ -7,12 +7,15 @@ part of 'credentials_model.dart';
// **************************************************************************
_$CredentialsModelImpl _$$CredentialsModelImplFromJson(
Map<String, dynamic> json,
) => _$CredentialsModelImpl(
email: json['email'] as String,
password: json['password'] as String,
);
Map<String, dynamic> json) =>
_$CredentialsModelImpl(
email: json['email'] as String,
password: json['password'] as String,
);
Map<String, dynamic> _$$CredentialsModelImplToJson(
_$CredentialsModelImpl instance,
) => <String, dynamic>{'email': instance.email, 'password': instance.password};
_$CredentialsModelImpl instance) =>
<String, dynamic>{
'email': instance.email,
'password': instance.password,
};

View File

@@ -12,8 +12,7 @@ part of 'token_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
TokenModel _$TokenModelFromJson(Map<String, dynamic> json) {
return _TokenModel.fromJson(json);
@@ -36,9 +35,8 @@ mixin _$TokenModel {
/// @nodoc
abstract class $TokenModelCopyWith<$Res> {
factory $TokenModelCopyWith(
TokenModel value,
$Res Function(TokenModel) then,
) = _$TokenModelCopyWithImpl<$Res, TokenModel>;
TokenModel value, $Res Function(TokenModel) then) =
_$TokenModelCopyWithImpl<$Res, TokenModel>;
@useResult
$Res call({String token});
}
@@ -57,17 +55,15 @@ class _$TokenModelCopyWithImpl<$Res, $Val extends TokenModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? token = null}) {
return _then(
_value.copyWith(
token:
null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
$Res call({
Object? token = null,
}) {
return _then(_value.copyWith(
token: null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
@@ -75,9 +71,8 @@ class _$TokenModelCopyWithImpl<$Res, $Val extends TokenModel>
abstract class _$$TokenModelImplCopyWith<$Res>
implements $TokenModelCopyWith<$Res> {
factory _$$TokenModelImplCopyWith(
_$TokenModelImpl value,
$Res Function(_$TokenModelImpl) then,
) = __$$TokenModelImplCopyWithImpl<$Res>;
_$TokenModelImpl value, $Res Function(_$TokenModelImpl) then) =
__$$TokenModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String token});
@@ -88,24 +83,22 @@ class __$$TokenModelImplCopyWithImpl<$Res>
extends _$TokenModelCopyWithImpl<$Res, _$TokenModelImpl>
implements _$$TokenModelImplCopyWith<$Res> {
__$$TokenModelImplCopyWithImpl(
_$TokenModelImpl _value,
$Res Function(_$TokenModelImpl) _then,
) : super(_value, _then);
_$TokenModelImpl _value, $Res Function(_$TokenModelImpl) _then)
: super(_value, _then);
/// Create a copy of TokenModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? token = null}) {
return _then(
_$TokenModelImpl(
token:
null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? token = null,
}) {
return _then(_$TokenModelImpl(
token: null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -147,7 +140,9 @@ class _$TokenModelImpl implements _TokenModel {
@override
Map<String, dynamic> toJson() {
return _$$TokenModelImplToJson(this);
return _$$TokenModelImplToJson(
this,
);
}
}

View File

@@ -7,7 +7,11 @@ part of 'token_model.dart';
// **************************************************************************
_$TokenModelImpl _$$TokenModelImplFromJson(Map<String, dynamic> json) =>
_$TokenModelImpl(token: json['token'] as String);
_$TokenModelImpl(
token: json['token'] as String,
);
Map<String, dynamic> _$$TokenModelImplToJson(_$TokenModelImpl instance) =>
<String, dynamic>{'token': instance.token};
<String, dynamic>{
'token': instance.token,
};

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/toasts.dart';
@@ -11,10 +13,10 @@ class AuthCubit extends Cubit<AuthState> {
AuthCubit({
required this.authRepository,
}) : super(AuthState());
}) : super(const AuthState());
Future<bool> getTokenByCredentials(String email, String password) async {
emit(AuthState.loading());
emit(const AuthState.loading());
try {
final token = (await authRepository.getTokenByCredentials(
email,
@@ -31,7 +33,7 @@ class AuthCubit extends Cubit<AuthState> {
AppRouter.navigatorKey.currentContext?.go('/my-profile-screen');
return true;
} catch (e) {
print(e);
log(e.toString());
showErrorToast('Неверный адрес электронной почты или пароль');
emit(AuthState.error(errorMessage: '$e'));
return false;

View File

@@ -12,8 +12,7 @@ part of 'auth_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$AuthState {
@@ -23,14 +22,16 @@ mixin _$AuthState {
required TResult Function() loading,
required TResult Function(String token) loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(String token)? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$AuthState {
TResult Function(String token)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_AuthState value) $default, {
required TResult Function(AuthStateLoading value) loading,
required TResult Function(AuthStateLoaded value) loaded,
required TResult Function(AuthStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_AuthState value)? $default, {
TResult? Function(AuthStateLoading value)? loading,
TResult? Function(AuthStateLoaded value)? loaded,
TResult? Function(AuthStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_AuthState value)? $default, {
@@ -60,7 +64,8 @@ mixin _$AuthState {
TResult Function(AuthStateLoaded value)? loaded,
TResult Function(AuthStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
@@ -86,9 +91,8 @@ class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState>
/// @nodoc
abstract class _$$AuthStateImplCopyWith<$Res> {
factory _$$AuthStateImplCopyWith(
_$AuthStateImpl value,
$Res Function(_$AuthStateImpl) then,
) = __$$AuthStateImplCopyWithImpl<$Res>;
_$AuthStateImpl value, $Res Function(_$AuthStateImpl) then) =
__$$AuthStateImplCopyWithImpl<$Res>;
}
/// @nodoc
@@ -96,9 +100,8 @@ class __$$AuthStateImplCopyWithImpl<$Res>
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateImpl>
implements _$$AuthStateImplCopyWith<$Res> {
__$$AuthStateImplCopyWithImpl(
_$AuthStateImpl _value,
$Res Function(_$AuthStateImpl) _then,
) : super(_value, _then);
_$AuthStateImpl _value, $Res Function(_$AuthStateImpl) _then)
: super(_value, _then);
/// Create a copy of AuthState
/// with the given fields replaced by the non-null parameter values.
@@ -204,20 +207,18 @@ abstract class _AuthState implements AuthState {
/// @nodoc
abstract class _$$AuthStateLoadingImplCopyWith<$Res> {
factory _$$AuthStateLoadingImplCopyWith(
_$AuthStateLoadingImpl value,
$Res Function(_$AuthStateLoadingImpl) then,
) = __$$AuthStateLoadingImplCopyWithImpl<$Res>;
factory _$$AuthStateLoadingImplCopyWith(_$AuthStateLoadingImpl value,
$Res Function(_$AuthStateLoadingImpl) then) =
__$$AuthStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$AuthStateLoadingImplCopyWithImpl<$Res>
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateLoadingImpl>
implements _$$AuthStateLoadingImplCopyWith<$Res> {
__$$AuthStateLoadingImplCopyWithImpl(
_$AuthStateLoadingImpl _value,
$Res Function(_$AuthStateLoadingImpl) _then,
) : super(_value, _then);
__$$AuthStateLoadingImplCopyWithImpl(_$AuthStateLoadingImpl _value,
$Res Function(_$AuthStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of AuthState
/// with the given fields replaced by the non-null parameter values.
@@ -323,10 +324,9 @@ abstract class AuthStateLoading implements AuthState {
/// @nodoc
abstract class _$$AuthStateLoadedImplCopyWith<$Res> {
factory _$$AuthStateLoadedImplCopyWith(
_$AuthStateLoadedImpl value,
$Res Function(_$AuthStateLoadedImpl) then,
) = __$$AuthStateLoadedImplCopyWithImpl<$Res>;
factory _$$AuthStateLoadedImplCopyWith(_$AuthStateLoadedImpl value,
$Res Function(_$AuthStateLoadedImpl) then) =
__$$AuthStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({String token});
}
@@ -336,24 +336,22 @@ class __$$AuthStateLoadedImplCopyWithImpl<$Res>
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateLoadedImpl>
implements _$$AuthStateLoadedImplCopyWith<$Res> {
__$$AuthStateLoadedImplCopyWithImpl(
_$AuthStateLoadedImpl _value,
$Res Function(_$AuthStateLoadedImpl) _then,
) : super(_value, _then);
_$AuthStateLoadedImpl _value, $Res Function(_$AuthStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of AuthState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? token = null}) {
return _then(
_$AuthStateLoadedImpl(
token:
null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? token = null,
}) {
return _then(_$AuthStateLoadedImpl(
token: null == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -388,9 +386,7 @@ class _$AuthStateLoadedImpl implements AuthStateLoaded {
@pragma('vm:prefer-inline')
_$$AuthStateLoadedImplCopyWith<_$AuthStateLoadedImpl> get copyWith =>
__$$AuthStateLoadedImplCopyWithImpl<_$AuthStateLoadedImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -482,10 +478,9 @@ abstract class AuthStateLoaded implements AuthState {
/// @nodoc
abstract class _$$AuthStateErrorImplCopyWith<$Res> {
factory _$$AuthStateErrorImplCopyWith(
_$AuthStateErrorImpl value,
$Res Function(_$AuthStateErrorImpl) then,
) = __$$AuthStateErrorImplCopyWithImpl<$Res>;
factory _$$AuthStateErrorImplCopyWith(_$AuthStateErrorImpl value,
$Res Function(_$AuthStateErrorImpl) then) =
__$$AuthStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
@@ -495,24 +490,22 @@ class __$$AuthStateErrorImplCopyWithImpl<$Res>
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateErrorImpl>
implements _$$AuthStateErrorImplCopyWith<$Res> {
__$$AuthStateErrorImplCopyWithImpl(
_$AuthStateErrorImpl _value,
$Res Function(_$AuthStateErrorImpl) _then,
) : super(_value, _then);
_$AuthStateErrorImpl _value, $Res Function(_$AuthStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of AuthState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$AuthStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$AuthStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -548,9 +541,7 @@ class _$AuthStateErrorImpl implements AuthStateError {
@pragma('vm:prefer-inline')
_$$AuthStateErrorImplCopyWith<_$AuthStateErrorImpl> get copyWith =>
__$$AuthStateErrorImplCopyWithImpl<_$AuthStateErrorImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
@@ -22,7 +23,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../bloc/auth_state.dart';
class AuthScreen extends StatefulWidget {
const AuthScreen();
const AuthScreen({super.key});
@override
State<AuthScreen> createState() => _AuthScreenState();
@@ -36,7 +37,7 @@ class _AuthScreenState extends State<AuthScreen> {
final authCubit = sl<AuthCubit>();
late StreamSubscription<bool> keyboardSubscription;
bool isFocused = false;
int tapsCount = 0;
@override
void initState() {
super.initState();
@@ -60,15 +61,27 @@ class _AuthScreenState extends State<AuthScreen> {
appBar: AppBar(
centerTitle: true,
toolbarHeight: isFocused ? 64 : MediaQuery.of(context).size.width - 64,
title: SvgPicture.asset(
ImageConstant.imgLogoEatvio,
height: isFocused ? 64 : MediaQuery.of(context).size.width - 64,
fit: BoxFit.contain,
title: GestureDetector(
onTap: () {
tapsCount++;
if (tapsCount == 6) {
tapsCount = 0;
// showModalBottomSheet(context: context, builder: (context) => );
}
EasyDebounce.debounce('change env', Durations.medium4, () {
tapsCount = 0;
});
},
child: SvgPicture.asset(
ImageConstant.imgLogoEatvio,
height: isFocused ? 64 : MediaQuery.of(context).size.width - 64,
fit: BoxFit.contain,
),
),
),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -104,7 +117,7 @@ class _AuthScreenState extends State<AuthScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Нет аккаунта? '),
const Text('Нет аккаунта? '),
GestureDetector(
onTap: () => GoRouter.of(context).goNamed('webViewRegistrationScreen'),
child: Text(
@@ -118,18 +131,18 @@ class _AuthScreenState extends State<AuthScreen> {
),
],
),
Spacer(),
const Spacer(),
Center(
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'Нажимая "Войти", Вы соглашаетесь \n',
style: TextStyle(
style: const TextStyle(
fontSize: 12,
color: Colors.black,
),
children: [
TextSpan(text: 'c '),
const TextSpan(text: 'c '),
TextSpan(
text: ' Публичной офертой',
style: TextStyle(
@@ -138,14 +151,14 @@ class _AuthScreenState extends State<AuthScreen> {
decorationColor: appTheme.blueA400,
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')),
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')),
),
],
),
),
),
const SizedBox(height: 16),
Container(
SizedBox(
height: 48,
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
@@ -165,12 +178,14 @@ class _AuthScreenState extends State<AuthScreen> {
passwordController.text,
);
if (isAuthenticated) {
context.read<ProfileAvatarCubit>().getMyProfile();
context.read<ChatsCubit>().getChatRoomsWithLoading();
if (context.mounted) {
context.read<ProfileAvatarCubit>().getMyProfile();
context.read<ChatsCubit>().getChatRoomsWithLoading();
}
}
},
label: state is AuthStateLoading
? CupertinoActivityIndicator()
? const CupertinoActivityIndicator()
: Text(
'Войти',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),

View File

@@ -24,7 +24,7 @@ import 'package:share_plus/share_plus.dart';
class BlogPostScreen extends StatefulWidget {
final FeedBlogPostModel blogPost;
BlogPostScreen({super.key, required this.blogPost});
const BlogPostScreen({super.key, required this.blogPost});
@override
State<BlogPostScreen> createState() => _BlogPostScreenState();
@@ -60,7 +60,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
return Scaffold(
resizeToAvoidBottomInset: true,
bottomSheet: Container(
padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -79,14 +79,14 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle),
height: 32,
width: 32,
child: Icon(Icons.close_rounded, size: 18, color: Colors.white),
child: const Icon(Icons.close_rounded, size: 18, color: Colors.white),
),
),
if (replyId != null) SizedBox(width: 8),
if (replyId != null) const SizedBox(width: 8),
SizedBox(
width: MediaQuery.of(context).size.width - (replyId == null ? 64 : 104),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 52),
constraints: const BoxConstraints(minHeight: 52),
child: TextFormField(
textCapitalization: TextCapitalization.sentences,
onChanged: (_) {
@@ -96,7 +96,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
maxLines: 5,
minLines: 1,
keyboardType: TextInputType.multiline,
style: TextStyle(
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.black,
@@ -104,9 +104,9 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
),
decoration: InputDecoration(
isDense: false, // убираем true, чтобы padding учитывался корректно
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен
hintText: 'Комментарий',
hintStyle: TextStyle(
hintStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
height: 1.2,
@@ -115,21 +115,21 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1),
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1),
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1),
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
),
),
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
GestureDetector(
onTap: () {
if (textEditingController.text.length > 2) {
@@ -151,7 +151,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
decoration: BoxDecoration(color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, shape: BoxShape.circle),
height: 32,
width: 32,
child: Icon(Icons.send_rounded, size: 18, color: Colors.white),
child: const Icon(Icons.send_rounded, size: 18, color: Colors.white),
),
),
],
@@ -164,6 +164,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
onSelected: (value) async {
if (value == 'delete') {
final result = await sl<BlogPostCreateCubit>().deleteBlogPost(widget.blogPost.id);
if (!context.mounted) return;
if (!result) {
showErrorDialog(context, title: S.current.could_not_delete_blog_post);
return;
@@ -175,29 +176,28 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
GoRouter.of(context).replaceNamed('blogPostCreateScreen', extra: widget.blogPost);
}
},
itemBuilder:
(context) => [
if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'edit', child: Text('Редактировать')),
if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'delete', child: Text('Удалить')),
if (!widget.blogPost.author.authorIsMe)
PopupMenuItem(
value: 'report',
child: Text('Пожаловаться'),
onTap: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.posts, id: widget.blogPost.id),
);
},
),
],
itemBuilder: (context) => [
if (widget.blogPost.author.authorIsMe) const PopupMenuItem(value: 'edit', child: Text('Редактировать')),
if (widget.blogPost.author.authorIsMe) const PopupMenuItem(value: 'delete', child: Text('Удалить')),
if (!widget.blogPost.author.authorIsMe)
PopupMenuItem(
value: 'report',
child: const Text('Пожаловаться'),
onTap: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.posts, id: widget.blogPost.id),
);
},
),
],
),
],
),
body: SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
physics: BouncingScrollPhysics(),
padding: const EdgeInsets.only(bottom: 80),
physics: const BouncingScrollPhysics(),
child: Column(
children: [
GestureDetector(
@@ -209,15 +209,15 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
CircleAvatar(radius: 16, backgroundImage: NetworkImage(widget.blogPost.author.authorProfileIcon)),
SizedBox(width: 8),
const SizedBox(width: 8),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.blogPost.author.authorName,
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400, height: 1),
style: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400, height: 1),
),
SizedBox(height: 2),
const SizedBox(height: 2),
Text(
widget.blogPost.createdAt.format('dd MMMM', 'ru'),
style: TextStyle(color: Colors.grey.shade600, fontSize: 12, fontWeight: FontWeight.w400, height: 1),
@@ -233,8 +233,8 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Html(data: widget.blogPost.description, style: {"*": Style(color: Colors.black87)}),
),
SizedBox(height: 8),
CachedNetworkImage(imageUrl: baseUrl + '/storage/' + (widget.blogPost.image)),
const SizedBox(height: 8),
CachedNetworkImage(imageUrl: '$baseUrl/storage/${widget.blogPost.image}'),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
@@ -256,20 +256,20 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
sl<FeedCubit>().updateFeedBlogPostList(widget.blogPost, isLiked);
},
),
SizedBox(width: 8),
const SizedBox(width: 8),
_iconButton(
icon: Icons.reply_rounded,
onTap: () {
final box = context.findRenderObject() as RenderBox?;
Share.shareUri(
Uri.parse(baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString()),
Uri.parse('$baseUrl/ru/blog_post/${widget.blogPost.id}'),
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
},
),
Spacer(),
const Spacer(),
Icon(Icons.visibility_rounded, size: 16, color: appTheme.gray500),
SizedBox(width: 4),
const SizedBox(width: 4),
Text(widget.blogPost.totalViews.toString(), style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400)),
],
),
@@ -279,16 +279,16 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
height: 0.4,
decoration: BoxDecoration(color: Colors.black.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(16)),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Container(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
alignment: Alignment.centerLeft,
child: Text(
widget.blogPost.totalComments.toString() + ' КОММЕНТАРИЕВ',
'${widget.blogPost.totalComments} КОММЕНТАРИЕВ',
style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400),
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
if (state is CommentsStateLoading) const Loader(),
if (state is CommentsStateLoaded)
CommentsWidget(id: widget.blogPost.id.toString(), commentSourceType: CommentSourceType.blogPost, comment: state.comment, replyId: replyId),
@@ -306,14 +306,14 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
onTap: onTap ?? () {},
borderRadius: BorderRadius.circular(16),
child: Ink(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(color: backgroundColor ?? appTheme.gray100, borderRadius: BorderRadius.circular(16)),
height: 32,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 20, color: iconColor ?? appTheme.gray600),
if (text != null) SizedBox(width: 8),
if (text != null) const SizedBox(width: 8),
if (text != null) Text(text, style: TextStyle(color: textColor ?? appTheme.gray600, fontWeight: FontWeight.w500)),
],
),

View File

@@ -10,7 +10,7 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
BlogPostCreateCubit({
required this.blogPostRepository,
}) : super(BlogPostCreateState());
}) : super(const BlogPostCreateState());
Future<bool> createBlogPost({
String? title,
@@ -19,7 +19,7 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
XFile? image,
}) async {
try {
emit(BlogPostCreateState.loading());
emit(const BlogPostCreateState.loading());
await blogPostRepository.createBlogPost(
title,
videoUrl,
@@ -29,7 +29,7 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
return true;
} catch (e, st) {
log(e.toString(), stackTrace: st);
emit(BlogPostCreateState.loaded());
emit(const BlogPostCreateState.loaded());
return false;
}
}
@@ -43,7 +43,7 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
String? oldImageUrl,
}) async {
try {
emit(BlogPostCreateState.loading());
emit(const BlogPostCreateState.loading());
await blogPostRepository.updateBlogPost(
id,
title,
@@ -52,11 +52,11 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
image,
oldImageUrl,
);
emit(BlogPostCreateState.loaded());
emit(const BlogPostCreateState.loaded());
return true;
} catch (e, st) {
log(e.toString(), stackTrace: st);
emit(BlogPostCreateState.loaded());
emit(const BlogPostCreateState.loaded());
return false;
}
}

View File

@@ -12,8 +12,7 @@ part of 'blog_post_create_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$BlogPostCreateState {
@@ -23,14 +22,16 @@ mixin _$BlogPostCreateState {
required TResult Function() loading,
required TResult Function() loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function()? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$BlogPostCreateState {
TResult Function()? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_BlogPostCreateState value) $default, {
required TResult Function(BlogPostCreateStateLoading value) loading,
required TResult Function(BlogPostCreateStateLoaded value) loaded,
required TResult Function(BlogPostCreateStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_BlogPostCreateState value)? $default, {
TResult? Function(BlogPostCreateStateLoading value)? loading,
TResult? Function(BlogPostCreateStateLoaded value)? loaded,
TResult? Function(BlogPostCreateStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_BlogPostCreateState value)? $default, {
@@ -60,15 +64,15 @@ mixin _$BlogPostCreateState {
TResult Function(BlogPostCreateStateLoaded value)? loaded,
TResult Function(BlogPostCreateStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BlogPostCreateStateCopyWith<$Res> {
factory $BlogPostCreateStateCopyWith(
BlogPostCreateState value,
$Res Function(BlogPostCreateState) then,
) = _$BlogPostCreateStateCopyWithImpl<$Res, BlogPostCreateState>;
BlogPostCreateState value, $Res Function(BlogPostCreateState) then) =
_$BlogPostCreateStateCopyWithImpl<$Res, BlogPostCreateState>;
}
/// @nodoc
@@ -87,20 +91,18 @@ class _$BlogPostCreateStateCopyWithImpl<$Res, $Val extends BlogPostCreateState>
/// @nodoc
abstract class _$$BlogPostCreateStateImplCopyWith<$Res> {
factory _$$BlogPostCreateStateImplCopyWith(
_$BlogPostCreateStateImpl value,
$Res Function(_$BlogPostCreateStateImpl) then,
) = __$$BlogPostCreateStateImplCopyWithImpl<$Res>;
factory _$$BlogPostCreateStateImplCopyWith(_$BlogPostCreateStateImpl value,
$Res Function(_$BlogPostCreateStateImpl) then) =
__$$BlogPostCreateStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$BlogPostCreateStateImplCopyWithImpl<$Res>
extends _$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateImpl>
implements _$$BlogPostCreateStateImplCopyWith<$Res> {
__$$BlogPostCreateStateImplCopyWithImpl(
_$BlogPostCreateStateImpl _value,
$Res Function(_$BlogPostCreateStateImpl) _then,
) : super(_value, _then);
__$$BlogPostCreateStateImplCopyWithImpl(_$BlogPostCreateStateImpl _value,
$Res Function(_$BlogPostCreateStateImpl) _then)
: super(_value, _then);
/// Create a copy of BlogPostCreateState
/// with the given fields replaced by the non-null parameter values.
@@ -208,23 +210,20 @@ abstract class _BlogPostCreateState implements BlogPostCreateState {
/// @nodoc
abstract class _$$BlogPostCreateStateLoadingImplCopyWith<$Res> {
factory _$$BlogPostCreateStateLoadingImplCopyWith(
_$BlogPostCreateStateLoadingImpl value,
$Res Function(_$BlogPostCreateStateLoadingImpl) then,
) = __$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res>;
_$BlogPostCreateStateLoadingImpl value,
$Res Function(_$BlogPostCreateStateLoadingImpl) then) =
__$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res>
extends
_$BlogPostCreateStateCopyWithImpl<
$Res,
_$BlogPostCreateStateLoadingImpl
>
extends _$BlogPostCreateStateCopyWithImpl<$Res,
_$BlogPostCreateStateLoadingImpl>
implements _$$BlogPostCreateStateLoadingImplCopyWith<$Res> {
__$$BlogPostCreateStateLoadingImplCopyWithImpl(
_$BlogPostCreateStateLoadingImpl _value,
$Res Function(_$BlogPostCreateStateLoadingImpl) _then,
) : super(_value, _then);
_$BlogPostCreateStateLoadingImpl _value,
$Res Function(_$BlogPostCreateStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of BlogPostCreateState
/// with the given fields replaced by the non-null parameter values.
@@ -332,20 +331,20 @@ abstract class BlogPostCreateStateLoading implements BlogPostCreateState {
/// @nodoc
abstract class _$$BlogPostCreateStateLoadedImplCopyWith<$Res> {
factory _$$BlogPostCreateStateLoadedImplCopyWith(
_$BlogPostCreateStateLoadedImpl value,
$Res Function(_$BlogPostCreateStateLoadedImpl) then,
) = __$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res>;
_$BlogPostCreateStateLoadedImpl value,
$Res Function(_$BlogPostCreateStateLoadedImpl) then) =
__$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res>
extends
_$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateLoadedImpl>
extends _$BlogPostCreateStateCopyWithImpl<$Res,
_$BlogPostCreateStateLoadedImpl>
implements _$$BlogPostCreateStateLoadedImplCopyWith<$Res> {
__$$BlogPostCreateStateLoadedImplCopyWithImpl(
_$BlogPostCreateStateLoadedImpl _value,
$Res Function(_$BlogPostCreateStateLoadedImpl) _then,
) : super(_value, _then);
_$BlogPostCreateStateLoadedImpl _value,
$Res Function(_$BlogPostCreateStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of BlogPostCreateState
/// with the given fields replaced by the non-null parameter values.
@@ -453,37 +452,36 @@ abstract class BlogPostCreateStateLoaded implements BlogPostCreateState {
/// @nodoc
abstract class _$$BlogPostCreateStateErrorImplCopyWith<$Res> {
factory _$$BlogPostCreateStateErrorImplCopyWith(
_$BlogPostCreateStateErrorImpl value,
$Res Function(_$BlogPostCreateStateErrorImpl) then,
) = __$$BlogPostCreateStateErrorImplCopyWithImpl<$Res>;
_$BlogPostCreateStateErrorImpl value,
$Res Function(_$BlogPostCreateStateErrorImpl) then) =
__$$BlogPostCreateStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$BlogPostCreateStateErrorImplCopyWithImpl<$Res>
extends
_$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateErrorImpl>
extends _$BlogPostCreateStateCopyWithImpl<$Res,
_$BlogPostCreateStateErrorImpl>
implements _$$BlogPostCreateStateErrorImplCopyWith<$Res> {
__$$BlogPostCreateStateErrorImplCopyWithImpl(
_$BlogPostCreateStateErrorImpl _value,
$Res Function(_$BlogPostCreateStateErrorImpl) _then,
) : super(_value, _then);
_$BlogPostCreateStateErrorImpl _value,
$Res Function(_$BlogPostCreateStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of BlogPostCreateState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$BlogPostCreateStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$BlogPostCreateStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -518,9 +516,8 @@ class _$BlogPostCreateStateErrorImpl implements BlogPostCreateStateError {
@override
@pragma('vm:prefer-inline')
_$$BlogPostCreateStateErrorImplCopyWith<_$BlogPostCreateStateErrorImpl>
get copyWith => __$$BlogPostCreateStateErrorImplCopyWithImpl<
_$BlogPostCreateStateErrorImpl
>(this, _$identity);
get copyWith => __$$BlogPostCreateStateErrorImplCopyWithImpl<
_$BlogPostCreateStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -607,5 +604,5 @@ abstract class BlogPostCreateStateError implements BlogPostCreateState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$BlogPostCreateStateErrorImplCopyWith<_$BlogPostCreateStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -22,8 +22,9 @@ class BlogPostCreateScreen extends StatefulWidget {
final FeedBlogPostModel? feedBlogPostModel;
const BlogPostCreateScreen({
super.key,
this.feedBlogPostModel,
}) : super();
});
@override
State<BlogPostCreateScreen> createState() => _BlogPostCreateScreenState();
@@ -61,6 +62,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
super.dispose();
}
@override
Widget build(BuildContext context) {
return BlocProvider<BlogPostCreateCubit>(
create: (BuildContext context) => blogPostCubit,
@@ -70,7 +72,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
context.read<FeedCubit>().loadFeedBlogPostList();
}
},
child: _buildBlogPostCreate(),
child: _buildBlogPostCreate(context),
),
);
}
@@ -85,10 +87,11 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
final picker = ImagePicker();
image = await picker.pickImage(source: ImageSource.camera);
setState(() {});
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
Text('Фото'),
@@ -100,10 +103,11 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
final picker = ImagePicker();
image = await picker.pickImage(source: ImageSource.gallery);
setState(() {});
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo),
SizedBox(width: 8),
Text('Галерея'),
@@ -120,7 +124,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
);
}
_buildBlogPostCreate() {
_buildBlogPostCreate(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(),
@@ -137,8 +141,8 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
backgroundColor: appTheme.blueA400,
label: isLoading
? CircularProgressIndicator()
: Text(
? const CircularProgressIndicator()
: const Text(
'Создать',
style: TextStyle(
color: Colors.white,
@@ -164,8 +168,10 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
isLoading = false;
});
if (!result) {
if (!context.mounted) return;
showErrorDialog(context, title: S.current.could_not_update_blog_post);
} else {
if (!context.mounted) return;
context.pop();
}
} else {
@@ -179,8 +185,10 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
isLoading = false;
});
if (!result) {
if (!context.mounted) return;
showErrorDialog(context, title: S.current.could_not_publish_blog_post);
} else {
if (!context.mounted) return;
context.pop();
}
}
@@ -188,36 +196,36 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16),
Text('Заголовок'),
SizedBox(height: 8),
const SizedBox(height: 16),
const Text('Заголовок'),
const SizedBox(height: 8),
CustomTextFormField(
controller: titleController,
),
SizedBox(height: 16),
Text('Описание'),
SizedBox(height: 8),
const SizedBox(height: 16),
const Text('Описание'),
const SizedBox(height: 8),
CustomTextFormField(
controller: descriptionController,
maxLines: 6,
minLines: 4,
),
SizedBox(height: 16),
if (videoUrlController.text.isEmpty) Text('Изображение поста'),
if (videoUrlController.text.isEmpty) SizedBox(height: 8),
const SizedBox(height: 16),
if (videoUrlController.text.isEmpty) const Text('Изображение поста'),
if (videoUrlController.text.isEmpty) const SizedBox(height: 8),
if (videoUrlController.text.isEmpty) _buildAddPhoto(),
SizedBox(height: 16),
if (image == null && widget.feedBlogPostModel?.image == null) Text('Ссылка на видео'),
if (image == null && widget.feedBlogPostModel?.image == null) SizedBox(height: 8),
const SizedBox(height: 16),
if (image == null && widget.feedBlogPostModel?.image == null) const Text('Ссылка на видео'),
if (image == null && widget.feedBlogPostModel?.image == null) const SizedBox(height: 8),
if (image == null && widget.feedBlogPostModel?.image == null)
CustomTextFormField(
controller: videoUrlController,
),
SizedBox(height: 80),
const SizedBox(height: 80),
],
),
),
@@ -235,7 +243,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
AnimatedContainer(
height: shrinkImage ? 52 : 128,
curve: Curves.easeIn,
duration: Duration(milliseconds: 150),
duration: const Duration(milliseconds: 150),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadius.circular(16),
),
@@ -247,7 +255,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
Icons.photo_library,
color: appTheme.blueGray300,
),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
"Добавить фото",
selectionColor: appTheme.blueA400,
@@ -256,7 +264,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
if (image != null)
Container(
SizedBox(
width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
@@ -270,12 +278,12 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
if (widget.feedBlogPostModel?.image != null && image == null)
Container(
SizedBox(
width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image(
image: NetworkImage(baseUrl + '/storage/' + widget.feedBlogPostModel!.image),
image: NetworkImage('$baseUrl/storage/${widget.feedBlogPostModel!.image}'),
),
),
),

View File

@@ -1,3 +1,4 @@
import 'dart:developer';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:eatvio_app/core/const.dart';
@@ -35,7 +36,7 @@ class BlogPostRepository {
Future<XFile?> downloadImage(String imageUrl) async {
try {
// Загрузка изображения
final response = await http.get(Uri.parse(baseUrl + '/storage/' + imageUrl));
final response = await http.get(Uri.parse('$baseUrl/storage/$imageUrl'));
if (response.statusCode == 200) {
// Получение временной директории
@@ -49,11 +50,11 @@ class BlogPostRepository {
// Возвращаем объект XFile
return XFile(file.path);
} else {
print('Ошибка загрузки изображения: ${response.statusCode}');
log('Ошибка загрузки изображения: ${response.statusCode}');
return null;
}
} catch (e) {
print('Произошла ошибка: $e');
log('Произошла ошибка: $e');
return null;
}
}

View File

@@ -25,11 +25,11 @@ class _BlogPostService implements BlogPostService {
final _data = formData;
final _options = _setStreamType<void>(
Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'/api/blogPosts/create/published',
@@ -52,11 +52,11 @@ class _BlogPostService implements BlogPostService {
final _data = formData;
final _options = _setStreamType<void>(
Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'/api/blogPosts/update/published/${id}',

View File

@@ -12,8 +12,7 @@ part of 'new_messages_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$NewMessagesState {
@@ -23,14 +22,16 @@ mixin _$NewMessagesState {
required TResult Function() empty,
required TResult Function(int messagesCount) loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int messagesCount)? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$NewMessagesState {
TResult Function(int messagesCount)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_NewMessagesState value) $default, {
required TResult Function(NewMessagesStateEmpty value) empty,
required TResult Function(NewMessagesStateLoaded value) loaded,
required TResult Function(NewMessagesStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_NewMessagesState value)? $default, {
TResult? Function(NewMessagesStateEmpty value)? empty,
TResult? Function(NewMessagesStateLoaded value)? loaded,
TResult? Function(NewMessagesStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_NewMessagesState value)? $default, {
@@ -60,15 +64,15 @@ mixin _$NewMessagesState {
TResult Function(NewMessagesStateLoaded value)? loaded,
TResult Function(NewMessagesStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NewMessagesStateCopyWith<$Res> {
factory $NewMessagesStateCopyWith(
NewMessagesState value,
$Res Function(NewMessagesState) then,
) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>;
NewMessagesState value, $Res Function(NewMessagesState) then) =
_$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>;
}
/// @nodoc
@@ -87,20 +91,18 @@ class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState>
/// @nodoc
abstract class _$$NewMessagesStateImplCopyWith<$Res> {
factory _$$NewMessagesStateImplCopyWith(
_$NewMessagesStateImpl value,
$Res Function(_$NewMessagesStateImpl) then,
) = __$$NewMessagesStateImplCopyWithImpl<$Res>;
factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value,
$Res Function(_$NewMessagesStateImpl) then) =
__$$NewMessagesStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NewMessagesStateImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl>
implements _$$NewMessagesStateImplCopyWith<$Res> {
__$$NewMessagesStateImplCopyWithImpl(
_$NewMessagesStateImpl _value,
$Res Function(_$NewMessagesStateImpl) _then,
) : super(_value, _then);
__$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value,
$Res Function(_$NewMessagesStateImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@@ -207,19 +209,18 @@ abstract class _NewMessagesState implements NewMessagesState {
/// @nodoc
abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> {
factory _$$NewMessagesStateEmptyImplCopyWith(
_$NewMessagesStateEmptyImpl value,
$Res Function(_$NewMessagesStateEmptyImpl) then,
) = __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>;
_$NewMessagesStateEmptyImpl value,
$Res Function(_$NewMessagesStateEmptyImpl) then) =
__$$NewMessagesStateEmptyImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl>
implements _$$NewMessagesStateEmptyImplCopyWith<$Res> {
__$$NewMessagesStateEmptyImplCopyWithImpl(
_$NewMessagesStateEmptyImpl _value,
$Res Function(_$NewMessagesStateEmptyImpl) _then,
) : super(_value, _then);
__$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value,
$Res Function(_$NewMessagesStateEmptyImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@@ -327,9 +328,9 @@ abstract class NewMessagesStateEmpty implements NewMessagesState {
/// @nodoc
abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> {
factory _$$NewMessagesStateLoadedImplCopyWith(
_$NewMessagesStateLoadedImpl value,
$Res Function(_$NewMessagesStateLoadedImpl) then,
) = __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>;
_$NewMessagesStateLoadedImpl value,
$Res Function(_$NewMessagesStateLoadedImpl) then) =
__$$NewMessagesStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({int messagesCount});
}
@@ -339,24 +340,23 @@ class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl>
implements _$$NewMessagesStateLoadedImplCopyWith<$Res> {
__$$NewMessagesStateLoadedImplCopyWithImpl(
_$NewMessagesStateLoadedImpl _value,
$Res Function(_$NewMessagesStateLoadedImpl) _then,
) : super(_value, _then);
_$NewMessagesStateLoadedImpl _value,
$Res Function(_$NewMessagesStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? messagesCount = null}) {
return _then(
_$NewMessagesStateLoadedImpl(
messagesCount:
null == messagesCount
? _value.messagesCount
: messagesCount // ignore: cast_nullable_to_non_nullable
as int,
),
);
$Res call({
Object? messagesCount = null,
}) {
return _then(_$NewMessagesStateLoadedImpl(
messagesCount: null == messagesCount
? _value.messagesCount
: messagesCount // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
@@ -391,11 +391,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded {
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
get copyWith =>
__$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>(
this,
_$identity,
);
get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl<
_$NewMessagesStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -482,15 +479,15 @@ abstract class NewMessagesStateLoaded implements NewMessagesState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> {
factory _$$NewMessagesStateErrorImplCopyWith(
_$NewMessagesStateErrorImpl value,
$Res Function(_$NewMessagesStateErrorImpl) then,
) = __$$NewMessagesStateErrorImplCopyWithImpl<$Res>;
_$NewMessagesStateErrorImpl value,
$Res Function(_$NewMessagesStateErrorImpl) then) =
__$$NewMessagesStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
@@ -499,25 +496,23 @@ abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> {
class __$$NewMessagesStateErrorImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl>
implements _$$NewMessagesStateErrorImplCopyWith<$Res> {
__$$NewMessagesStateErrorImplCopyWithImpl(
_$NewMessagesStateErrorImpl _value,
$Res Function(_$NewMessagesStateErrorImpl) _then,
) : super(_value, _then);
__$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value,
$Res Function(_$NewMessagesStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$NewMessagesStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$NewMessagesStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -552,11 +547,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError {
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
get copyWith =>
__$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>(
this,
_$identity,
);
get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl<
_$NewMessagesStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -643,5 +635,5 @@ abstract class NewMessagesStateError implements NewMessagesState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,8 +12,7 @@ part of 'notifications_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$NotificationsState {
@@ -22,43 +21,46 @@ mixin _$NotificationsState {
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(
List<String> notifications,
int notificationsCount,
)
loaded,
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_NotificationsState value) $default, {
required TResult Function(NotificationsStateEmpty value) empty,
required TResult Function(NotificationsStateLoaded value) loaded,
required TResult Function(NotificationsStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_NotificationsState value)? $default, {
TResult? Function(NotificationsStateEmpty value)? empty,
TResult? Function(NotificationsStateLoaded value)? loaded,
TResult? Function(NotificationsStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_NotificationsState value)? $default, {
@@ -66,15 +68,15 @@ mixin _$NotificationsState {
TResult Function(NotificationsStateLoaded value)? loaded,
TResult Function(NotificationsStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NotificationsStateCopyWith<$Res> {
factory $NotificationsStateCopyWith(
NotificationsState value,
$Res Function(NotificationsState) then,
) = _$NotificationsStateCopyWithImpl<$Res, NotificationsState>;
NotificationsState value, $Res Function(NotificationsState) then) =
_$NotificationsStateCopyWithImpl<$Res, NotificationsState>;
}
/// @nodoc
@@ -93,20 +95,18 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState>
/// @nodoc
abstract class _$$NotificationsStateImplCopyWith<$Res> {
factory _$$NotificationsStateImplCopyWith(
_$NotificationsStateImpl value,
$Res Function(_$NotificationsStateImpl) then,
) = __$$NotificationsStateImplCopyWithImpl<$Res>;
factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value,
$Res Function(_$NotificationsStateImpl) then) =
__$$NotificationsStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NotificationsStateImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl>
implements _$$NotificationsStateImplCopyWith<$Res> {
__$$NotificationsStateImplCopyWithImpl(
_$NotificationsStateImpl _value,
$Res Function(_$NotificationsStateImpl) _then,
) : super(_value, _then);
__$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value,
$Res Function(_$NotificationsStateImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@@ -137,10 +137,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(
List<String> notifications,
int notificationsCount,
)
loaded,
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -152,7 +150,7 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -164,7 +162,7 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -219,20 +217,20 @@ abstract class _NotificationsState implements NotificationsState {
/// @nodoc
abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> {
factory _$$NotificationsStateEmptyImplCopyWith(
_$NotificationsStateEmptyImpl value,
$Res Function(_$NotificationsStateEmptyImpl) then,
) = __$$NotificationsStateEmptyImplCopyWithImpl<$Res>;
_$NotificationsStateEmptyImpl value,
$Res Function(_$NotificationsStateEmptyImpl) then) =
__$$NotificationsStateEmptyImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NotificationsStateEmptyImplCopyWithImpl<$Res>
extends
_$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateEmptyImpl>
implements _$$NotificationsStateEmptyImplCopyWith<$Res> {
__$$NotificationsStateEmptyImplCopyWithImpl(
_$NotificationsStateEmptyImpl _value,
$Res Function(_$NotificationsStateEmptyImpl) _then,
) : super(_value, _then);
_$NotificationsStateEmptyImpl _value,
$Res Function(_$NotificationsStateEmptyImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@@ -264,10 +262,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(
List<String> notifications,
int notificationsCount,
)
loaded,
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return empty();
@@ -279,7 +275,7 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult? Function(String errorMessage)? error,
}) {
return empty?.call();
@@ -291,7 +287,7 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -346,52 +342,51 @@ abstract class NotificationsStateEmpty implements NotificationsState {
/// @nodoc
abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> {
factory _$$NotificationsStateLoadedImplCopyWith(
_$NotificationsStateLoadedImpl value,
$Res Function(_$NotificationsStateLoadedImpl) then,
) = __$$NotificationsStateLoadedImplCopyWithImpl<$Res>;
_$NotificationsStateLoadedImpl value,
$Res Function(_$NotificationsStateLoadedImpl) then) =
__$$NotificationsStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({List<String> notifications, int notificationsCount});
}
/// @nodoc
class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
extends
_$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateLoadedImpl>
implements _$$NotificationsStateLoadedImplCopyWith<$Res> {
__$$NotificationsStateLoadedImplCopyWithImpl(
_$NotificationsStateLoadedImpl _value,
$Res Function(_$NotificationsStateLoadedImpl) _then,
) : super(_value, _then);
_$NotificationsStateLoadedImpl _value,
$Res Function(_$NotificationsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? notifications = null, Object? notificationsCount = null}) {
return _then(
_$NotificationsStateLoadedImpl(
notifications:
null == notifications
? _value._notifications
: notifications // ignore: cast_nullable_to_non_nullable
as List<String>,
notificationsCount:
null == notificationsCount
? _value.notificationsCount
: notificationsCount // ignore: cast_nullable_to_non_nullable
as int,
),
);
$Res call({
Object? notifications = null,
Object? notificationsCount = null,
}) {
return _then(_$NotificationsStateLoadedImpl(
notifications: null == notifications
? _value._notifications
: notifications // ignore: cast_nullable_to_non_nullable
as List<String>,
notificationsCount: null == notificationsCount
? _value.notificationsCount
: notificationsCount // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
const _$NotificationsStateLoadedImpl({
required final List<String> notifications,
required this.notificationsCount,
}) : _notifications = notifications;
const _$NotificationsStateLoadedImpl(
{required final List<String> notifications,
required this.notificationsCount})
: _notifications = notifications;
final List<String> _notifications;
@override
@@ -414,20 +409,15 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateLoadedImpl &&
const DeepCollectionEquality().equals(
other._notifications,
_notifications,
) &&
const DeepCollectionEquality()
.equals(other._notifications, _notifications) &&
(identical(other.notificationsCount, notificationsCount) ||
other.notificationsCount == notificationsCount));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_notifications),
notificationsCount,
);
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_notifications), notificationsCount);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@@ -435,9 +425,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl<
_$NotificationsStateLoadedImpl
>(this, _$identity);
get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl<
_$NotificationsStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -445,10 +434,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(
List<String> notifications,
int notificationsCount,
)
loaded,
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(notifications, notificationsCount);
@@ -460,7 +447,7 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(notifications, notificationsCount);
@@ -472,7 +459,7 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -521,10 +508,9 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
}
abstract class NotificationsStateLoaded implements NotificationsState {
const factory NotificationsStateLoaded({
required final List<String> notifications,
required final int notificationsCount,
}) = _$NotificationsStateLoadedImpl;
const factory NotificationsStateLoaded(
{required final List<String> notifications,
required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
List<String> get notifications;
int get notificationsCount;
@@ -533,43 +519,42 @@ abstract class NotificationsStateLoaded implements NotificationsState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$NotificationsStateErrorImplCopyWith<$Res> {
factory _$$NotificationsStateErrorImplCopyWith(
_$NotificationsStateErrorImpl value,
$Res Function(_$NotificationsStateErrorImpl) then,
) = __$$NotificationsStateErrorImplCopyWithImpl<$Res>;
_$NotificationsStateErrorImpl value,
$Res Function(_$NotificationsStateErrorImpl) then) =
__$$NotificationsStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$NotificationsStateErrorImplCopyWithImpl<$Res>
extends
_$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateErrorImpl>
implements _$$NotificationsStateErrorImplCopyWith<$Res> {
__$$NotificationsStateErrorImplCopyWithImpl(
_$NotificationsStateErrorImpl _value,
$Res Function(_$NotificationsStateErrorImpl) _then,
) : super(_value, _then);
_$NotificationsStateErrorImpl _value,
$Res Function(_$NotificationsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$NotificationsStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$NotificationsStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -604,9 +589,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
get copyWith => __$$NotificationsStateErrorImplCopyWithImpl<
_$NotificationsStateErrorImpl
>(this, _$identity);
get copyWith => __$$NotificationsStateErrorImplCopyWithImpl<
_$NotificationsStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -614,10 +598,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(
List<String> notifications,
int notificationsCount,
)
loaded,
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -629,7 +611,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -641,7 +623,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -699,5 +681,5 @@ abstract class NotificationsStateError implements NotificationsState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,8 +12,7 @@ part of 'profile_avatar_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ProfileAvatarState {
@@ -23,14 +22,16 @@ mixin _$ProfileAvatarState {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$ProfileAvatarState {
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
@@ -60,15 +64,15 @@ mixin _$ProfileAvatarState {
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProfileAvatarStateCopyWith<$Res> {
factory $ProfileAvatarStateCopyWith(
ProfileAvatarState value,
$Res Function(ProfileAvatarState) then,
) = _$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>;
ProfileAvatarState value, $Res Function(ProfileAvatarState) then) =
_$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>;
}
/// @nodoc
@@ -87,20 +91,18 @@ class _$ProfileAvatarStateCopyWithImpl<$Res, $Val extends ProfileAvatarState>
/// @nodoc
abstract class _$$ProfileAvatarStateImplCopyWith<$Res> {
factory _$$ProfileAvatarStateImplCopyWith(
_$ProfileAvatarStateImpl value,
$Res Function(_$ProfileAvatarStateImpl) then,
) = __$$ProfileAvatarStateImplCopyWithImpl<$Res>;
factory _$$ProfileAvatarStateImplCopyWith(_$ProfileAvatarStateImpl value,
$Res Function(_$ProfileAvatarStateImpl) then) =
__$$ProfileAvatarStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ProfileAvatarStateImplCopyWithImpl<$Res>
extends _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateImpl>
implements _$$ProfileAvatarStateImplCopyWith<$Res> {
__$$ProfileAvatarStateImplCopyWithImpl(
_$ProfileAvatarStateImpl _value,
$Res Function(_$ProfileAvatarStateImpl) _then,
) : super(_value, _then);
__$$ProfileAvatarStateImplCopyWithImpl(_$ProfileAvatarStateImpl _value,
$Res Function(_$ProfileAvatarStateImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileAvatarState
/// with the given fields replaced by the non-null parameter values.
@@ -207,20 +209,20 @@ abstract class _ProfileAvatarState implements ProfileAvatarState {
/// @nodoc
abstract class _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
factory _$$ProfileAvatarStateLoadingImplCopyWith(
_$ProfileAvatarStateLoadingImpl value,
$Res Function(_$ProfileAvatarStateLoadingImpl) then,
) = __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>;
_$ProfileAvatarStateLoadingImpl value,
$Res Function(_$ProfileAvatarStateLoadingImpl) then) =
__$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>
extends
_$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateLoadingImpl>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateLoadingImpl>
implements _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
__$$ProfileAvatarStateLoadingImplCopyWithImpl(
_$ProfileAvatarStateLoadingImpl _value,
$Res Function(_$ProfileAvatarStateLoadingImpl) _then,
) : super(_value, _then);
_$ProfileAvatarStateLoadingImpl _value,
$Res Function(_$ProfileAvatarStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileAvatarState
/// with the given fields replaced by the non-null parameter values.
@@ -328,9 +330,9 @@ abstract class ProfileAvatarStateLoading implements ProfileAvatarState {
/// @nodoc
abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
factory _$$ProfileAvatarStateLoadedImplCopyWith(
_$ProfileAvatarStateLoadedImpl value,
$Res Function(_$ProfileAvatarStateLoadedImpl) then,
) = __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>;
_$ProfileAvatarStateLoadedImpl value,
$Res Function(_$ProfileAvatarStateLoadedImpl) then) =
__$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({ProfileModel profile});
@@ -339,28 +341,27 @@ abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
/// @nodoc
class __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>
extends
_$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateLoadedImpl>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateLoadedImpl>
implements _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
__$$ProfileAvatarStateLoadedImplCopyWithImpl(
_$ProfileAvatarStateLoadedImpl _value,
$Res Function(_$ProfileAvatarStateLoadedImpl) _then,
) : super(_value, _then);
_$ProfileAvatarStateLoadedImpl _value,
$Res Function(_$ProfileAvatarStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileAvatarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? profile = null}) {
return _then(
_$ProfileAvatarStateLoadedImpl(
profile:
null == profile
? _value.profile
: profile // ignore: cast_nullable_to_non_nullable
as ProfileModel,
),
);
$Res call({
Object? profile = null,
}) {
return _then(_$ProfileAvatarStateLoadedImpl(
profile: null == profile
? _value.profile
: profile // ignore: cast_nullable_to_non_nullable
as ProfileModel,
));
}
/// Create a copy of ProfileAvatarState
@@ -404,9 +405,8 @@ class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded {
@override
@pragma('vm:prefer-inline')
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl<
_$ProfileAvatarStateLoadedImpl
>(this, _$identity);
get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl<
_$ProfileAvatarStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -484,9 +484,8 @@ class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded {
}
abstract class ProfileAvatarStateLoaded implements ProfileAvatarState {
const factory ProfileAvatarStateLoaded({
required final ProfileModel profile,
}) = _$ProfileAvatarStateLoadedImpl;
const factory ProfileAvatarStateLoaded(
{required final ProfileModel profile}) = _$ProfileAvatarStateLoadedImpl;
ProfileModel get profile;
@@ -494,43 +493,42 @@ abstract class ProfileAvatarStateLoaded implements ProfileAvatarState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
factory _$$ProfileAvatarStateErrorImplCopyWith(
_$ProfileAvatarStateErrorImpl value,
$Res Function(_$ProfileAvatarStateErrorImpl) then,
) = __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>;
_$ProfileAvatarStateErrorImpl value,
$Res Function(_$ProfileAvatarStateErrorImpl) then) =
__$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>
extends
_$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateErrorImpl>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateErrorImpl>
implements _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
__$$ProfileAvatarStateErrorImplCopyWithImpl(
_$ProfileAvatarStateErrorImpl _value,
$Res Function(_$ProfileAvatarStateErrorImpl) _then,
) : super(_value, _then);
_$ProfileAvatarStateErrorImpl _value,
$Res Function(_$ProfileAvatarStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileAvatarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$ProfileAvatarStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$ProfileAvatarStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -565,9 +563,8 @@ class _$ProfileAvatarStateErrorImpl implements ProfileAvatarStateError {
@override
@pragma('vm:prefer-inline')
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl<
_$ProfileAvatarStateErrorImpl
>(this, _$identity);
get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl<
_$ProfileAvatarStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -654,5 +651,5 @@ abstract class ProfileAvatarStateError implements ProfileAvatarState {
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -90,7 +90,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
icon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 20,
height: 20,
ImageConstant.icnFeed,
@@ -114,7 +114,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
icon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
ImageConstant.icnDiary,
width: 20,
height: 20,
@@ -139,7 +139,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
icon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
'assets/icons/consultations.svg',
width: 20,
height: 20,
@@ -165,7 +165,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
final hasUnreadMessages = state.chatsWithUnreadMessagesCount > 0;
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeAnimation: badges.BadgeAnimation.fade(),
badgeAnimation: const badges.BadgeAnimation.fade(),
badgeStyle: badges.BadgeStyle(
badgeColor: hasUnreadMessages ? Colors.red : Colors.transparent,
),
@@ -187,7 +187,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
),
),
);
@@ -200,10 +200,10 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
builder: (BuildContext context, NotificationsState state) {
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeAnimation: badges.BadgeAnimation.fade(),
badgeAnimation: const badges.BadgeAnimation.fade(),
badgeContent: Text(
(state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0',
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 8,
),
@@ -217,7 +217,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 20,
height: 20,
),

View File

@@ -1,21 +0,0 @@
/// This class is used in the [userprofile_item_widget] screen.
// ignore_for_file: must_be_immutable
class CalendarEntryModel {
String? date;
String? status;
String id;
bool is_current_day_included_in_the_chosen_diet_progression;
CalendarEntryModel({
this.date,
this.status,
required this.id,
required this.is_current_day_included_in_the_chosen_diet_progression,
}) {
date = date;
status = status;
id = id;
is_current_day_included_in_the_chosen_diet_progression = is_current_day_included_in_the_chosen_diet_progression;
}
}

View File

@@ -8,7 +8,7 @@ part 'calendar_model.g.dart';
class CalendarModel with _$CalendarModel {
const factory CalendarModel({
required String date,
required bool is_current_day_included_in_the_chosen_diet_progression,
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') required bool isCurrentDayIncludedInTheChosenDietProgression,
Object? diary,
}) = _CalendarModel;

View File

@@ -12,8 +12,7 @@ part of 'calendar_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
CalendarModel _$CalendarModelFromJson(Map<String, dynamic> json) {
return _CalendarModel.fromJson(json);
@@ -22,7 +21,8 @@ CalendarModel _$CalendarModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$CalendarModel {
String get date => throw _privateConstructorUsedError;
bool get is_current_day_included_in_the_chosen_diet_progression =>
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
bool get isCurrentDayIncludedInTheChosenDietProgression =>
throw _privateConstructorUsedError;
Object? get diary => throw _privateConstructorUsedError;
@@ -39,15 +39,14 @@ mixin _$CalendarModel {
/// @nodoc
abstract class $CalendarModelCopyWith<$Res> {
factory $CalendarModelCopyWith(
CalendarModel value,
$Res Function(CalendarModel) then,
) = _$CalendarModelCopyWithImpl<$Res, CalendarModel>;
CalendarModel value, $Res Function(CalendarModel) then) =
_$CalendarModelCopyWithImpl<$Res, CalendarModel>;
@useResult
$Res call({
String date,
bool is_current_day_included_in_the_chosen_diet_progression,
Object? diary,
});
$Res call(
{String date,
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
bool isCurrentDayIncludedInTheChosenDietProgression,
Object? diary});
}
/// @nodoc
@@ -66,26 +65,21 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel>
@override
$Res call({
Object? date = null,
Object? is_current_day_included_in_the_chosen_diet_progression = null,
Object? isCurrentDayIncludedInTheChosenDietProgression = null,
Object? diary = freezed,
}) {
return _then(
_value.copyWith(
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
is_current_day_included_in_the_chosen_diet_progression:
null == is_current_day_included_in_the_chosen_diet_progression
? _value
.is_current_day_included_in_the_chosen_diet_progression
: is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable
as bool,
diary: freezed == diary ? _value.diary : diary,
)
as $Val,
);
return _then(_value.copyWith(
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
isCurrentDayIncludedInTheChosenDietProgression: null ==
isCurrentDayIncludedInTheChosenDietProgression
? _value.isCurrentDayIncludedInTheChosenDietProgression
: isCurrentDayIncludedInTheChosenDietProgression // ignore: cast_nullable_to_non_nullable
as bool,
diary: freezed == diary ? _value.diary : diary,
) as $Val);
}
}
@@ -93,16 +87,15 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel>
abstract class _$$CalendarModelImplCopyWith<$Res>
implements $CalendarModelCopyWith<$Res> {
factory _$$CalendarModelImplCopyWith(
_$CalendarModelImpl value,
$Res Function(_$CalendarModelImpl) then,
) = __$$CalendarModelImplCopyWithImpl<$Res>;
_$CalendarModelImpl value, $Res Function(_$CalendarModelImpl) then) =
__$$CalendarModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String date,
bool is_current_day_included_in_the_chosen_diet_progression,
Object? diary,
});
$Res call(
{String date,
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
bool isCurrentDayIncludedInTheChosenDietProgression,
Object? diary});
}
/// @nodoc
@@ -110,9 +103,8 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
extends _$CalendarModelCopyWithImpl<$Res, _$CalendarModelImpl>
implements _$$CalendarModelImplCopyWith<$Res> {
__$$CalendarModelImplCopyWithImpl(
_$CalendarModelImpl _value,
$Res Function(_$CalendarModelImpl) _then,
) : super(_value, _then);
_$CalendarModelImpl _value, $Res Function(_$CalendarModelImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@@ -120,35 +112,32 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
@override
$Res call({
Object? date = null,
Object? is_current_day_included_in_the_chosen_diet_progression = null,
Object? isCurrentDayIncludedInTheChosenDietProgression = null,
Object? diary = freezed,
}) {
return _then(
_$CalendarModelImpl(
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
is_current_day_included_in_the_chosen_diet_progression:
null == is_current_day_included_in_the_chosen_diet_progression
? _value.is_current_day_included_in_the_chosen_diet_progression
: is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable
as bool,
diary: freezed == diary ? _value.diary : diary,
),
);
return _then(_$CalendarModelImpl(
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
isCurrentDayIncludedInTheChosenDietProgression: null ==
isCurrentDayIncludedInTheChosenDietProgression
? _value.isCurrentDayIncludedInTheChosenDietProgression
: isCurrentDayIncludedInTheChosenDietProgression // ignore: cast_nullable_to_non_nullable
as bool,
diary: freezed == diary ? _value.diary : diary,
));
}
}
/// @nodoc
@JsonSerializable()
class _$CalendarModelImpl implements _CalendarModel {
const _$CalendarModelImpl({
required this.date,
required this.is_current_day_included_in_the_chosen_diet_progression,
this.diary,
});
const _$CalendarModelImpl(
{required this.date,
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
required this.isCurrentDayIncludedInTheChosenDietProgression,
this.diary});
factory _$CalendarModelImpl.fromJson(Map<String, dynamic> json) =>
_$$CalendarModelImplFromJson(json);
@@ -156,13 +145,14 @@ class _$CalendarModelImpl implements _CalendarModel {
@override
final String date;
@override
final bool is_current_day_included_in_the_chosen_diet_progression;
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
final bool isCurrentDayIncludedInTheChosenDietProgression;
@override
final Object? diary;
@override
String toString() {
return 'CalendarModel(date: $date, is_current_day_included_in_the_chosen_diet_progression: $is_current_day_included_in_the_chosen_diet_progression, diary: $diary)';
return 'CalendarModel(date: $date, isCurrentDayIncludedInTheChosenDietProgression: $isCurrentDayIncludedInTheChosenDietProgression, diary: $diary)';
}
@override
@@ -171,23 +161,20 @@ class _$CalendarModelImpl implements _CalendarModel {
(other.runtimeType == runtimeType &&
other is _$CalendarModelImpl &&
(identical(other.date, date) || other.date == date) &&
(identical(
other.is_current_day_included_in_the_chosen_diet_progression,
is_current_day_included_in_the_chosen_diet_progression,
) ||
other.is_current_day_included_in_the_chosen_diet_progression ==
is_current_day_included_in_the_chosen_diet_progression) &&
(identical(other.isCurrentDayIncludedInTheChosenDietProgression,
isCurrentDayIncludedInTheChosenDietProgression) ||
other.isCurrentDayIncludedInTheChosenDietProgression ==
isCurrentDayIncludedInTheChosenDietProgression) &&
const DeepCollectionEquality().equals(other.diary, diary));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
date,
is_current_day_included_in_the_chosen_diet_progression,
const DeepCollectionEquality().hash(diary),
);
runtimeType,
date,
isCurrentDayIncludedInTheChosenDietProgression,
const DeepCollectionEquality().hash(diary));
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@@ -199,16 +186,18 @@ class _$CalendarModelImpl implements _CalendarModel {
@override
Map<String, dynamic> toJson() {
return _$$CalendarModelImplToJson(this);
return _$$CalendarModelImplToJson(
this,
);
}
}
abstract class _CalendarModel implements CalendarModel {
const factory _CalendarModel({
required final String date,
required final bool is_current_day_included_in_the_chosen_diet_progression,
final Object? diary,
}) = _$CalendarModelImpl;
const factory _CalendarModel(
{required final String date,
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
required final bool isCurrentDayIncludedInTheChosenDietProgression,
final Object? diary}) = _$CalendarModelImpl;
factory _CalendarModel.fromJson(Map<String, dynamic> json) =
_$CalendarModelImpl.fromJson;
@@ -216,7 +205,8 @@ abstract class _CalendarModel implements CalendarModel {
@override
String get date;
@override
bool get is_current_day_included_in_the_chosen_diet_progression;
@JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression')
bool get isCurrentDayIncludedInTheChosenDietProgression;
@override
Object? get diary;

View File

@@ -9,7 +9,7 @@ part of 'calendar_model.dart';
_$CalendarModelImpl _$$CalendarModelImplFromJson(Map<String, dynamic> json) =>
_$CalendarModelImpl(
date: json['date'] as String,
is_current_day_included_in_the_chosen_diet_progression:
isCurrentDayIncludedInTheChosenDietProgression:
json['is_current_day_included_in_the_chosen_diet_progression']
as bool,
diary: json['diary'],
@@ -19,6 +19,6 @@ Map<String, dynamic> _$$CalendarModelImplToJson(_$CalendarModelImpl instance) =>
<String, dynamic>{
'date': instance.date,
'is_current_day_included_in_the_chosen_diet_progression':
instance.is_current_day_included_in_the_chosen_diet_progression,
instance.isCurrentDayIncludedInTheChosenDietProgression,
'diary': instance.diary,
};

View File

@@ -12,8 +12,7 @@ part of 'calendar_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CalendarState {
@@ -23,14 +22,16 @@ mixin _$CalendarState {
required TResult Function() loading,
required TResult Function(List<CalendarModel> calendarList) loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<CalendarModel> calendarList)? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$CalendarState {
TResult Function(List<CalendarModel> calendarList)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_CalendarState value) $default, {
required TResult Function(CalendarStateLoading value) loading,
required TResult Function(CalendarStateLoaded value) loaded,
required TResult Function(CalendarStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_CalendarState value)? $default, {
TResult? Function(CalendarStateLoading value)? loading,
TResult? Function(CalendarStateLoaded value)? loaded,
TResult? Function(CalendarStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_CalendarState value)? $default, {
@@ -60,15 +64,15 @@ mixin _$CalendarState {
TResult Function(CalendarStateLoaded value)? loaded,
TResult Function(CalendarStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CalendarStateCopyWith<$Res> {
factory $CalendarStateCopyWith(
CalendarState value,
$Res Function(CalendarState) then,
) = _$CalendarStateCopyWithImpl<$Res, CalendarState>;
CalendarState value, $Res Function(CalendarState) then) =
_$CalendarStateCopyWithImpl<$Res, CalendarState>;
}
/// @nodoc
@@ -88,9 +92,8 @@ class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState>
/// @nodoc
abstract class _$$CalendarStateImplCopyWith<$Res> {
factory _$$CalendarStateImplCopyWith(
_$CalendarStateImpl value,
$Res Function(_$CalendarStateImpl) then,
) = __$$CalendarStateImplCopyWithImpl<$Res>;
_$CalendarStateImpl value, $Res Function(_$CalendarStateImpl) then) =
__$$CalendarStateImplCopyWithImpl<$Res>;
}
/// @nodoc
@@ -98,9 +101,8 @@ class __$$CalendarStateImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateImpl>
implements _$$CalendarStateImplCopyWith<$Res> {
__$$CalendarStateImplCopyWithImpl(
_$CalendarStateImpl _value,
$Res Function(_$CalendarStateImpl) _then,
) : super(_value, _then);
_$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -206,20 +208,18 @@ abstract class _CalendarState implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateLoadingImplCopyWith<$Res> {
factory _$$CalendarStateLoadingImplCopyWith(
_$CalendarStateLoadingImpl value,
$Res Function(_$CalendarStateLoadingImpl) then,
) = __$$CalendarStateLoadingImplCopyWithImpl<$Res>;
factory _$$CalendarStateLoadingImplCopyWith(_$CalendarStateLoadingImpl value,
$Res Function(_$CalendarStateLoadingImpl) then) =
__$$CalendarStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$CalendarStateLoadingImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadingImpl>
implements _$$CalendarStateLoadingImplCopyWith<$Res> {
__$$CalendarStateLoadingImplCopyWithImpl(
_$CalendarStateLoadingImpl _value,
$Res Function(_$CalendarStateLoadingImpl) _then,
) : super(_value, _then);
__$$CalendarStateLoadingImplCopyWithImpl(_$CalendarStateLoadingImpl _value,
$Res Function(_$CalendarStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -326,10 +326,9 @@ abstract class CalendarStateLoading implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateLoadedImplCopyWith<$Res> {
factory _$$CalendarStateLoadedImplCopyWith(
_$CalendarStateLoadedImpl value,
$Res Function(_$CalendarStateLoadedImpl) then,
) = __$$CalendarStateLoadedImplCopyWithImpl<$Res>;
factory _$$CalendarStateLoadedImplCopyWith(_$CalendarStateLoadedImpl value,
$Res Function(_$CalendarStateLoadedImpl) then) =
__$$CalendarStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({List<CalendarModel> calendarList});
}
@@ -338,34 +337,32 @@ abstract class _$$CalendarStateLoadedImplCopyWith<$Res> {
class __$$CalendarStateLoadedImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadedImpl>
implements _$$CalendarStateLoadedImplCopyWith<$Res> {
__$$CalendarStateLoadedImplCopyWithImpl(
_$CalendarStateLoadedImpl _value,
$Res Function(_$CalendarStateLoadedImpl) _then,
) : super(_value, _then);
__$$CalendarStateLoadedImplCopyWithImpl(_$CalendarStateLoadedImpl _value,
$Res Function(_$CalendarStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? calendarList = null}) {
return _then(
_$CalendarStateLoadedImpl(
calendarList:
null == calendarList
? _value._calendarList
: calendarList // ignore: cast_nullable_to_non_nullable
as List<CalendarModel>,
),
);
$Res call({
Object? calendarList = null,
}) {
return _then(_$CalendarStateLoadedImpl(
calendarList: null == calendarList
? _value._calendarList
: calendarList // ignore: cast_nullable_to_non_nullable
as List<CalendarModel>,
));
}
}
/// @nodoc
class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
const _$CalendarStateLoadedImpl({
required final List<CalendarModel> calendarList,
}) : _calendarList = calendarList;
const _$CalendarStateLoadedImpl(
{required final List<CalendarModel> calendarList})
: _calendarList = calendarList;
final List<CalendarModel> _calendarList;
@override
@@ -385,17 +382,13 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CalendarStateLoadedImpl &&
const DeepCollectionEquality().equals(
other._calendarList,
_calendarList,
));
const DeepCollectionEquality()
.equals(other._calendarList, _calendarList));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_calendarList),
);
runtimeType, const DeepCollectionEquality().hash(_calendarList));
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -404,9 +397,7 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
@pragma('vm:prefer-inline')
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
__$$CalendarStateLoadedImplCopyWithImpl<_$CalendarStateLoadedImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -484,9 +475,9 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
}
abstract class CalendarStateLoaded implements CalendarState {
const factory CalendarStateLoaded({
required final List<CalendarModel> calendarList,
}) = _$CalendarStateLoadedImpl;
const factory CalendarStateLoaded(
{required final List<CalendarModel> calendarList}) =
_$CalendarStateLoadedImpl;
List<CalendarModel> get calendarList;
@@ -499,10 +490,9 @@ abstract class CalendarStateLoaded implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateErrorImplCopyWith<$Res> {
factory _$$CalendarStateErrorImplCopyWith(
_$CalendarStateErrorImpl value,
$Res Function(_$CalendarStateErrorImpl) then,
) = __$$CalendarStateErrorImplCopyWithImpl<$Res>;
factory _$$CalendarStateErrorImplCopyWith(_$CalendarStateErrorImpl value,
$Res Function(_$CalendarStateErrorImpl) then) =
__$$CalendarStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
@@ -511,25 +501,23 @@ abstract class _$$CalendarStateErrorImplCopyWith<$Res> {
class __$$CalendarStateErrorImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateErrorImpl>
implements _$$CalendarStateErrorImplCopyWith<$Res> {
__$$CalendarStateErrorImplCopyWithImpl(
_$CalendarStateErrorImpl _value,
$Res Function(_$CalendarStateErrorImpl) _then,
) : super(_value, _then);
__$$CalendarStateErrorImplCopyWithImpl(_$CalendarStateErrorImpl _value,
$Res Function(_$CalendarStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$CalendarStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$CalendarStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -565,9 +553,7 @@ class _$CalendarStateErrorImpl implements CalendarStateError {
@pragma('vm:prefer-inline')
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
__$$CalendarStateErrorImplCopyWithImpl<_$CalendarStateErrorImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs

View File

@@ -12,8 +12,9 @@ import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
class CalendarScreen extends StatelessWidget {
CalendarScreen({Key? key}) : super(key: key);
const CalendarScreen({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider<CalendarCubit>(
create: (context) => sl<CalendarCubit>()..loadCalendarList(),
@@ -22,8 +23,8 @@ class CalendarScreen extends StatelessWidget {
if (state is CalendarStateLoaded) {
return _buildCalendar(context, state);
} else if (state is CalendarStateLoading) {
return Scaffold(
body: const Loader(),
return const Scaffold(
body: Loader(),
);
} else if (state is CalendarStateError) {
return Scaffold(
@@ -34,15 +35,15 @@ class CalendarScreen extends StatelessWidget {
),
),
);
} else
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
child: Text("Неопределенная ошибка"),
),
}
return const Scaffold(
body: Padding(
padding: EdgeInsets.all(16),
child: Center(
child: Text("Неопределенная ошибка"),
),
);
),
);
},
),
);
@@ -55,7 +56,7 @@ class CalendarScreen extends StatelessWidget {
FormBuilder(
child: Scaffold(
appBar: AppBar(
title: Text(
title: const Text(
'Календарь',
),
),
@@ -68,12 +69,12 @@ class CalendarScreen extends StatelessWidget {
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.only(bottom: 8),
child: Column(
children: [
SizedBox(height: 24),
const SizedBox(height: 24),
_buildCalendarBody(context, state),
SizedBox(height: 24),
const SizedBox(height: 24),
],
),
),
@@ -90,11 +91,11 @@ class CalendarScreen extends StatelessWidget {
_buildCalendarBody(BuildContext context, CalendarStateLoaded state) {
return ListView.separated(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return SizedBox(
return const SizedBox(
height: 4,
);
},
@@ -106,12 +107,12 @@ class CalendarScreen extends StatelessWidget {
return InkWell(
borderRadius: BorderRadiusStyle.circleBorder8,
child: Ink(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadiusStyle.circleBorder8,
color: state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression
? Color.fromRGBO(59, 130, 246, .2)
: Color.fromRGBO(126, 136, 151, .1),
color: state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression
? const Color.fromRGBO(59, 130, 246, .2)
: const Color.fromRGBO(126, 136, 151, .1),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -125,12 +126,12 @@ class CalendarScreen extends StatelessWidget {
formatDate(state.calendarList[index].date),
style: theme.textTheme.titleMedium,
),
SizedBox(height: 4),
if (state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression)
const SizedBox(height: 4),
if (state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression)
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -138,11 +139,11 @@ class CalendarScreen extends StatelessWidget {
style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый
),
),
if (!state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression)
if (!state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression)
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(108, 117, 125, 1),
color: const Color.fromRGBO(108, 117, 125, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -166,7 +167,7 @@ class CalendarScreen extends StatelessWidget {
extra: diary['id'].toString(),
),
child: Ink(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadiusStyle.circleBorder8,
color: getBackgroundColor(diary['state']),
@@ -183,13 +184,13 @@ class CalendarScreen extends StatelessWidget {
formatDate(state.calendarList[index].date),
style: theme.textTheme.titleMedium,
),
SizedBox(height: 4),
const SizedBox(height: 4),
Row(
children: [
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: diary['state'] == 'finished' ? Color.fromRGBO(1, 154, 62, 1) : Color.fromRGBO(154, 74, 1, 1),
color: diary['state'] == 'finished' ? const Color.fromRGBO(1, 154, 62, 1) : const Color.fromRGBO(154, 74, 1, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -197,12 +198,12 @@ class CalendarScreen extends StatelessWidget {
style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый
),
),
SizedBox(width: 4),
const SizedBox(width: 4),
if (diary['state'] == 'started')
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -212,9 +213,9 @@ class CalendarScreen extends StatelessWidget {
),
if (diary['state'] == 'finished')
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -256,16 +257,16 @@ String formatDate(String dateString) {
String formattedDate = DateFormat('d MMMM', 'ru_RU').format(dateTime);
// Возвращаем результат в нужном формате
return '$formattedDate';
return formattedDate;
}
Color getBackgroundColor(String? status) {
switch (status) {
case 'finished':
return Color.fromRGBO(1, 154, 62, .1);
return const Color.fromRGBO(1, 154, 62, .1);
case 'started':
return Color.fromRGBO(154, 74, 1, .1);
return const Color.fromRGBO(154, 74, 1, .1);
default:
return Color.fromRGBO(126, 136, 151, .1);
return const Color.fromRGBO(126, 136, 151, .1);
}
}

View File

@@ -36,13 +36,11 @@ class _CalendarService implements CalendarService {
final _result = await _dio.fetch<List<dynamic>>(_options);
late List<CalendarModel> _value;
try {
_value =
_result.data!
.map(
(dynamic i) =>
CalendarModel.fromJson(i as Map<String, dynamic>),
)
.toList();
_value = _result.data!
.map(
(dynamic i) => CalendarModel.fromJson(i as Map<String, dynamic>),
)
.toList();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;

View File

@@ -12,8 +12,7 @@ part of 'chat_message_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatMessageModel _$ChatMessageModelFromJson(Map<String, dynamic> json) {
return _ChatMessageModel.fromJson(json);
@@ -49,20 +48,18 @@ mixin _$ChatMessageModel {
/// @nodoc
abstract class $ChatMessageModelCopyWith<$Res> {
factory $ChatMessageModelCopyWith(
ChatMessageModel value,
$Res Function(ChatMessageModel) then,
) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>;
ChatMessageModel value, $Res Function(ChatMessageModel) then) =
_$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>;
@useResult
$Res call({
int id,
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId,
});
$Res call(
{int id,
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId});
}
/// @nodoc
@@ -89,83 +86,69 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
Object? isCurrentUserAuthor = freezed,
Object? roomId = freezed,
}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
data:
null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as String,
mediaData:
freezed == mediaData
? _value.mediaData
: mediaData // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,
authorId:
null == authorId
? _value.authorId
: authorId // ignore: cast_nullable_to_non_nullable
as int,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
isRead:
null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor:
freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId:
freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as String,
mediaData: freezed == mediaData
? _value.mediaData
: mediaData // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,
authorId: null == authorId
? _value.authorId
: authorId // ignore: cast_nullable_to_non_nullable
as int,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
isRead: null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor: freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId: freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$ChatMessageModelImplCopyWith<$Res>
implements $ChatMessageModelCopyWith<$Res> {
factory _$$ChatMessageModelImplCopyWith(
_$ChatMessageModelImpl value,
$Res Function(_$ChatMessageModelImpl) then,
) = __$$ChatMessageModelImplCopyWithImpl<$Res>;
factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value,
$Res Function(_$ChatMessageModelImpl) then) =
__$$ChatMessageModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
int id,
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId,
});
$Res call(
{int id,
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId});
}
/// @nodoc
class __$$ChatMessageModelImplCopyWithImpl<$Res>
extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl>
implements _$$ChatMessageModelImplCopyWith<$Res> {
__$$ChatMessageModelImplCopyWithImpl(
_$ChatMessageModelImpl _value,
$Res Function(_$ChatMessageModelImpl) _then,
) : super(_value, _then);
__$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value,
$Res Function(_$ChatMessageModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@@ -181,67 +164,58 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res>
Object? isCurrentUserAuthor = freezed,
Object? roomId = freezed,
}) {
return _then(
_$ChatMessageModelImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
data:
null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as String,
mediaData:
freezed == mediaData
? _value._mediaData
: mediaData // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,
authorId:
null == authorId
? _value.authorId
: authorId // ignore: cast_nullable_to_non_nullable
as int,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
isRead:
null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor:
freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId:
freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
),
);
return _then(_$ChatMessageModelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as String,
mediaData: freezed == mediaData
? _value._mediaData
: mediaData // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,
authorId: null == authorId
? _value.authorId
: authorId // ignore: cast_nullable_to_non_nullable
as int,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
isRead: null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor: freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId: freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatMessageModelImpl implements _ChatMessageModel {
const _$ChatMessageModelImpl({
required this.id,
required this.data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required this.authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) required this.updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) required this.isRead,
@JsonKey(name: 'is_author_message_auth_user')
required this.isCurrentUserAuthor,
@JsonKey(name: 'room_id') required this.roomId,
}) : _mediaData = mediaData;
const _$ChatMessageModelImpl(
{required this.id,
required this.data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required this.authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate) required this.updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false)
required this.isRead,
@JsonKey(name: 'is_author_message_auth_user')
required this.isCurrentUserAuthor,
@JsonKey(name: 'room_id') required this.roomId})
: _mediaData = mediaData;
factory _$ChatMessageModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatMessageModelImplFromJson(json);
@@ -289,10 +263,8 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
other is _$ChatMessageModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.data, data) || other.data == data) &&
const DeepCollectionEquality().equals(
other._mediaData,
_mediaData,
) &&
const DeepCollectionEquality()
.equals(other._mediaData, _mediaData) &&
(identical(other.authorId, authorId) ||
other.authorId == authorId) &&
(identical(other.updatedAt, updatedAt) ||
@@ -306,16 +278,15 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
data,
const DeepCollectionEquality().hash(_mediaData),
authorId,
updatedAt,
isRead,
isCurrentUserAuthor,
roomId,
);
runtimeType,
id,
data,
const DeepCollectionEquality().hash(_mediaData),
authorId,
updatedAt,
isRead,
isCurrentUserAuthor,
roomId);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@@ -324,30 +295,30 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
@pragma('vm:prefer-inline')
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
__$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ChatMessageModelImplToJson(this);
return _$$ChatMessageModelImplToJson(
this,
);
}
}
abstract class _ChatMessageModel implements ChatMessageModel {
const factory _ChatMessageModel({
required final int id,
required final String data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required final int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate)
required final DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false)
required final bool isRead,
@JsonKey(name: 'is_author_message_auth_user')
required final bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') required final String? roomId,
}) = _$ChatMessageModelImpl;
const factory _ChatMessageModel(
{required final int id,
required final String data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required final int authorId,
@JsonKey(name: 'updated_at', fromJson: parseDate)
required final DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false)
required final bool isRead,
@JsonKey(name: 'is_author_message_auth_user')
required final bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') required final String? roomId}) =
_$ChatMessageModelImpl;
factory _ChatMessageModel.fromJson(Map<String, dynamic> json) =
_$ChatMessageModelImpl.fromJson;

View File

@@ -7,27 +7,27 @@ part of 'chat_message_model.dart';
// **************************************************************************
_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(
Map<String, dynamic> json,
) => _$ChatMessageModelImpl(
id: (json['id'] as num).toInt(),
data: json['data'] as String,
mediaData: json['media_data'] as List<dynamic>?,
authorId: (json['author_id'] as num).toInt(),
updatedAt: parseDate(json['updated_at'] as String),
isRead: json['read_by_to_user'] as bool? ?? false,
isCurrentUserAuthor: json['is_author_message_auth_user'] as bool?,
roomId: json['room_id'] as String?,
);
Map<String, dynamic> json) =>
_$ChatMessageModelImpl(
id: (json['id'] as num).toInt(),
data: json['data'] as String,
mediaData: json['media_data'] as List<dynamic>?,
authorId: (json['author_id'] as num).toInt(),
updatedAt: parseDate(json['updated_at'] as String),
isRead: json['read_by_to_user'] as bool? ?? false,
isCurrentUserAuthor: json['is_author_message_auth_user'] as bool?,
roomId: json['room_id'] as String?,
);
Map<String, dynamic> _$$ChatMessageModelImplToJson(
_$ChatMessageModelImpl instance,
) => <String, dynamic>{
'id': instance.id,
'data': instance.data,
'media_data': instance.mediaData,
'author_id': instance.authorId,
'updated_at': instance.updatedAt.toIso8601String(),
'read_by_to_user': instance.isRead,
'is_author_message_auth_user': instance.isCurrentUserAuthor,
'room_id': instance.roomId,
};
_$ChatMessageModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'data': instance.data,
'media_data': instance.mediaData,
'author_id': instance.authorId,
'updated_at': instance.updatedAt.toIso8601String(),
'read_by_to_user': instance.isRead,
'is_author_message_auth_user': instance.isCurrentUserAuthor,
'room_id': instance.roomId,
};

View File

@@ -12,8 +12,7 @@ part of 'chat_messages_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatMessagesModel _$ChatMessagesModelFromJson(Map<String, dynamic> json) {
return _ChatMessagesModel.fromJson(json);
@@ -38,14 +37,12 @@ mixin _$ChatMessagesModel {
/// @nodoc
abstract class $ChatMessagesModelCopyWith<$Res> {
factory $ChatMessagesModelCopyWith(
ChatMessagesModel value,
$Res Function(ChatMessagesModel) then,
) = _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>;
ChatMessagesModel value, $Res Function(ChatMessagesModel) then) =
_$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>;
@useResult
$Res call({
@JsonKey(name: 'data') List<ChatMessageModel> messagesList,
ChatMetaModel meta,
});
$Res call(
{@JsonKey(name: 'data') List<ChatMessageModel> messagesList,
ChatMetaModel meta});
$ChatMetaModelCopyWith<$Res> get meta;
}
@@ -64,22 +61,20 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? messagesList = null, Object? meta = null}) {
return _then(
_value.copyWith(
messagesList:
null == messagesList
? _value.messagesList
: messagesList // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
meta:
null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as ChatMetaModel,
)
as $Val,
);
$Res call({
Object? messagesList = null,
Object? meta = null,
}) {
return _then(_value.copyWith(
messagesList: null == messagesList
? _value.messagesList
: messagesList // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as ChatMetaModel,
) as $Val);
}
/// Create a copy of ChatMessagesModel
@@ -96,16 +91,14 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
/// @nodoc
abstract class _$$ChatMessagesModelImplCopyWith<$Res>
implements $ChatMessagesModelCopyWith<$Res> {
factory _$$ChatMessagesModelImplCopyWith(
_$ChatMessagesModelImpl value,
$Res Function(_$ChatMessagesModelImpl) then,
) = __$$ChatMessagesModelImplCopyWithImpl<$Res>;
factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value,
$Res Function(_$ChatMessagesModelImpl) then) =
__$$ChatMessagesModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'data') List<ChatMessageModel> messagesList,
ChatMetaModel meta,
});
$Res call(
{@JsonKey(name: 'data') List<ChatMessageModel> messagesList,
ChatMetaModel meta});
@override
$ChatMetaModelCopyWith<$Res> get meta;
@@ -115,40 +108,39 @@ abstract class _$$ChatMessagesModelImplCopyWith<$Res>
class __$$ChatMessagesModelImplCopyWithImpl<$Res>
extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl>
implements _$$ChatMessagesModelImplCopyWith<$Res> {
__$$ChatMessagesModelImplCopyWithImpl(
_$ChatMessagesModelImpl _value,
$Res Function(_$ChatMessagesModelImpl) _then,
) : super(_value, _then);
__$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value,
$Res Function(_$ChatMessagesModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? messagesList = null, Object? meta = null}) {
return _then(
_$ChatMessagesModelImpl(
messagesList:
null == messagesList
? _value._messagesList
: messagesList // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
meta:
null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as ChatMetaModel,
),
);
$Res call({
Object? messagesList = null,
Object? meta = null,
}) {
return _then(_$ChatMessagesModelImpl(
messagesList: null == messagesList
? _value._messagesList
: messagesList // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as ChatMetaModel,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatMessagesModelImpl implements _ChatMessagesModel {
const _$ChatMessagesModelImpl({
@JsonKey(name: 'data') required final List<ChatMessageModel> messagesList,
required this.meta,
}) : _messagesList = messagesList;
const _$ChatMessagesModelImpl(
{@JsonKey(name: 'data')
required final List<ChatMessageModel> messagesList,
required this.meta})
: _messagesList = messagesList;
factory _$ChatMessagesModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatMessagesModelImplFromJson(json);
@@ -175,20 +167,15 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatMessagesModelImpl &&
const DeepCollectionEquality().equals(
other._messagesList,
_messagesList,
) &&
const DeepCollectionEquality()
.equals(other._messagesList, _messagesList) &&
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_messagesList),
meta,
);
runtimeType, const DeepCollectionEquality().hash(_messagesList), meta);
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@@ -197,21 +184,21 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel {
@pragma('vm:prefer-inline')
_$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith =>
__$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ChatMessagesModelImplToJson(this);
return _$$ChatMessagesModelImplToJson(
this,
);
}
}
abstract class _ChatMessagesModel implements ChatMessagesModel {
const factory _ChatMessagesModel({
@JsonKey(name: 'data') required final List<ChatMessageModel> messagesList,
required final ChatMetaModel meta,
}) = _$ChatMessagesModelImpl;
const factory _ChatMessagesModel(
{@JsonKey(name: 'data')
required final List<ChatMessageModel> messagesList,
required final ChatMetaModel meta}) = _$ChatMessagesModelImpl;
factory _ChatMessagesModel.fromJson(Map<String, dynamic> json) =
_$ChatMessagesModelImpl.fromJson;

View File

@@ -7,15 +7,17 @@ part of 'chat_messages_model.dart';
// **************************************************************************
_$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson(
Map<String, dynamic> json,
) => _$ChatMessagesModelImpl(
messagesList:
(json['data'] as List<dynamic>)
Map<String, dynamic> json) =>
_$ChatMessagesModelImpl(
messagesList: (json['data'] as List<dynamic>)
.map((e) => ChatMessageModel.fromJson(e as Map<String, dynamic>))
.toList(),
meta: ChatMetaModel.fromJson(json['meta'] as Map<String, dynamic>),
);
meta: ChatMetaModel.fromJson(json['meta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$ChatMessagesModelImplToJson(
_$ChatMessagesModelImpl instance,
) => <String, dynamic>{'data': instance.messagesList, 'meta': instance.meta};
_$ChatMessagesModelImpl instance) =>
<String, dynamic>{
'data': instance.messagesList,
'meta': instance.meta,
};

View File

@@ -12,8 +12,7 @@ part of 'chat_meta_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatMetaModel _$ChatMetaModelFromJson(Map<String, dynamic> json) {
return _ChatMetaModel.fromJson(json);
@@ -37,9 +36,8 @@ mixin _$ChatMetaModel {
/// @nodoc
abstract class $ChatMetaModelCopyWith<$Res> {
factory $ChatMetaModelCopyWith(
ChatMetaModel value,
$Res Function(ChatMetaModel) then,
) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>;
ChatMetaModel value, $Res Function(ChatMetaModel) then) =
_$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>;
@useResult
$Res call({@JsonKey(name: "last_page") int lastPage});
}
@@ -58,17 +56,15 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? lastPage = null}) {
return _then(
_value.copyWith(
lastPage:
null == lastPage
? _value.lastPage
: lastPage // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
$Res call({
Object? lastPage = null,
}) {
return _then(_value.copyWith(
lastPage: null == lastPage
? _value.lastPage
: lastPage // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
@@ -76,9 +72,8 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel>
abstract class _$$ChatMetaModelImplCopyWith<$Res>
implements $ChatMetaModelCopyWith<$Res> {
factory _$$ChatMetaModelImplCopyWith(
_$ChatMetaModelImpl value,
$Res Function(_$ChatMetaModelImpl) then,
) = __$$ChatMetaModelImplCopyWithImpl<$Res>;
_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) =
__$$ChatMetaModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: "last_page") int lastPage});
@@ -89,33 +84,30 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res>
extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl>
implements _$$ChatMetaModelImplCopyWith<$Res> {
__$$ChatMetaModelImplCopyWithImpl(
_$ChatMetaModelImpl _value,
$Res Function(_$ChatMetaModelImpl) _then,
) : super(_value, _then);
_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? lastPage = null}) {
return _then(
_$ChatMetaModelImpl(
lastPage:
null == lastPage
? _value.lastPage
: lastPage // ignore: cast_nullable_to_non_nullable
as int,
),
);
$Res call({
Object? lastPage = null,
}) {
return _then(_$ChatMetaModelImpl(
lastPage: null == lastPage
? _value.lastPage
: lastPage // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatMetaModelImpl implements _ChatMetaModel {
const _$ChatMetaModelImpl({
@JsonKey(name: "last_page") required this.lastPage,
});
const _$ChatMetaModelImpl(
{@JsonKey(name: "last_page") required this.lastPage});
factory _$ChatMetaModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatMetaModelImplFromJson(json);
@@ -152,14 +144,16 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
@override
Map<String, dynamic> toJson() {
return _$$ChatMetaModelImplToJson(this);
return _$$ChatMetaModelImplToJson(
this,
);
}
}
abstract class _ChatMetaModel implements ChatMetaModel {
const factory _ChatMetaModel({
@JsonKey(name: "last_page") required final int lastPage,
}) = _$ChatMetaModelImpl;
const factory _ChatMetaModel(
{@JsonKey(name: "last_page") required final int lastPage}) =
_$ChatMetaModelImpl;
factory _ChatMetaModel.fromJson(Map<String, dynamic> json) =
_$ChatMetaModelImpl.fromJson;

View File

@@ -7,7 +7,11 @@ part of 'chat_meta_model.dart';
// **************************************************************************
_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map<String, dynamic> json) =>
_$ChatMetaModelImpl(lastPage: (json['last_page'] as num).toInt());
_$ChatMetaModelImpl(
lastPage: (json['last_page'] as num).toInt(),
);
Map<String, dynamic> _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) =>
<String, dynamic>{'last_page': instance.lastPage};
<String, dynamic>{
'last_page': instance.lastPage,
};

View File

@@ -12,8 +12,7 @@ part of 'chat_room_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatRoomModel _$ChatRoomModelFromJson(Map<String, dynamic> json) {
return _ChatRoomModel.fromJson(json);
@@ -42,17 +41,16 @@ mixin _$ChatRoomModel {
/// @nodoc
abstract class $ChatRoomModelCopyWith<$Res> {
factory $ChatRoomModelCopyWith(
ChatRoomModel value,
$Res Function(ChatRoomModel) then,
) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>;
ChatRoomModel value, $Res Function(ChatRoomModel) then) =
_$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>;
@useResult
$Res call({
String id,
@JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings,
Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan,
});
$Res call(
{String id,
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings,
Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
$UsersCopyWith<$Res> get users;
@@ -79,31 +77,24 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
Object? users = null,
Object? chosenPlan = freezed,
}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
chatRoomSettings:
null == chatRoomSettings
? _value.chatRoomSettings
: chatRoomSettings // ignore: cast_nullable_to_non_nullable
as ChatRoomSettingsModel,
users:
null == users
? _value.users
: users // ignore: cast_nullable_to_non_nullable
as Users,
chosenPlan:
freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
)
as $Val,
);
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
chatRoomSettings: null == chatRoomSettings
? _value.chatRoomSettings
: chatRoomSettings // ignore: cast_nullable_to_non_nullable
as ChatRoomSettingsModel,
users: null == users
? _value.users
: users // ignore: cast_nullable_to_non_nullable
as Users,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
) as $Val);
}
/// Create a copy of ChatRoomModel
@@ -111,9 +102,8 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
@override
@pragma('vm:prefer-inline')
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings {
return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, (
value,
) {
return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings,
(value) {
return _then(_value.copyWith(chatRoomSettings: value) as $Val);
});
}
@@ -147,18 +137,17 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
abstract class _$$ChatRoomModelImplCopyWith<$Res>
implements $ChatRoomModelCopyWith<$Res> {
factory _$$ChatRoomModelImplCopyWith(
_$ChatRoomModelImpl value,
$Res Function(_$ChatRoomModelImpl) then,
) = __$$ChatRoomModelImplCopyWithImpl<$Res>;
_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) =
__$$ChatRoomModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String id,
@JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings,
Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan,
});
$Res call(
{String id,
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings,
Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
@override
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
@@ -173,9 +162,8 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl>
implements _$$ChatRoomModelImplCopyWith<$Res> {
__$$ChatRoomModelImplCopyWithImpl(
_$ChatRoomModelImpl _value,
$Res Function(_$ChatRoomModelImpl) _then,
) : super(_value, _then);
_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@@ -187,43 +175,36 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
Object? users = null,
Object? chosenPlan = freezed,
}) {
return _then(
_$ChatRoomModelImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
chatRoomSettings:
null == chatRoomSettings
? _value.chatRoomSettings
: chatRoomSettings // ignore: cast_nullable_to_non_nullable
as ChatRoomSettingsModel,
users:
null == users
? _value.users
: users // ignore: cast_nullable_to_non_nullable
as Users,
chosenPlan:
freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
),
);
return _then(_$ChatRoomModelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
chatRoomSettings: null == chatRoomSettings
? _value.chatRoomSettings
: chatRoomSettings // ignore: cast_nullable_to_non_nullable
as ChatRoomSettingsModel,
users: null == users
? _value.users
: users // ignore: cast_nullable_to_non_nullable
as Users,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatRoomModelImpl implements _ChatRoomModel {
const _$ChatRoomModelImpl({
required this.id,
@JsonKey(name: 'chat_room_setting') required this.chatRoomSettings,
required this.users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required this.chosenPlan,
});
const _$ChatRoomModelImpl(
{required this.id,
@JsonKey(name: 'chat_room_setting') required this.chatRoomSettings,
required this.users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required this.chosenPlan});
factory _$ChatRoomModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomModelImplFromJson(json);
@@ -272,19 +253,20 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
@override
Map<String, dynamic> toJson() {
return _$$ChatRoomModelImplToJson(this);
return _$$ChatRoomModelImplToJson(
this,
);
}
}
abstract class _ChatRoomModel implements ChatRoomModel {
const factory _ChatRoomModel({
required final String id,
@JsonKey(name: 'chat_room_setting')
required final ChatRoomSettingsModel chatRoomSettings,
required final Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required final ChosenPlanModel? chosenPlan,
}) = _$ChatRoomModelImpl;
const factory _ChatRoomModel(
{required final String id,
@JsonKey(name: 'chat_room_setting')
required final ChatRoomSettingsModel chatRoomSettings,
required final Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required final ChosenPlanModel? chosenPlan}) = _$ChatRoomModelImpl;
factory _ChatRoomModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomModelImpl.fromJson;
@@ -333,10 +315,9 @@ abstract class $UsersCopyWith<$Res> {
factory $UsersCopyWith(Users value, $Res Function(Users) then) =
_$UsersCopyWithImpl<$Res, Users>;
@useResult
$Res call({
@JsonKey(name: 'from_chat_user') ChatUserModel sender,
@JsonKey(name: 'to_chat_user') ChatUserModel receiver,
});
$Res call(
{@JsonKey(name: 'from_chat_user') ChatUserModel sender,
@JsonKey(name: 'to_chat_user') ChatUserModel receiver});
$ChatUserModelCopyWith<$Res> get sender;
$ChatUserModelCopyWith<$Res> get receiver;
@@ -356,22 +337,20 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? sender = null, Object? receiver = null}) {
return _then(
_value.copyWith(
sender:
null == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
receiver:
null == receiver
? _value.receiver
: receiver // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
)
as $Val,
);
$Res call({
Object? sender = null,
Object? receiver = null,
}) {
return _then(_value.copyWith(
sender: null == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
receiver: null == receiver
? _value.receiver
: receiver // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
) as $Val);
}
/// Create a copy of Users
@@ -398,15 +377,13 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
/// @nodoc
abstract class _$$UsersImplCopyWith<$Res> implements $UsersCopyWith<$Res> {
factory _$$UsersImplCopyWith(
_$UsersImpl value,
$Res Function(_$UsersImpl) then,
) = __$$UsersImplCopyWithImpl<$Res>;
_$UsersImpl value, $Res Function(_$UsersImpl) then) =
__$$UsersImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'from_chat_user') ChatUserModel sender,
@JsonKey(name: 'to_chat_user') ChatUserModel receiver,
});
$Res call(
{@JsonKey(name: 'from_chat_user') ChatUserModel sender,
@JsonKey(name: 'to_chat_user') ChatUserModel receiver});
@override
$ChatUserModelCopyWith<$Res> get sender;
@@ -419,39 +396,36 @@ class __$$UsersImplCopyWithImpl<$Res>
extends _$UsersCopyWithImpl<$Res, _$UsersImpl>
implements _$$UsersImplCopyWith<$Res> {
__$$UsersImplCopyWithImpl(
_$UsersImpl _value,
$Res Function(_$UsersImpl) _then,
) : super(_value, _then);
_$UsersImpl _value, $Res Function(_$UsersImpl) _then)
: super(_value, _then);
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? sender = null, Object? receiver = null}) {
return _then(
_$UsersImpl(
sender:
null == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
receiver:
null == receiver
? _value.receiver
: receiver // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
),
);
$Res call({
Object? sender = null,
Object? receiver = null,
}) {
return _then(_$UsersImpl(
sender: null == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
receiver: null == receiver
? _value.receiver
: receiver // ignore: cast_nullable_to_non_nullable
as ChatUserModel,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UsersImpl implements _Users {
const _$UsersImpl({
@JsonKey(name: 'from_chat_user') required this.sender,
@JsonKey(name: 'to_chat_user') required this.receiver,
});
const _$UsersImpl(
{@JsonKey(name: 'from_chat_user') required this.sender,
@JsonKey(name: 'to_chat_user') required this.receiver});
factory _$UsersImpl.fromJson(Map<String, dynamic> json) =>
_$$UsersImplFromJson(json);
@@ -492,15 +466,17 @@ class _$UsersImpl implements _Users {
@override
Map<String, dynamic> toJson() {
return _$$UsersImplToJson(this);
return _$$UsersImplToJson(
this,
);
}
}
abstract class _Users implements Users {
const factory _Users({
@JsonKey(name: 'from_chat_user') required final ChatUserModel sender,
@JsonKey(name: 'to_chat_user') required final ChatUserModel receiver,
}) = _$UsersImpl;
const factory _Users(
{@JsonKey(name: 'from_chat_user') required final ChatUserModel sender,
@JsonKey(name: 'to_chat_user')
required final ChatUserModel receiver}) = _$UsersImpl;
factory _Users.fromJson(Map<String, dynamic> json) = _$UsersImpl.fromJson;

View File

@@ -10,8 +10,7 @@ _$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map<String, dynamic> json) =>
_$ChatRoomModelImpl(
id: json['id'] as String,
chatRoomSettings: ChatRoomSettingsModel.fromJson(
json['chat_room_setting'] as Map<String, dynamic>,
),
json['chat_room_setting'] as Map<String, dynamic>),
users: Users.fromJson(json['users'] as Map<String, dynamic>),
chosenPlan: parseChosenPlan(json['chosen_plan']),
);
@@ -25,13 +24,11 @@ Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) =>
};
_$UsersImpl _$$UsersImplFromJson(Map<String, dynamic> json) => _$UsersImpl(
sender: ChatUserModel.fromJson(
json['from_chat_user'] as Map<String, dynamic>,
),
receiver: ChatUserModel.fromJson(
json['to_chat_user'] as Map<String, dynamic>,
),
);
sender: ChatUserModel.fromJson(
json['from_chat_user'] as Map<String, dynamic>),
receiver:
ChatUserModel.fromJson(json['to_chat_user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$UsersImplToJson(_$UsersImpl instance) =>
<String, dynamic>{

View File

@@ -7,25 +7,24 @@ part of 'chat_room_pagination_model.dart';
// **************************************************************************
_$ChatRoomPreviewModelImpl _$$ChatRoomPreviewModelImplFromJson(
Map<String, dynamic> json,
) => _$ChatRoomPreviewModelImpl(
chatRooms: ChatRooms.fromJson(json['chatRooms'] as Map<String, dynamic>),
unreadChatsCount: (json['number_of_unread_chat_rooms'] as num).toInt(),
);
Map<String, dynamic> json) =>
_$ChatRoomPreviewModelImpl(
chatRooms: ChatRooms.fromJson(json['chatRooms'] as Map<String, dynamic>),
unreadChatsCount: (json['number_of_unread_chat_rooms'] as num).toInt(),
);
Map<String, dynamic> _$$ChatRoomPreviewModelImplToJson(
_$ChatRoomPreviewModelImpl instance,
) => <String, dynamic>{
'chatRooms': instance.chatRooms,
'number_of_unread_chat_rooms': instance.unreadChatsCount,
};
_$ChatRoomPreviewModelImpl instance) =>
<String, dynamic>{
'chatRooms': instance.chatRooms,
'number_of_unread_chat_rooms': instance.unreadChatsCount,
};
_$ChatRoomsImpl _$$ChatRoomsImplFromJson(Map<String, dynamic> json) =>
_$ChatRoomsImpl(
data:
(json['data'] as List<dynamic>)
.map((e) => ChatRoom.fromJson(e as Map<String, dynamic>))
.toList(),
data: (json['data'] as List<dynamic>)
.map((e) => ChatRoom.fromJson(e as Map<String, dynamic>))
.toList(),
lastPage: (json['last_page'] as num).toInt(),
currentPage: (json['current_page'] as num).toInt(),
);
@@ -58,11 +57,11 @@ Map<String, dynamic> _$$ChatRoomImplToJson(_$ChatRoomImpl instance) =>
};
_$UsersImpl _$$UsersImplFromJson(Map<String, dynamic> json) => _$UsersImpl(
fromChatUser: ChatUser.fromJson(
json['from_chat_user'] as Map<String, dynamic>,
),
toChatUser: ChatUser.fromJson(json['to_chat_user'] as Map<String, dynamic>),
);
fromChatUser:
ChatUser.fromJson(json['from_chat_user'] as Map<String, dynamic>),
toChatUser:
ChatUser.fromJson(json['to_chat_user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$UsersImplToJson(_$UsersImpl instance) =>
<String, dynamic>{

View File

@@ -12,12 +12,10 @@ part of 'chat_room_settings_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(
Map<String, dynamic> json,
) {
Map<String, dynamic> json) {
return _ChatRoomSettingsModel.fromJson(json);
}
@@ -44,25 +42,21 @@ mixin _$ChatRoomSettingsModel {
/// @nodoc
abstract class $ChatRoomSettingsModelCopyWith<$Res> {
factory $ChatRoomSettingsModelCopyWith(
ChatRoomSettingsModel value,
$Res Function(ChatRoomSettingsModel) then,
) = _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>;
factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value,
$Res Function(ChatRoomSettingsModel) then) =
_$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>;
@useResult
$Res call({
int id,
@JsonKey(name: 'room_name') String roomName,
String state,
@JsonKey(name: 'access_level') String accessLevel,
@JsonKey(name: 'updated_at') String updatedAt,
});
$Res call(
{int id,
@JsonKey(name: 'room_name') String roomName,
String state,
@JsonKey(name: 'access_level') String accessLevel,
@JsonKey(name: 'updated_at') String updatedAt});
}
/// @nodoc
class _$ChatRoomSettingsModelCopyWithImpl<
$Res,
$Val extends ChatRoomSettingsModel
>
class _$ChatRoomSettingsModelCopyWithImpl<$Res,
$Val extends ChatRoomSettingsModel>
implements $ChatRoomSettingsModelCopyWith<$Res> {
_$ChatRoomSettingsModelCopyWithImpl(this._value, this._then);
@@ -82,36 +76,28 @@ class _$ChatRoomSettingsModelCopyWithImpl<
Object? accessLevel = null,
Object? updatedAt = null,
}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
roomName:
null == roomName
? _value.roomName
: roomName // ignore: cast_nullable_to_non_nullable
as String,
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
accessLevel:
null == accessLevel
? _value.accessLevel
: accessLevel // ignore: cast_nullable_to_non_nullable
as String,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
roomName: null == roomName
? _value.roomName
: roomName // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
accessLevel: null == accessLevel
? _value.accessLevel
: accessLevel // ignore: cast_nullable_to_non_nullable
as String,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
@@ -119,29 +105,27 @@ class _$ChatRoomSettingsModelCopyWithImpl<
abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res>
implements $ChatRoomSettingsModelCopyWith<$Res> {
factory _$$ChatRoomSettingsModelImplCopyWith(
_$ChatRoomSettingsModelImpl value,
$Res Function(_$ChatRoomSettingsModelImpl) then,
) = __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>;
_$ChatRoomSettingsModelImpl value,
$Res Function(_$ChatRoomSettingsModelImpl) then) =
__$$ChatRoomSettingsModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
int id,
@JsonKey(name: 'room_name') String roomName,
String state,
@JsonKey(name: 'access_level') String accessLevel,
@JsonKey(name: 'updated_at') String updatedAt,
});
$Res call(
{int id,
@JsonKey(name: 'room_name') String roomName,
String state,
@JsonKey(name: 'access_level') String accessLevel,
@JsonKey(name: 'updated_at') String updatedAt});
}
/// @nodoc
class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>
extends
_$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl>
extends _$ChatRoomSettingsModelCopyWithImpl<$Res,
_$ChatRoomSettingsModelImpl>
implements _$$ChatRoomSettingsModelImplCopyWith<$Res> {
__$$ChatRoomSettingsModelImplCopyWithImpl(
_$ChatRoomSettingsModelImpl _value,
$Res Function(_$ChatRoomSettingsModelImpl) _then,
) : super(_value, _then);
__$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value,
$Res Function(_$ChatRoomSettingsModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@@ -154,48 +138,40 @@ class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>
Object? accessLevel = null,
Object? updatedAt = null,
}) {
return _then(
_$ChatRoomSettingsModelImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
roomName:
null == roomName
? _value.roomName
: roomName // ignore: cast_nullable_to_non_nullable
as String,
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
accessLevel:
null == accessLevel
? _value.accessLevel
: accessLevel // ignore: cast_nullable_to_non_nullable
as String,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
),
);
return _then(_$ChatRoomSettingsModelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
roomName: null == roomName
? _value.roomName
: roomName // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
accessLevel: null == accessLevel
? _value.accessLevel
: accessLevel // ignore: cast_nullable_to_non_nullable
as String,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
const _$ChatRoomSettingsModelImpl({
required this.id,
@JsonKey(name: 'room_name') required this.roomName,
required this.state,
@JsonKey(name: 'access_level') required this.accessLevel,
@JsonKey(name: 'updated_at') required this.updatedAt,
});
const _$ChatRoomSettingsModelImpl(
{required this.id,
@JsonKey(name: 'room_name') required this.roomName,
required this.state,
@JsonKey(name: 'access_level') required this.accessLevel,
@JsonKey(name: 'updated_at') required this.updatedAt});
factory _$ChatRoomSettingsModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomSettingsModelImplFromJson(json);
@@ -245,26 +221,25 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
@override
@pragma('vm:prefer-inline')
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith =>
__$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>(
this,
_$identity,
);
get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl<
_$ChatRoomSettingsModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ChatRoomSettingsModelImplToJson(this);
return _$$ChatRoomSettingsModelImplToJson(
this,
);
}
}
abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel {
const factory _ChatRoomSettingsModel({
required final int id,
@JsonKey(name: 'room_name') required final String roomName,
required final String state,
@JsonKey(name: 'access_level') required final String accessLevel,
@JsonKey(name: 'updated_at') required final String updatedAt,
}) = _$ChatRoomSettingsModelImpl;
const factory _ChatRoomSettingsModel(
{required final int id,
@JsonKey(name: 'room_name') required final String roomName,
required final String state,
@JsonKey(name: 'access_level') required final String accessLevel,
@JsonKey(name: 'updated_at') required final String updatedAt}) =
_$ChatRoomSettingsModelImpl;
factory _ChatRoomSettingsModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomSettingsModelImpl.fromJson;
@@ -288,5 +263,5 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel {
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -7,21 +7,21 @@ part of 'chat_room_settings_model.dart';
// **************************************************************************
_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(
Map<String, dynamic> json,
) => _$ChatRoomSettingsModelImpl(
id: (json['id'] as num).toInt(),
roomName: json['room_name'] as String,
state: json['state'] as String,
accessLevel: json['access_level'] as String,
updatedAt: json['updated_at'] as String,
);
Map<String, dynamic> json) =>
_$ChatRoomSettingsModelImpl(
id: (json['id'] as num).toInt(),
roomName: json['room_name'] as String,
state: json['state'] as String,
accessLevel: json['access_level'] as String,
updatedAt: json['updated_at'] as String,
);
Map<String, dynamic> _$$ChatRoomSettingsModelImplToJson(
_$ChatRoomSettingsModelImpl instance,
) => <String, dynamic>{
'id': instance.id,
'room_name': instance.roomName,
'state': instance.state,
'access_level': instance.accessLevel,
'updated_at': instance.updatedAt,
};
_$ChatRoomSettingsModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'room_name': instance.roomName,
'state': instance.state,
'access_level': instance.accessLevel,
'updated_at': instance.updatedAt,
};

View File

@@ -12,8 +12,7 @@ part of 'chat_user_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ChatUserModel _$ChatUserModelFromJson(Map<String, dynamic> json) {
return _ChatUserModel.fromJson(json);
@@ -42,17 +41,15 @@ mixin _$ChatUserModel {
/// @nodoc
abstract class $ChatUserModelCopyWith<$Res> {
factory $ChatUserModelCopyWith(
ChatUserModel value,
$Res Function(ChatUserModel) then,
) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>;
ChatUserModel value, $Res Function(ChatUserModel) then) =
_$ChatUserModelCopyWithImpl<$Res, ChatUserModel>;
@useResult
$Res call({
int id,
String name,
String slug,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl,
});
$Res call(
{int id,
String name,
String slug,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
}
/// @nodoc
@@ -76,36 +73,28 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel>
Object? profilePhotoPath = freezed,
Object? profilePhotoUrl = freezed,
}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
slug:
null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
profilePhotoPath:
freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String?,
profilePhotoUrl:
freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
slug: null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
profilePhotoPath: freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String?,
profilePhotoUrl: freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
@@ -113,18 +102,16 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel>
abstract class _$$ChatUserModelImplCopyWith<$Res>
implements $ChatUserModelCopyWith<$Res> {
factory _$$ChatUserModelImplCopyWith(
_$ChatUserModelImpl value,
$Res Function(_$ChatUserModelImpl) then,
) = __$$ChatUserModelImplCopyWithImpl<$Res>;
_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) =
__$$ChatUserModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
int id,
String name,
String slug,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl,
});
$Res call(
{int id,
String name,
String slug,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
}
/// @nodoc
@@ -132,9 +119,8 @@ class __$$ChatUserModelImplCopyWithImpl<$Res>
extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl>
implements _$$ChatUserModelImplCopyWith<$Res> {
__$$ChatUserModelImplCopyWithImpl(
_$ChatUserModelImpl _value,
$Res Function(_$ChatUserModelImpl) _then,
) : super(_value, _then);
_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@@ -147,48 +133,40 @@ class __$$ChatUserModelImplCopyWithImpl<$Res>
Object? profilePhotoPath = freezed,
Object? profilePhotoUrl = freezed,
}) {
return _then(
_$ChatUserModelImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
slug:
null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
profilePhotoPath:
freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String?,
profilePhotoUrl:
freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String?,
),
);
return _then(_$ChatUserModelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
slug: null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
profilePhotoPath: freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String?,
profilePhotoUrl: freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ChatUserModelImpl implements _ChatUserModel {
const _$ChatUserModelImpl({
required this.id,
required this.name,
required this.slug,
@JsonKey(name: 'profile_photo_path') this.profilePhotoPath,
@JsonKey(name: 'profile_photo_url') this.profilePhotoUrl,
});
const _$ChatUserModelImpl(
{required this.id,
required this.name,
required this.slug,
@JsonKey(name: 'profile_photo_path') this.profilePhotoPath,
@JsonKey(name: 'profile_photo_url') this.profilePhotoUrl});
factory _$ChatUserModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatUserModelImplFromJson(json);
@@ -228,13 +206,7 @@ class _$ChatUserModelImpl implements _ChatUserModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
name,
slug,
profilePhotoPath,
profilePhotoUrl,
);
runtimeType, id, name, slug, profilePhotoPath, profilePhotoUrl);
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@@ -246,18 +218,20 @@ class _$ChatUserModelImpl implements _ChatUserModel {
@override
Map<String, dynamic> toJson() {
return _$$ChatUserModelImplToJson(this);
return _$$ChatUserModelImplToJson(
this,
);
}
}
abstract class _ChatUserModel implements ChatUserModel {
const factory _ChatUserModel({
required final int id,
required final String name,
required final String slug,
@JsonKey(name: 'profile_photo_path') final String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl,
}) = _$ChatUserModelImpl;
const factory _ChatUserModel(
{required final int id,
required final String name,
required final String slug,
@JsonKey(name: 'profile_photo_path') final String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) =
_$ChatUserModelImpl;
factory _ChatUserModel.fromJson(Map<String, dynamic> json) =
_$ChatUserModelImpl.fromJson;

View File

@@ -0,0 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'payment_model.freezed.dart';
part 'payment_model.g.dart';
@freezed
class PaymentModel with _$PaymentModel {
factory PaymentModel({
@JsonKey(name: 'checkout_url') required String paymentUrl,
}) = _PaymentModel;
factory PaymentModel.fromJson(Map<String, dynamic> json) => _$PaymentModelFromJson(json);
}

View File

@@ -0,0 +1,170 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'payment_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
PaymentModel _$PaymentModelFromJson(Map<String, dynamic> json) {
return _PaymentModel.fromJson(json);
}
/// @nodoc
mixin _$PaymentModel {
@JsonKey(name: 'checkout_url')
String get paymentUrl => throw _privateConstructorUsedError;
/// Serializes this PaymentModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of PaymentModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PaymentModelCopyWith<PaymentModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PaymentModelCopyWith<$Res> {
factory $PaymentModelCopyWith(
PaymentModel value, $Res Function(PaymentModel) then) =
_$PaymentModelCopyWithImpl<$Res, PaymentModel>;
@useResult
$Res call({@JsonKey(name: 'checkout_url') String paymentUrl});
}
/// @nodoc
class _$PaymentModelCopyWithImpl<$Res, $Val extends PaymentModel>
implements $PaymentModelCopyWith<$Res> {
_$PaymentModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PaymentModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentUrl = null,
}) {
return _then(_value.copyWith(
paymentUrl: null == paymentUrl
? _value.paymentUrl
: paymentUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$PaymentModelImplCopyWith<$Res>
implements $PaymentModelCopyWith<$Res> {
factory _$$PaymentModelImplCopyWith(
_$PaymentModelImpl value, $Res Function(_$PaymentModelImpl) then) =
__$$PaymentModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: 'checkout_url') String paymentUrl});
}
/// @nodoc
class __$$PaymentModelImplCopyWithImpl<$Res>
extends _$PaymentModelCopyWithImpl<$Res, _$PaymentModelImpl>
implements _$$PaymentModelImplCopyWith<$Res> {
__$$PaymentModelImplCopyWithImpl(
_$PaymentModelImpl _value, $Res Function(_$PaymentModelImpl) _then)
: super(_value, _then);
/// Create a copy of PaymentModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentUrl = null,
}) {
return _then(_$PaymentModelImpl(
paymentUrl: null == paymentUrl
? _value.paymentUrl
: paymentUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$PaymentModelImpl implements _PaymentModel {
_$PaymentModelImpl({@JsonKey(name: 'checkout_url') required this.paymentUrl});
factory _$PaymentModelImpl.fromJson(Map<String, dynamic> json) =>
_$$PaymentModelImplFromJson(json);
@override
@JsonKey(name: 'checkout_url')
final String paymentUrl;
@override
String toString() {
return 'PaymentModel(paymentUrl: $paymentUrl)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentModelImpl &&
(identical(other.paymentUrl, paymentUrl) ||
other.paymentUrl == paymentUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, paymentUrl);
/// Create a copy of PaymentModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PaymentModelImplCopyWith<_$PaymentModelImpl> get copyWith =>
__$$PaymentModelImplCopyWithImpl<_$PaymentModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$PaymentModelImplToJson(
this,
);
}
}
abstract class _PaymentModel implements PaymentModel {
factory _PaymentModel(
{@JsonKey(name: 'checkout_url') required final String paymentUrl}) =
_$PaymentModelImpl;
factory _PaymentModel.fromJson(Map<String, dynamic> json) =
_$PaymentModelImpl.fromJson;
@override
@JsonKey(name: 'checkout_url')
String get paymentUrl;
/// Create a copy of PaymentModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PaymentModelImplCopyWith<_$PaymentModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,17 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'payment_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$PaymentModelImpl _$$PaymentModelImplFromJson(Map<String, dynamic> json) =>
_$PaymentModelImpl(
paymentUrl: json['checkout_url'] as String,
);
Map<String, dynamic> _$$PaymentModelImplToJson(_$PaymentModelImpl instance) =>
<String, dynamic>{
'checkout_url': instance.paymentUrl,
};

View File

@@ -12,8 +12,7 @@ part of 'websocket_info_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
WebsocketInfoModel _$WebsocketInfoModelFromJson(Map<String, dynamic> json) {
return _WebsocketInfoModel.fromJson(json);
@@ -41,17 +40,15 @@ mixin _$WebsocketInfoModel {
/// @nodoc
abstract class $WebsocketInfoModelCopyWith<$Res> {
factory $WebsocketInfoModelCopyWith(
WebsocketInfoModel value,
$Res Function(WebsocketInfoModel) then,
) = _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>;
WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) =
_$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>;
@useResult
$Res call({
String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId,
});
$Res call(
{String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId});
}
/// @nodoc
@@ -75,65 +72,54 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
Object? cluster = null,
Object? userId = null,
}) {
return _then(
_value.copyWith(
key:
null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host:
null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port:
null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
cluster:
null == cluster
? _value.cluster
: cluster // ignore: cast_nullable_to_non_nullable
as String,
userId:
null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
return _then(_value.copyWith(
key: null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port: null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
cluster: null == cluster
? _value.cluster
: cluster // ignore: cast_nullable_to_non_nullable
as String,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
/// @nodoc
abstract class _$$WebsocketInfoModelImplCopyWith<$Res>
implements $WebsocketInfoModelCopyWith<$Res> {
factory _$$WebsocketInfoModelImplCopyWith(
_$WebsocketInfoModelImpl value,
$Res Function(_$WebsocketInfoModelImpl) then,
) = __$$WebsocketInfoModelImplCopyWithImpl<$Res>;
factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value,
$Res Function(_$WebsocketInfoModelImpl) then) =
__$$WebsocketInfoModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId,
});
$Res call(
{String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId});
}
/// @nodoc
class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl>
implements _$$WebsocketInfoModelImplCopyWith<$Res> {
__$$WebsocketInfoModelImplCopyWithImpl(
_$WebsocketInfoModelImpl _value,
$Res Function(_$WebsocketInfoModelImpl) _then,
) : super(_value, _then);
__$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value,
$Res Function(_$WebsocketInfoModelImpl) _then)
: super(_value, _then);
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@@ -146,48 +132,40 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
Object? cluster = null,
Object? userId = null,
}) {
return _then(
_$WebsocketInfoModelImpl(
key:
null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host:
null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port:
null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
cluster:
null == cluster
? _value.cluster
: cluster // ignore: cast_nullable_to_non_nullable
as String,
userId:
null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int,
),
);
return _then(_$WebsocketInfoModelImpl(
key: null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port: null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
cluster: null == cluster
? _value.cluster
: cluster // ignore: cast_nullable_to_non_nullable
as String,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
@JsonSerializable()
class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
const _$WebsocketInfoModelImpl({
required this.key,
required this.host,
required this.port,
required this.cluster,
@JsonKey(name: 'user_id') required this.userId,
});
const _$WebsocketInfoModelImpl(
{required this.key,
required this.host,
required this.port,
required this.cluster,
@JsonKey(name: 'user_id') required this.userId});
factory _$WebsocketInfoModelImpl.fromJson(Map<String, dynamic> json) =>
_$$WebsocketInfoModelImplFromJson(json);
@@ -233,24 +211,24 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
@pragma('vm:prefer-inline')
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
__$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$WebsocketInfoModelImplToJson(this);
return _$$WebsocketInfoModelImplToJson(
this,
);
}
}
abstract class _WebsocketInfoModel implements WebsocketInfoModel {
const factory _WebsocketInfoModel({
required final String key,
required final String host,
required final String port,
required final String cluster,
@JsonKey(name: 'user_id') required final int userId,
}) = _$WebsocketInfoModelImpl;
const factory _WebsocketInfoModel(
{required final String key,
required final String host,
required final String port,
required final String cluster,
@JsonKey(name: 'user_id') required final int userId}) =
_$WebsocketInfoModelImpl;
factory _WebsocketInfoModel.fromJson(Map<String, dynamic> json) =
_$WebsocketInfoModelImpl.fromJson;

View File

@@ -7,21 +7,21 @@ part of 'websocket_info_model.dart';
// **************************************************************************
_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(
Map<String, dynamic> json,
) => _$WebsocketInfoModelImpl(
key: json['key'] as String,
host: json['host'] as String,
port: json['port'] as String,
cluster: json['cluster'] as String,
userId: (json['user_id'] as num).toInt(),
);
Map<String, dynamic> json) =>
_$WebsocketInfoModelImpl(
key: json['key'] as String,
host: json['host'] as String,
port: json['port'] as String,
cluster: json['cluster'] as String,
userId: (json['user_id'] as num).toInt(),
);
Map<String, dynamic> _$$WebsocketInfoModelImplToJson(
_$WebsocketInfoModelImpl instance,
) => <String, dynamic>{
'key': instance.key,
'host': instance.host,
'port': instance.port,
'cluster': instance.cluster,
'user_id': instance.userId,
};
_$WebsocketInfoModelImpl instance) =>
<String, dynamic>{
'key': instance.key,
'host': instance.host,
'port': instance.port,
'cluster': instance.cluster,
'user_id': instance.userId,
};

View File

@@ -7,12 +7,14 @@ import 'package:audioplayers/audioplayers.dart';
import 'package:dart_pusher_channels/dart_pusher_channels.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart';
import 'package:eatvio_app/core/utils/date_time_utils.dart';
import 'package:eatvio_app/core/websockets/ws_manager.dart';
import 'package:eatvio_app/features/chat/models/chat_message_model.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
import 'package:eatvio_app/features/my_finance/models/card_model.dart';
import 'package:eatvio_app/features/my_finance/repositories/cards_repository.dart';
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class ChatRoomCubit extends Cubit<ChatRoomState> {
@@ -23,10 +25,10 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
StreamSubscription<ChannelReadEvent>? typingSubscription;
StreamSubscription<ChannelReadEvent>? messagesSubscription;
int currentPage = 1;
late final int lastPage;
late int lastPage;
bool isLoading = false;
ChatRoomCubit({required this.chatRepository, required this.wsManager, required this.cardsRepository}) : super(ChatRoomState.loading());
ChatRoomCubit({required this.chatRepository, required this.wsManager, required this.cardsRepository}) : super(const ChatRoomState.loading());
loadNextPage(String chatId) async {
if (currentPage < lastPage && !isLoading) {
@@ -47,7 +49,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
currentPage++;
} catch (e) {
emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
}
}
}
@@ -57,7 +59,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
final cards = await cardsRepository.getCards();
setCard(cards: cards);
} catch (e) {
emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
}
}
@@ -80,13 +82,29 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
await _subscribeToChatChannel(chatId: chatId);
emit(ChatRoomState.loaded(chatRoom: chatRoom, chatMessages: chatMessages.messagesList, isTyping: false, isLoading: isLoading, hasCard: false));
final cards = await cardsRepository.getCards();
setCard(cards: cards);
// final cards = await cardsRepository.getCards();
// setCard(cards: cards);
} catch (e) {
log(e.toString());
typingSubscription?.cancel();
messagesSubscription?.cancel();
wsManager.unsubscribeDirectChatChannel();
emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
}
}
Future<bool> choseStartPlanDate(DateTime date) async {
try {
if (state is! ChatRoomStateLoaded) return false;
final planId = (state as ChatRoomStateLoaded).chatRoom.chosenPlan?.id;
if (planId == null) return false;
final stringDate = date.format('yyyy-MM-dd');
await chatRepository.choseStartPlanDate(id: planId, date: {'start_date': stringDate});
emit((state as ChatRoomStateLoaded).copyWith.chatRoom.chosenPlan?.call(chosenPlanState: ChosenPlanStateEnum.stateStartDateHasBeenSet) ?? state);
return true;
} catch (e, st) {
log(e.toString(), stackTrace: st);
return false;
}
}
@@ -96,7 +114,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
final chatRoom = await chatRepository.getChatRoom(chatId);
emit((state as ChatRoomStateLoaded).copyWith(chatRoom: chatRoom));
} catch (e) {
emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
}
}
@@ -115,7 +133,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
typingSubscription = wsManager.clientTypingStream?.listen((event) {
emit((state as ChatRoomStateLoaded).copyWith(isTyping: true, isLoading: isLoading));
EasyDebounce.debounce('client-typing', Duration(seconds: 3), () => emit((state as ChatRoomStateLoaded).copyWith(isTyping: false, isLoading: isLoading)));
EasyDebounce.debounce('client-typing', const Duration(seconds: 3), () => emit((state as ChatRoomStateLoaded).copyWith(isTyping: false, isLoading: isLoading)));
});
}
@@ -136,9 +154,9 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
final ids = messagesIds.map((e) => e.id).toList();
await chatRepository.markMessagesAsRead(chatId, ids);
final currentMessages = [...(state as ChatRoomStateLoaded).chatMessages];
messagesIds.forEach((elem) {
for (var elem in messagesIds) {
currentMessages[elem.index] = currentMessages[elem.index].copyWith(isRead: true);
});
}
if (!isClosed) {
emit((state as ChatRoomStateLoaded).copyWith(chatMessages: currentMessages));
}
@@ -151,6 +169,18 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
}
}
Future<String?> getPaymentLink() async {
try {
final planId = (state as ChatRoomStateLoaded).chatRoom.chosenPlan?.id;
if (planId == null) return null;
final paymentModel = await chatRepository.getPaymentLink(id: planId);
return paymentModel.paymentUrl;
} catch (e, st) {
log(e.toString(), stackTrace: st);
return null;
}
}
@override
Future<void> close() async {
wsManager.unsubscribeDirectChatChannel();

View File

@@ -12,8 +12,7 @@ part of 'chat_room_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ChatRoomState {
@@ -22,58 +21,60 @@ mixin _$ChatRoomState {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ChatRoomState value) $default, {
required TResult Function(ChatRoomStateLoading value) loading,
required TResult Function(ChatRoomStateLoaded value) loaded,
required TResult Function(ChatRoomStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ChatRoomState value)? $default, {
TResult? Function(ChatRoomStateLoading value)? loading,
TResult? Function(ChatRoomStateLoaded value)? loaded,
TResult? Function(ChatRoomStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ChatRoomState value)? $default, {
@@ -81,15 +82,15 @@ mixin _$ChatRoomState {
TResult Function(ChatRoomStateLoaded value)? loaded,
TResult Function(ChatRoomStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatRoomStateCopyWith<$Res> {
factory $ChatRoomStateCopyWith(
ChatRoomState value,
$Res Function(ChatRoomState) then,
) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>;
ChatRoomState value, $Res Function(ChatRoomState) then) =
_$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>;
}
/// @nodoc
@@ -109,9 +110,8 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState>
/// @nodoc
abstract class _$$ChatRoomStateImplCopyWith<$Res> {
factory _$$ChatRoomStateImplCopyWith(
_$ChatRoomStateImpl value,
$Res Function(_$ChatRoomStateImpl) then,
) = __$$ChatRoomStateImplCopyWithImpl<$Res>;
_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) =
__$$ChatRoomStateImplCopyWithImpl<$Res>;
}
/// @nodoc
@@ -119,9 +119,8 @@ class __$$ChatRoomStateImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl>
implements _$$ChatRoomStateImplCopyWith<$Res> {
__$$ChatRoomStateImplCopyWithImpl(
_$ChatRoomStateImpl _value,
$Res Function(_$ChatRoomStateImpl) _then,
) : super(_value, _then);
_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@@ -152,13 +151,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -170,13 +168,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -188,13 +185,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -248,20 +244,18 @@ abstract class _ChatRoomState implements ChatRoomState {
/// @nodoc
abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> {
factory _$$ChatRoomStateLoadingImplCopyWith(
_$ChatRoomStateLoadingImpl value,
$Res Function(_$ChatRoomStateLoadingImpl) then,
) = __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>;
factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value,
$Res Function(_$ChatRoomStateLoadingImpl) then) =
__$$ChatRoomStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl>
implements _$$ChatRoomStateLoadingImplCopyWith<$Res> {
__$$ChatRoomStateLoadingImplCopyWithImpl(
_$ChatRoomStateLoadingImpl _value,
$Res Function(_$ChatRoomStateLoadingImpl) _then,
) : super(_value, _then);
__$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value,
$Res Function(_$ChatRoomStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@@ -293,13 +287,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loading();
@@ -311,13 +304,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loading?.call();
@@ -329,13 +321,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -389,18 +380,16 @@ abstract class ChatRoomStateLoading implements ChatRoomState {
/// @nodoc
abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> {
factory _$$ChatRoomStateLoadedImplCopyWith(
_$ChatRoomStateLoadedImpl value,
$Res Function(_$ChatRoomStateLoadedImpl) then,
) = __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>;
factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value,
$Res Function(_$ChatRoomStateLoadedImpl) then) =
__$$ChatRoomStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
});
$Res call(
{ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading});
$ChatRoomModelCopyWith<$Res> get chatRoom;
}
@@ -409,10 +398,9 @@ abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> {
class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl>
implements _$$ChatRoomStateLoadedImplCopyWith<$Res> {
__$$ChatRoomStateLoadedImplCopyWithImpl(
_$ChatRoomStateLoadedImpl _value,
$Res Function(_$ChatRoomStateLoadedImpl) _then,
) : super(_value, _then);
__$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value,
$Res Function(_$ChatRoomStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@@ -425,35 +413,28 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
Object? isTyping = null,
Object? isLoading = null,
}) {
return _then(
_$ChatRoomStateLoadedImpl(
chatRoom:
null == chatRoom
? _value.chatRoom
: chatRoom // ignore: cast_nullable_to_non_nullable
as ChatRoomModel,
chatMessages:
null == chatMessages
? _value._chatMessages
: chatMessages // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
hasCard:
null == hasCard
? _value.hasCard
: hasCard // ignore: cast_nullable_to_non_nullable
as bool,
isTyping:
null == isTyping
? _value.isTyping
: isTyping // ignore: cast_nullable_to_non_nullable
as bool,
isLoading:
null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
),
);
return _then(_$ChatRoomStateLoadedImpl(
chatRoom: null == chatRoom
? _value.chatRoom
: chatRoom // ignore: cast_nullable_to_non_nullable
as ChatRoomModel,
chatMessages: null == chatMessages
? _value._chatMessages
: chatMessages // ignore: cast_nullable_to_non_nullable
as List<ChatMessageModel>,
hasCard: null == hasCard
? _value.hasCard
: hasCard // ignore: cast_nullable_to_non_nullable
as bool,
isTyping: null == isTyping
? _value.isTyping
: isTyping // ignore: cast_nullable_to_non_nullable
as bool,
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of ChatRoomState
@@ -470,13 +451,13 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
/// @nodoc
class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
const _$ChatRoomStateLoadedImpl({
required this.chatRoom,
required final List<ChatMessageModel> chatMessages,
required this.hasCard,
required this.isTyping,
required this.isLoading,
}) : _chatMessages = chatMessages;
const _$ChatRoomStateLoadedImpl(
{required this.chatRoom,
required final List<ChatMessageModel> chatMessages,
required this.hasCard,
required this.isTyping,
required this.isLoading})
: _chatMessages = chatMessages;
@override
final ChatRoomModel chatRoom;
@@ -507,10 +488,8 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
other is _$ChatRoomStateLoadedImpl &&
(identical(other.chatRoom, chatRoom) ||
other.chatRoom == chatRoom) &&
const DeepCollectionEquality().equals(
other._chatMessages,
_chatMessages,
) &&
const DeepCollectionEquality()
.equals(other._chatMessages, _chatMessages) &&
(identical(other.hasCard, hasCard) || other.hasCard == hasCard) &&
(identical(other.isTyping, isTyping) ||
other.isTyping == isTyping) &&
@@ -520,13 +499,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
@override
int get hashCode => Object.hash(
runtimeType,
chatRoom,
const DeepCollectionEquality().hash(_chatMessages),
hasCard,
isTyping,
isLoading,
);
runtimeType,
chatRoom,
const DeepCollectionEquality().hash(_chatMessages),
hasCard,
isTyping,
isLoading);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@@ -535,9 +513,7 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
@pragma('vm:prefer-inline')
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
__$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -545,13 +521,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(chatRoom, chatMessages, hasCard, isTyping, isLoading);
@@ -563,13 +538,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(chatRoom, chatMessages, hasCard, isTyping, isLoading);
@@ -581,13 +555,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -636,13 +609,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
}
abstract class ChatRoomStateLoaded implements ChatRoomState {
const factory ChatRoomStateLoaded({
required final ChatRoomModel chatRoom,
required final List<ChatMessageModel> chatMessages,
required final bool hasCard,
required final bool isTyping,
required final bool isLoading,
}) = _$ChatRoomStateLoadedImpl;
const factory ChatRoomStateLoaded(
{required final ChatRoomModel chatRoom,
required final List<ChatMessageModel> chatMessages,
required final bool hasCard,
required final bool isTyping,
required final bool isLoading}) = _$ChatRoomStateLoadedImpl;
ChatRoomModel get chatRoom;
List<ChatMessageModel> get chatMessages;
@@ -659,10 +631,9 @@ abstract class ChatRoomStateLoaded implements ChatRoomState {
/// @nodoc
abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> {
factory _$$ChatRoomStateErrorImplCopyWith(
_$ChatRoomStateErrorImpl value,
$Res Function(_$ChatRoomStateErrorImpl) then,
) = __$$ChatRoomStateErrorImplCopyWithImpl<$Res>;
factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value,
$Res Function(_$ChatRoomStateErrorImpl) then) =
__$$ChatRoomStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
@@ -671,25 +642,23 @@ abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> {
class __$$ChatRoomStateErrorImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl>
implements _$$ChatRoomStateErrorImplCopyWith<$Res> {
__$$ChatRoomStateErrorImplCopyWithImpl(
_$ChatRoomStateErrorImpl _value,
$Res Function(_$ChatRoomStateErrorImpl) _then,
) : super(_value, _then);
__$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value,
$Res Function(_$ChatRoomStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$ChatRoomStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$ChatRoomStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -725,9 +694,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
@pragma('vm:prefer-inline')
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
__$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -735,13 +702,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -753,13 +719,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -771,13 +736,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading,
)?
loaded,
ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool hasCard,
bool isTyping,
bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {

View File

@@ -12,8 +12,7 @@ part of 'chats_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ChatsState {
@@ -33,17 +32,15 @@ mixin _$ChatsState {
/// @nodoc
abstract class $ChatsStateCopyWith<$Res> {
factory $ChatsStateCopyWith(
ChatsState value,
$Res Function(ChatsState) then,
) = _$ChatsStateCopyWithImpl<$Res, ChatsState>;
ChatsState value, $Res Function(ChatsState) then) =
_$ChatsStateCopyWithImpl<$Res, ChatsState>;
@useResult
$Res call({
BaseState state,
int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage,
});
$Res call(
{BaseState state,
int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage});
}
/// @nodoc
@@ -67,36 +64,28 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState>
Object? isLoadingMoreChats = null,
Object? errorMessage = freezed,
}) {
return _then(
_value.copyWith(
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as BaseState,
chatsWithUnreadMessagesCount:
null == chatsWithUnreadMessagesCount
? _value.chatsWithUnreadMessagesCount
: chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int,
chatRooms:
null == chatRooms
? _value.chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
isLoadingMoreChats:
null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage:
freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
return _then(_value.copyWith(
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as BaseState,
chatsWithUnreadMessagesCount: null == chatsWithUnreadMessagesCount
? _value.chatsWithUnreadMessagesCount
: chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int,
chatRooms: null == chatRooms
? _value.chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
isLoadingMoreChats: null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
@@ -104,18 +93,16 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState>
abstract class _$$ChatsStateImplCopyWith<$Res>
implements $ChatsStateCopyWith<$Res> {
factory _$$ChatsStateImplCopyWith(
_$ChatsStateImpl value,
$Res Function(_$ChatsStateImpl) then,
) = __$$ChatsStateImplCopyWithImpl<$Res>;
_$ChatsStateImpl value, $Res Function(_$ChatsStateImpl) then) =
__$$ChatsStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
BaseState state,
int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage,
});
$Res call(
{BaseState state,
int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage});
}
/// @nodoc
@@ -123,9 +110,8 @@ class __$$ChatsStateImplCopyWithImpl<$Res>
extends _$ChatsStateCopyWithImpl<$Res, _$ChatsStateImpl>
implements _$$ChatsStateImplCopyWith<$Res> {
__$$ChatsStateImplCopyWithImpl(
_$ChatsStateImpl _value,
$Res Function(_$ChatsStateImpl) _then,
) : super(_value, _then);
_$ChatsStateImpl _value, $Res Function(_$ChatsStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatsState
/// with the given fields replaced by the non-null parameter values.
@@ -138,48 +124,41 @@ class __$$ChatsStateImplCopyWithImpl<$Res>
Object? isLoadingMoreChats = null,
Object? errorMessage = freezed,
}) {
return _then(
_$ChatsStateImpl(
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as BaseState,
chatsWithUnreadMessagesCount:
null == chatsWithUnreadMessagesCount
? _value.chatsWithUnreadMessagesCount
: chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int,
chatRooms:
null == chatRooms
? _value._chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
isLoadingMoreChats:
null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage:
freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
),
);
return _then(_$ChatsStateImpl(
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as BaseState,
chatsWithUnreadMessagesCount: null == chatsWithUnreadMessagesCount
? _value.chatsWithUnreadMessagesCount
: chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int,
chatRooms: null == chatRooms
? _value._chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
isLoadingMoreChats: null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$ChatsStateImpl implements _ChatsState {
_$ChatsStateImpl({
this.state = BaseState.initial,
this.chatsWithUnreadMessagesCount = 0,
final List<ChatRoom> chatRooms = const [],
this.isLoadingMoreChats = false,
this.errorMessage = null,
}) : _chatRooms = chatRooms;
_$ChatsStateImpl(
{this.state = BaseState.initial,
this.chatsWithUnreadMessagesCount = 0,
final List<ChatRoom> chatRooms = const [],
this.isLoadingMoreChats = false,
this.errorMessage = null})
: _chatRooms = chatRooms;
@override
@JsonKey()
@@ -214,16 +193,12 @@ class _$ChatsStateImpl implements _ChatsState {
(other.runtimeType == runtimeType &&
other is _$ChatsStateImpl &&
(identical(other.state, state) || other.state == state) &&
(identical(
other.chatsWithUnreadMessagesCount,
chatsWithUnreadMessagesCount,
) ||
(identical(other.chatsWithUnreadMessagesCount,
chatsWithUnreadMessagesCount) ||
other.chatsWithUnreadMessagesCount ==
chatsWithUnreadMessagesCount) &&
const DeepCollectionEquality().equals(
other._chatRooms,
_chatRooms,
) &&
const DeepCollectionEquality()
.equals(other._chatRooms, _chatRooms) &&
(identical(other.isLoadingMoreChats, isLoadingMoreChats) ||
other.isLoadingMoreChats == isLoadingMoreChats) &&
(identical(other.errorMessage, errorMessage) ||
@@ -232,13 +207,12 @@ class _$ChatsStateImpl implements _ChatsState {
@override
int get hashCode => Object.hash(
runtimeType,
state,
chatsWithUnreadMessagesCount,
const DeepCollectionEquality().hash(_chatRooms),
isLoadingMoreChats,
errorMessage,
);
runtimeType,
state,
chatsWithUnreadMessagesCount,
const DeepCollectionEquality().hash(_chatRooms),
isLoadingMoreChats,
errorMessage);
/// Create a copy of ChatsState
/// with the given fields replaced by the non-null parameter values.
@@ -250,13 +224,12 @@ class _$ChatsStateImpl implements _ChatsState {
}
abstract class _ChatsState implements ChatsState {
factory _ChatsState({
final BaseState state,
final int chatsWithUnreadMessagesCount,
final List<ChatRoom> chatRooms,
final bool isLoadingMoreChats,
final String? errorMessage,
}) = _$ChatsStateImpl;
factory _ChatsState(
{final BaseState state,
final int chatsWithUnreadMessagesCount,
final List<ChatRoom> chatRooms,
final bool isLoadingMoreChats,
final String? errorMessage}) = _$ChatsStateImpl;
@override
BaseState get state;

View File

@@ -16,6 +16,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/notification_banner.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/order_card.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart';
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart';
import 'package:eatvio_app/generated/l10n.dart';
@@ -62,6 +63,7 @@ class _ChatScreenState extends State<ChatScreen> {
super.dispose();
}
@override
Widget build(BuildContext context) {
return BlocProvider<ChatRoomCubit>(
create: (BuildContext context) => chatRoomCubit,
@@ -73,7 +75,7 @@ class _ChatScreenState extends State<ChatScreen> {
} else if (state is ChatRoomStateError) {
return Scaffold(appBar: AppBar(), body: DataErrorWidget(onReload: () => chatRoomCubit.initChat(widget.chatId)));
} else {
return Scaffold(body: const Loader());
return const Scaffold(body: Loader());
}
},
),
@@ -85,11 +87,13 @@ class _ChatScreenState extends State<ChatScreen> {
final amIConsultant = chosenPlan?.consultantId == state.chatRoom.users.sender.id;
final showAboutOrderButton = showableChatBadgeStates.contains(chosenPlan?.chosenPlanState);
BannerType? bannerType;
if (amIConsultant && !state.hasCard) {
if (amIConsultant && state.hasCard) {
bannerType = BannerType.card;
} else if (amIConsultant && chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateInCoordination) {
bannerType = BannerType.date;
} else if (!amIConsultant && chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateStartDateHasBeenSet) {
} else if (!amIConsultant &&
(chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateStartDateHasBeenSet ||
chosenPlan?.chosenPlanState == ChosenPlanStateEnum.statePendingPayment)) {
bannerType = BannerType.payment;
}
return Scaffold(
@@ -122,20 +126,20 @@ class _ChatScreenState extends State<ChatScreen> {
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Color(0xFFEBF4FF),
shape: BoxShape.circle,
),
child: Text(
state.chatRoom.users.receiver.name.split(' ').first[0] + state.chatRoom.users.receiver.name.split(' ')[1][0],
style: TextStyle(
style: const TextStyle(
color: Color(0xFF7F9CF5),
fontWeight: FontWeight.w400,
fontSize: 20,
),
),
),
SizedBox(width: 16),
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -154,7 +158,7 @@ class _ChatScreenState extends State<ChatScreen> {
secondCurve: Curves.easeOut,
secondChild: const SizedBox.shrink(),
crossFadeState: state.isTyping ? CrossFadeState.showFirst : CrossFadeState.showSecond,
duration: Duration(milliseconds: 150),
duration: const Duration(milliseconds: 150),
),
],
),
@@ -173,19 +177,19 @@ class _ChatScreenState extends State<ChatScreen> {
color: appTheme.whiteA700,
width: double.maxFinite,
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
physics: const BouncingScrollPhysics(),
controller: scrollController,
reverse: true,
child: Column(
children: [
SizedBox(height: 16),
const SizedBox(height: 16),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
reverse: true,
shrinkWrap: true,
itemBuilder: (context, index) {
if (index == state.chatMessages.length) {
return Padding(padding: const EdgeInsets.all(8), child: const Loader());
return const Padding(padding: EdgeInsets.all(8), child: Loader());
}
if ((index + 1 != state.chatMessages.length &&
@@ -200,13 +204,14 @@ class _ChatScreenState extends State<ChatScreen> {
onVisibilityChanged: (VisibilityInfo info) {
if (!state.chatMessages[index].isRead && !isCurrentUserAuthor && info.visibleFraction > 0) {
unreadMessagesIdsCopy.add((id: state.chatMessages[index].id, index: index));
EasyDebounce.debounce('mark_as_read', Duration(milliseconds: 500), () async {
EasyDebounce.debounce('mark_as_read', const Duration(milliseconds: 500), () async {
final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIdsCopy);
if (!result) return;
if (!context.mounted) return;
context.read<ChatsCubit>().reduceUnreadMessagesCount(
chatId: state.chatRoom.id,
count: unreadMessagesIdsCopy.length,
);
chatId: state.chatRoom.id,
count: unreadMessagesIdsCopy.length,
);
unreadMessagesIdsCopy.clear();
});
}
@@ -228,9 +233,10 @@ class _ChatScreenState extends State<ChatScreen> {
onVisibilityChanged: (VisibilityInfo info) {
if (!state.chatMessages[index].isRead && !isCurrentUserAuthor && info.visibleFraction > 0) {
unreadMessagesIds.add((id: state.chatMessages[index].id, index: index));
EasyDebounce.debounce('mark_as_read', Duration(milliseconds: 500), () async {
EasyDebounce.debounce('mark_as_read', const Duration(milliseconds: 500), () async {
final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIds);
if (!result) return;
if (!context.mounted) return;
context.read<ChatsCubit>().reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIds.length);
unreadMessagesIds.clear();
});
@@ -247,7 +253,7 @@ class _ChatScreenState extends State<ChatScreen> {
},
itemCount: state.chatMessages.length + (state.isLoading ? 1 : 0),
),
SizedBox(height: 16),
const SizedBox(height: 16),
if (chosenPlan != null) ...[
OrderCard(
plan: chosenPlan.plan,
@@ -257,15 +263,15 @@ class _ChatScreenState extends State<ChatScreen> {
await context.read<ChatRoomCubit>().cancelChosenPlan(chatId: state.chatRoom.id, planId: chosenPlan.id);
},
),
if (amIConsultant) ...[
if (amIConsultant)
Padding(
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: CustomOutlinedButton(
text: S.current.user_info,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () async {
@@ -273,9 +279,8 @@ class _ChatScreenState extends State<ChatScreen> {
},
),
),
if (bannerType != null)
Padding(padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: NotificationBanner(bannerType: bannerType)),
],
if (bannerType != null)
Padding(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: NotificationBanner(bannerType: bannerType)),
],
],
),
@@ -283,11 +288,11 @@ class _ChatScreenState extends State<ChatScreen> {
),
),
Container(
padding: EdgeInsets.symmetric(vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width: 8),
const SizedBox(width: 8),
InkWell(
onTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
@@ -320,14 +325,14 @@ class _ChatScreenState extends State<ChatScreen> {
await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files);
}
},
customBorder: CircleBorder(),
customBorder: const CircleBorder(),
child: Ink(
height: 40,
width: 40,
child: Transform.rotate(angle: pi / 4, child: Icon(Icons.attach_file_rounded, size: 30, color: Color(0xFF858E99))),
child: Transform.rotate(angle: pi / 4, child: const Icon(Icons.attach_file_rounded, size: 30, color: Color(0xFF858E99))),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(
child: SizedBox(
height: 40,
@@ -338,29 +343,29 @@ class _ChatScreenState extends State<ChatScreen> {
maxLines: null,
minLines: null,
keyboardType: TextInputType.multiline,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
hintText: 'Сообщение',
hintStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, height: 1, color: Color(0xFFAEAEB2)),
hintStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, height: 1, color: Color(0xFFAEAEB2)),
filled: true,
border: OutlineInputBorder(borderRadius: BorderRadius.circular(100), borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1)),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(100), borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1),
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1),
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
),
),
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
InkWell(
customBorder: CircleBorder(),
customBorder: const CircleBorder(),
onTap: () {
if (textEditingController.text.isNotEmpty) {
chatRoomCubit.sendMessage(chatId: widget.chatId, data: textEditingController.text.trim());
@@ -373,16 +378,25 @@ class _ChatScreenState extends State<ChatScreen> {
decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle),
height: 40,
width: 40,
child: Icon(Icons.arrow_upward_rounded, size: 24, color: Colors.white),
child: const Icon(Icons.arrow_upward_rounded, size: 24, color: Colors.white),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
],
),
),
],
),
if (showAboutOrderButton) Positioned(top: 8, right: 15, left: 16, child: AboutOrderButton()),
if (showAboutOrderButton)
Positioned(
top: 8,
right: 15,
left: 16,
child: AboutOrderButton(
onTap: () {
GoRouter.of(context).push(InfoByOrderScreen.path, extra: state.chatRoom.chosenPlan);
},
)),
],
),
),

View File

@@ -11,7 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class ChatsScreen extends StatefulWidget {
const ChatsScreen({Key? key}) : super(key: key);
const ChatsScreen({super.key});
@override
State<ChatsScreen> createState() => _ChatsScreenState();
@@ -20,6 +20,7 @@ class ChatsScreen extends StatefulWidget {
class _ChatsScreenState extends State<ChatsScreen> {
final searchController = TextEditingController();
@override
Widget build(BuildContext context) {
return BlocBuilder<ChatsCubit, ChatsState>(
builder: (context, state) {
@@ -47,7 +48,7 @@ class _ChatsScreenState extends State<ChatsScreen> {
if (query.length > 2) {
EasyDebounce.debounce(
'searchChatRoom',
Duration(milliseconds: 300),
const Duration(milliseconds: 300),
() => context.read<ChatsCubit>().getChatRooms(query: query),
);
} else {
@@ -55,9 +56,9 @@ class _ChatsScreenState extends State<ChatsScreen> {
}
},
controller: searchController,
fillColor: Color(0xFFF0F2F5),
fillColor: const Color(0xFFF0F2F5),
hintText: "Поиск",
hintStyle: TextStyle(
hintStyle: const TextStyle(
color: Color(0xFF7B8794),
),
),
@@ -84,18 +85,18 @@ class _ChatsScreenState extends State<ChatsScreen> {
return false;
},
child: ListView.separated(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return SizedBox(
return const SizedBox(
height: 8,
);
},
itemCount: state.isLoadingMoreChats ? state.chatRooms.length + 1 : state.chatRooms.length,
itemBuilder: (context, index) {
if (index == state.chatRooms.length) {
return Center(child: Loader());
return const Center(child: Loader());
}
return ChatEntryWidget(chatRoom: state.chatRooms[index]);
},

View File

@@ -0,0 +1,49 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class PaymentScreen extends StatefulWidget {
static const name = 'paymentScreen';
static const path = '/payment-screen';
final String url;
const PaymentScreen({super.key, required this.url});
@override
State<PaymentScreen> createState() => _PaymentScreenState();
}
class _PaymentScreenState extends State<PaymentScreen> {
late final WebViewController _controller;
@override
void initState() {
super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onHttpError: (HttpResponseError error) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
log(request.url);
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse(widget.url));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: WebViewWidget(
controller: _controller,
),
);
}
}

View File

@@ -27,7 +27,7 @@ class PhotoViewScreen extends StatefulWidget {
}
class _PhotoViewScreenState extends State<PhotoViewScreen> {
late final pageController;
late final PageController pageController;
int imageIndex = 0;
@override
@@ -45,7 +45,7 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
direction: DismissiblePageDismissDirection.vertical,
isFullScreen: true,
child: PhotoViewGallery.builder(
backgroundDecoration: BoxDecoration(
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
scrollPhysics: const BouncingScrollPhysics(),
@@ -71,29 +71,29 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
child: Column(
children: [
const SizedBox(height: 32),
Text('Файл'),
const Text('Файл'),
const SizedBox(height: 8),
ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusStyle.circleBorder17,
),
contentPadding: EdgeInsets.all(16),
contentPadding: const EdgeInsets.all(16),
onTap: () async {
if (!await launchUrl(Uri.parse(widget.imageUrls[index]))) {
throw Exception('Could not launch ${widget.imageUrls[index]}');
}
},
leading: Icon(
leading: const Icon(
Icons.file_copy_outlined,
color: Colors.white,
),
trailing: Icon(
trailing: const Icon(
Icons.download_outlined,
color: Colors.white,
),
title: Text(
widget.imageUrls[index].replaceAll(baseUrl + '/storage/' + 'chat_files/', ''),
style: TextStyle(
widget.imageUrls[index].replaceAll('$baseUrl/storage/chat_files/', ''),
style: const TextStyle(
color: Colors.white,
fontSize: 12,
),
@@ -108,7 +108,7 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
},
itemCount: widget.imageUrls.length,
loadingBuilder: (context, event) => Center(
child: Container(
child: SizedBox(
width: 20.0,
height: 20.0,
child: CircularProgressIndicator(

View File

@@ -5,12 +5,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class AboutOrderButton extends StatelessWidget {
const AboutOrderButton({super.key});
const AboutOrderButton({super.key, required this.onTap});
final void Function() onTap;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {},
onTap: onTap,
child: Container(
height: 44,
decoration: BoxDecoration(
@@ -20,13 +20,13 @@ class AboutOrderButton extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox.shrink(),
const SizedBox.shrink(),
Text(
S.current.more_about_order,
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
),
Container(
margin: EdgeInsets.only(right: 4),
margin: const EdgeInsets.only(right: 4),
width: 36,
height: 36,
decoration: BoxDecoration(

View File

@@ -27,7 +27,7 @@ class ChatBubbleWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final size = MediaQuery.sizeOf(context);
return Container(
return SizedBox(
width: size.width,
child: Padding(
padding: EdgeInsets.fromLTRB(isCurrentUser ? 64 : 16, 10, isCurrentUser ? 16 : 64, 4),
@@ -41,7 +41,7 @@ class ChatBubbleWidget extends StatelessWidget {
padding: const EdgeInsets.only(right: 4, bottom: 4),
child: Text(
sendTime.format('hh:mm'),
style: TextStyle(
style: const TextStyle(
color: Color(0xFF7B8794),
height: 1,
fontSize: 10,
@@ -52,16 +52,16 @@ class ChatBubbleWidget extends StatelessWidget {
constraints: BoxConstraints(maxWidth: size.width * 0.7),
decoration: BoxDecoration(
color: isCurrentUser ? appTheme.gray50 : appTheme.gray60004,
borderRadius: mediaData.length > 0
borderRadius: mediaData.isNotEmpty
? BorderRadius.circular(24)
: BorderRadius.horizontal(
left: isCurrentUser ? Radius.circular(32) : Radius.circular(16),
right: isCurrentUser ? Radius.circular(16) : Radius.circular(24),
left: isCurrentUser ? const Radius.circular(32) : const Radius.circular(16),
right: isCurrentUser ? const Radius.circular(16) : const Radius.circular(24),
),
),
child: Padding(
padding:
mediaData.isNotEmpty ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16),
mediaData.isNotEmpty ? const EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16),
child: Column(
crossAxisAlignment: isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
@@ -70,7 +70,7 @@ class ChatBubbleWidget extends StatelessWidget {
width: size.width * 0.7,
child: CustomScrollView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
slivers: [
SliverList.separated(
itemBuilder: (BuildContext context, int index) {
@@ -78,25 +78,25 @@ class ChatBubbleWidget extends StatelessWidget {
!mediaData[index].toString().contains('.jpg') &&
!mediaData[index].toString().contains('.jpeg')) {
return ListTile(
contentPadding: EdgeInsets.all(4),
contentPadding: const EdgeInsets.all(4),
horizontalTitleGap: 8,
onTap: () async {
if (!await launchUrl(Uri.parse(baseUrl + '/storage/' + mediaData[index].toString()))) {
if (!await launchUrl(Uri.parse('$baseUrl/storage/${mediaData[index]}'))) {
throw Exception('Could not launch ${mediaData[index].toString()}');
}
},
leading: Icon(
leading: const Icon(
Icons.file_copy_outlined,
color: Colors.white,
),
trailing: Icon(
trailing: const Icon(
Icons.download_outlined,
color: Colors.white,
),
title: Text(
mediaData[index].toString().replaceAll('chat_files/', ''),
maxLines: 2,
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 12,
overflow: TextOverflow.ellipsis,
@@ -108,18 +108,18 @@ class ChatBubbleWidget extends StatelessWidget {
onTap: () {
context.pushTransparentRoute(
PhotoViewScreen(
imageUrls: mediaData.map((e) => baseUrl + '/storage/' + e.toString()).toList(),
imageUrls: mediaData.map((e) => '$baseUrl/storage/$e').toList(),
index: index,
),
);
},
child: Hero(
tag: baseUrl + '/storage/' + '${mediaData[index]}',
tag: '$baseUrl/storage/${mediaData[index]}',
transitionOnUserGestures: true,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + '${mediaData[index]}',
imageUrl: '$baseUrl/storage/${mediaData[index]}',
),
),
),
@@ -131,7 +131,7 @@ class ChatBubbleWidget extends StatelessWidget {
],
),
),
if (mediaData.isNotEmpty && text.isNotEmpty) SizedBox(height: 8),
if (mediaData.isNotEmpty && text.isNotEmpty) const SizedBox(height: 8),
if (text.isNotEmpty)
Text(
text,
@@ -146,7 +146,7 @@ class ChatBubbleWidget extends StatelessWidget {
padding: const EdgeInsets.only(left: 4, bottom: 4),
child: Text(
sendTime.format('hh:mm'),
style: TextStyle(
style: const TextStyle(
color: Color(0xFF7B8794),
height: 1,
fontSize: 10,

View File

@@ -8,7 +8,7 @@ import 'package:go_router/go_router.dart';
class ChatEntryWidget extends StatefulWidget {
final ChatRoom chatRoom;
ChatEntryWidget({
const ChatEntryWidget({
required this.chatRoom,
super.key,
});
@@ -29,10 +29,10 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
},
),
child: Ink(
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Color(0xFFF6FAFF),
color: const Color(0xFFF6FAFF),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -52,10 +52,10 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
Text(
widget.chatRoom.users.toChatUser.name.length <= 20
? widget.chatRoom.users.toChatUser.name
: widget.chatRoom.users.toChatUser.name.substring(0, 20) + '...',
: '${widget.chatRoom.users.toChatUser.name.substring(0, 20)}...',
style: theme.textTheme.titleMedium,
),
SizedBox(height: 8),
const SizedBox(height: 8),
if (widget.chatRoom.lastMessage != null)
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.5,
@@ -68,22 +68,22 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
),
],
),
Spacer(),
const Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
if (widget.chatRoom.lastMessage != null)
Padding(
padding: EdgeInsets.only(left: 8),
padding: const EdgeInsets.only(left: 8),
child: Text(
widget.chatRoom.lastMessage!.updatedAt.format('dd MMM', 'ru'),
style: theme.textTheme.bodyMedium,
),
),
SizedBox(height: 4),
const SizedBox(height: 4),
if (widget.chatRoom.unreadMessagesCount > 0)
Container(
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: appTheme.blueA400,

View File

@@ -3,8 +3,8 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class ChatSearchBarWidget extends StatelessWidget {
ChatSearchBarWidget({
Key? key,
const ChatSearchBarWidget({
super.key,
this.alignment,
this.width,
this.scrollPadding,
@@ -27,7 +27,7 @@ class ChatSearchBarWidget extends StatelessWidget {
this.validator,
this.onChanged,
required this.onSuffixIconTap,
}) : super(key: key);
});
final Alignment? alignment;
@@ -107,7 +107,7 @@ class ChatSearchBarWidget extends StatelessWidget {
hintText: hintText ?? "",
hintStyle: hintStyle ?? CustomTextStyles.bodySmallMulishBluegray800,
prefixIcon: prefix ??
Padding(
const Padding(
padding: EdgeInsets.only(left: 12),
child: Icon(
Icons.search,
@@ -126,7 +126,7 @@ class ChatSearchBarWidget extends StatelessWidget {
),
),
isDense: true,
contentPadding: EdgeInsets.all(16),
contentPadding: const EdgeInsets.all(16),
fillColor: fillColor ?? appTheme.gray100,
filled: filled,
border: borderDecoration ??

View File

@@ -0,0 +1,90 @@
import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart';
import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/calendar_widget.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class ChosePlanDateWidget extends StatefulWidget {
const ChosePlanDateWidget({super.key, required this.chatCubit});
final ChatRoomCubit chatCubit;
@override
State<ChosePlanDateWidget> createState() => _ChosePlanDateWidget();
}
class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
final startDate = [DateTime.now()];
@override
Widget build(BuildContext context) {
final s = S.of(context);
String? planName;
if (widget.chatCubit.state is ChatRoomStateLoaded) {
planName = (widget.chatCubit.state as ChatRoomStateLoaded).chatRoom.chosenPlan?.plan.name;
}
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 4),
const BottomSheetHandlerBar(),
const SizedBox(height: 12),
Text(
planName ?? '',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
s.chose_plan_start_date_2,
textAlign: TextAlign.center,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
),
),
const SizedBox(height: 12),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: CustomDivider(),
),
CalendarWidget(
startDate: startDate,
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
child: CustomOutlinedButton(
onPressed: () async {
final result = await widget.chatCubit.choseStartPlanDate(startDate[0]);
if (result) {
showSuccessToast('Дата установлена');
if (!context.mounted) return;
Navigator.pop(context);
} else {
showErrorToast('Не удалось установить дату');
if (!context.mounted) return;
Navigator.pop(context);
}
},
height: 60,
text: s.confirm,
buttonTextStyle: TextStyles.textLSemibold.copyWith(
color: appTheme.whiteA700,
),
buttonStyle: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
side: const WidgetStatePropertyAll(BorderSide.none),
),
),
),
],
);
}
}

View File

@@ -1,8 +1,13 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/chose_plan_date_widget.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
class NotificationBanner extends StatelessWidget {
const NotificationBanner({super.key, required this.bannerType});
@@ -32,38 +37,52 @@ class NotificationBanner extends StatelessWidget {
BannerType.date => [
SizedBox(
width: size.width * 0.6,
child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
child: Text(s.choose_plan_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
),
SizedBox(height: 12),
const SizedBox(height: 12),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
onTap: () {
final cubit = context.read<ChatRoomCubit>();
showModalBottomSheet(
context: context,
builder: (context) => ChosePlanDateWidget(
chatCubit: cubit,
),
);
},
child: Text(s.choose_date, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
BannerType.card => [
SizedBox(
width: size.width * 0.6,
child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
),
SizedBox(height: 12),
const SizedBox(height: 12),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
BannerType.payment => [
SizedBox(
width: size.width * 0.6,
child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
child: Text(s.tap_on_link_to_pay, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
),
SizedBox(height: 12),
const SizedBox(height: 12),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
onTap: () async {
final paymentLink = await context.read<ChatRoomCubit>().getPaymentLink();
if (paymentLink != null) {
if (!context.mounted) return;
GoRouter.of(context).push(PaymentScreen.path, extra: paymentLink);
}
},
child: Text(s.pay, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
},
),

View File

@@ -33,8 +33,8 @@ class _OrderCardState extends State<OrderCard> {
};
final s = S.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 16),
padding: EdgeInsets.only(top: 8, bottom: 12, left: 8, right: 8),
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.only(top: 8, bottom: 12, left: 8, right: 8),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.gray60004),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -47,7 +47,7 @@ class _OrderCardState extends State<OrderCard> {
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.network(
baseUrl + '/storage/' + widget.plan.image,
'$baseUrl/storage/${widget.plan.image}',
width: double.infinity,
fit: BoxFit.cover,
),
@@ -59,7 +59,7 @@ class _OrderCardState extends State<OrderCard> {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(12),
bottomRight: Radius.circular(12),
),
@@ -77,7 +77,7 @@ class _OrderCardState extends State<OrderCard> {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: appTheme.greenA700,
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(12),
bottomRight: Radius.circular(12),
),
@@ -91,17 +91,17 @@ class _OrderCardState extends State<OrderCard> {
],
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'${widget.plan.name}',
widget.plan.name,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'${s.option}: ${option?.short ?? ''}',
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
if (option != null)
...option.items
.map(
@@ -114,11 +114,11 @@ class _OrderCardState extends State<OrderCard> {
),
),
)
.toList(),
,
if (widget.isCustomerView) ...[
SizedBox(height: 8),
const SizedBox(height: 8),
isLoading
? Loader()
? const Loader()
: GestureDetector(
onTap: () async {
setState(() => isLoading = true);
@@ -126,7 +126,7 @@ class _OrderCardState extends State<OrderCard> {
setState(() => isLoading = false);
},
child: Text(
'${s.cancel_order}',
s.cancel_order,
style: TextStyles.textSMedium.copyWith(color: appTheme.strongRed),
),
),

View File

@@ -1,11 +1,11 @@
import 'dart:async';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:eatvio_app/features/chat/models/chat_message_model.dart';
import 'package:eatvio_app/features/chat/models/chat_messages_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:eatvio_app/features/chat/models/payment_model.dart';
import 'package:eatvio_app/features/chat/services/chat_service.dart';
import 'package:http_parser/http_parser.dart';
@@ -47,7 +47,7 @@ class ChatRepository {
await chatService.sendMessage(
id: chatId,
data: data,
media_data: multipartFiles.isEmpty ? null : multipartFiles,
mediaData: multipartFiles.isEmpty ? null : multipartFiles,
);
} catch (e) {
rethrow;
@@ -103,4 +103,22 @@ class ChatRepository {
rethrow;
}
}
Future<void> choseStartPlanDate({required int id, required Map<String, String> date}) async {
try {
await chatService.choseStartPlanDate(id: id, date: date);
} catch (e) {
rethrow;
}
}
Future<PaymentModel> getPaymentLink({
required int id,
}) async {
try {
return await chatService.getPaymentLink(id: id);
} catch (e) {
rethrow;
}
}
}

View File

@@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
import 'package:eatvio_app/features/chat/models/chat_messages_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:eatvio_app/features/chat/models/payment_model.dart';
import 'package:retrofit/retrofit.dart';
part 'chat_service.g.dart';
@@ -26,7 +27,7 @@ abstract class ChatService {
Future<void> sendMessage({
@Path() required String id,
@Part() String? data,
@Part(name: 'media_data[]', contentType: 'multipart/form-data') List<MultipartFile>? media_data,
@Part(name: 'media_data[]', contentType: 'multipart/form-data') List<MultipartFile>? mediaData,
});
@GET('/api/chat/show/{id}/messages?page={page}')
@@ -50,4 +51,15 @@ abstract class ChatService {
Future<void> cancelChosenPlan({
@Path() required int id,
});
@POST('/api/chosen_plans/{id}/negotiate_contract_start')
Future<void> choseStartPlanDate({
@Path() required int id,
@Body() required Map<String, String> date,
});
@POST('/api/chosen_plans/{id}/start_payment_process')
Future<PaymentModel> getPaymentLink({
@Path() required int id,
});
}

View File

@@ -82,7 +82,7 @@ class _ChatService implements ChatService {
Future<void> sendMessage({
required String id,
String? data,
List<MultipartFile>? media_data,
List<MultipartFile>? mediaData,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
@@ -92,16 +92,16 @@ class _ChatService implements ChatService {
if (data != null) {
_data.fields.add(MapEntry('data', data));
}
if (media_data != null) {
_data.files.addAll(media_data.map((i) => MapEntry('media_data[]', i)));
if (mediaData != null) {
_data.files.addAll(mediaData.map((i) => MapEntry('media_data[]', i)));
}
final _options = _setStreamType<void>(
Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'/api/chat/${id}/message/send',
@@ -212,6 +212,56 @@ class _ChatService implements ChatService {
await _dio.fetch<void>(_options);
}
@override
Future<void> choseStartPlanDate({
required int id,
required Map<String, String> date,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(date);
final _options = _setStreamType<void>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'/api/chosen_plans/${id}/negotiate_contract_start',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
await _dio.fetch<void>(_options);
}
@override
Future<PaymentModel> getPaymentLink({required int id}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<PaymentModel>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'/api/chosen_plans/${id}/start_payment_process',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late PaymentModel _value;
try {
_value = PaymentModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

View File

@@ -12,8 +12,7 @@ part of 'complain_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ComplainModel _$ComplainModelFromJson(Map<String, dynamic> json) {
return _ComplainModel.fromJson(json);
@@ -37,9 +36,8 @@ mixin _$ComplainModel {
/// @nodoc
abstract class $ComplainModelCopyWith<$Res> {
factory $ComplainModelCopyWith(
ComplainModel value,
$Res Function(ComplainModel) then,
) = _$ComplainModelCopyWithImpl<$Res, ComplainModel>;
ComplainModel value, $Res Function(ComplainModel) then) =
_$ComplainModelCopyWithImpl<$Res, ComplainModel>;
@useResult
$Res call({String? description, List<String> tags});
}
@@ -58,22 +56,20 @@ class _$ComplainModelCopyWithImpl<$Res, $Val extends ComplainModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? description = freezed, Object? tags = null}) {
return _then(
_value.copyWith(
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
tags:
null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
)
as $Val,
);
$Res call({
Object? description = freezed,
Object? tags = null,
}) {
return _then(_value.copyWith(
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
tags: null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
) as $Val);
}
}
@@ -81,9 +77,8 @@ class _$ComplainModelCopyWithImpl<$Res, $Val extends ComplainModel>
abstract class _$$ComplainModelImplCopyWith<$Res>
implements $ComplainModelCopyWith<$Res> {
factory _$$ComplainModelImplCopyWith(
_$ComplainModelImpl value,
$Res Function(_$ComplainModelImpl) then,
) = __$$ComplainModelImplCopyWithImpl<$Res>;
_$ComplainModelImpl value, $Res Function(_$ComplainModelImpl) then) =
__$$ComplainModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? description, List<String> tags});
@@ -94,39 +89,36 @@ class __$$ComplainModelImplCopyWithImpl<$Res>
extends _$ComplainModelCopyWithImpl<$Res, _$ComplainModelImpl>
implements _$$ComplainModelImplCopyWith<$Res> {
__$$ComplainModelImplCopyWithImpl(
_$ComplainModelImpl _value,
$Res Function(_$ComplainModelImpl) _then,
) : super(_value, _then);
_$ComplainModelImpl _value, $Res Function(_$ComplainModelImpl) _then)
: super(_value, _then);
/// Create a copy of ComplainModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? description = freezed, Object? tags = null}) {
return _then(
_$ComplainModelImpl(
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
tags:
null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
),
);
$Res call({
Object? description = freezed,
Object? tags = null,
}) {
return _then(_$ComplainModelImpl(
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
tags: null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ComplainModelImpl implements _ComplainModel {
const _$ComplainModelImpl({
this.description = null,
final List<String> tags = const [],
}) : _tags = tags;
const _$ComplainModelImpl(
{this.description = null, final List<String> tags = const []})
: _tags = tags;
factory _$ComplainModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ComplainModelImplFromJson(json);
@@ -161,10 +153,7 @@ class _$ComplainModelImpl implements _ComplainModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
description,
const DeepCollectionEquality().hash(_tags),
);
runtimeType, description, const DeepCollectionEquality().hash(_tags));
/// Create a copy of ComplainModel
/// with the given fields replaced by the non-null parameter values.
@@ -176,15 +165,16 @@ class _$ComplainModelImpl implements _ComplainModel {
@override
Map<String, dynamic> toJson() {
return _$$ComplainModelImplToJson(this);
return _$$ComplainModelImplToJson(
this,
);
}
}
abstract class _ComplainModel implements ComplainModel {
const factory _ComplainModel({
final String? description,
final List<String> tags,
}) = _$ComplainModelImpl;
const factory _ComplainModel(
{final String? description,
final List<String> tags}) = _$ComplainModelImpl;
factory _ComplainModel.fromJson(Map<String, dynamic> json) =
_$ComplainModelImpl.fromJson;

View File

@@ -11,7 +11,7 @@ _$ComplainModelImpl _$$ComplainModelImplFromJson(Map<String, dynamic> json) =>
description: json['description'] as String? ?? null,
tags:
(json['tags'] as List<dynamic>?)?.map((e) => e as String).toList() ??
const [],
const [],
);
Map<String, dynamic> _$$ComplainModelImplToJson(_$ComplainModelImpl instance) =>

View File

@@ -31,28 +31,28 @@ class _ComplainingBottomSheetState extends State<ComplainingBottomSheet> {
return BlocProvider(
create: (context) => sl<ComplainingCubit>()..setContentTypeAndIdentifier(contentType: widget.complainedContentType, slug: widget.slug, id: widget.id),
child: Container(
padding: EdgeInsets.only(top: 8, bottom: 24, left: 16, right: 16),
decoration: BoxDecoration(
padding: const EdgeInsets.only(top: 8, bottom: 24, left: 16, right: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
),
child: BlocBuilder<ComplainingCubit, ComplainingState>(
builder: (context, state) {
final category = state.category;
if (state.wasSentSuccessfully == true) {
return _ComplaintSentWidget();
return const _ComplaintSentWidget();
} else if (state.wasSentSuccessfully == false) {
return _ComplaintFailedWidget();
return const _ComplaintFailedWidget();
}
if (category != null) {
return switch (category) {
ComplainType.spam => _SpamWidget(),
ComplainType.lawViolation => _LawViolationWidget(),
ComplainType.deception => _DeceptionWidget(),
ComplainType.violenceDndHostility => _ViolenceAndHostility(),
ComplainType.explicitImage => _ExplicitImageWidget(),
ComplainType.spam => const _SpamWidget(),
ComplainType.lawViolation => const _LawViolationWidget(),
ComplainType.deception => const _DeceptionWidget(),
ComplainType.violenceDndHostility => const _ViolenceAndHostility(),
ComplainType.explicitImage => const _ExplicitImageWidget(),
};
}
return _CategoryWidget();
return const _CategoryWidget();
},
),
),
@@ -69,19 +69,19 @@ class _CategoryWidget extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.complaint,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
s.complaint_question,
textAlign: TextAlign.center,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
SizedBox(height: 24),
const SizedBox(height: 24),
...List.generate(
categories.length,
(index) => Column(
@@ -92,11 +92,11 @@ class _CategoryWidget extends StatelessWidget {
context.read<ComplainingCubit>().setCategory(categories[index]);
},
),
if (index != categories.length - 1) SizedBox(height: 20),
if (index != categories.length - 1) const SizedBox(height: 20),
],
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
],
);
}
@@ -111,13 +111,13 @@ class _SpamWidget extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.spam,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -126,8 +126,8 @@ class _SpamWidget extends StatelessWidget {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
_ComplainButton(),
const SizedBox(height: 24),
const _ComplainButton(),
],
);
}
@@ -142,13 +142,13 @@ class _ExplicitImageWidget extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.explicitImages,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -157,8 +157,8 @@ class _ExplicitImageWidget extends StatelessWidget {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
_ComplainButton(),
const SizedBox(height: 24),
const _ComplainButton(),
],
);
}
@@ -197,13 +197,13 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.lawViolation,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -212,7 +212,7 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
...tags.mapIndexed((index, element) {
return Row(
children: [
@@ -238,9 +238,9 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> {
),
],
);
}).toList(),
}),
if (tags.last.$1) ...[
SizedBox(height: 12),
const SizedBox(height: 12),
CustomTextFormField(
hintText: s.type_here_your_complaint,
onChanged: (value) {
@@ -248,8 +248,8 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> {
},
),
],
SizedBox(height: 20),
_ComplainButton(),
const SizedBox(height: 20),
const _ComplainButton(),
],
);
}
@@ -287,13 +287,13 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.lawViolation,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -302,7 +302,7 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
...tags.mapIndexed((index, element) {
return Row(
children: [
@@ -327,9 +327,9 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> {
),
],
);
}).toList(),
SizedBox(height: 20),
_ComplainButton(),
}),
const SizedBox(height: 20),
const _ComplainButton(),
],
);
}
@@ -369,13 +369,13 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.lawViolation,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -384,7 +384,7 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
...tags.mapIndexed((index, element) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -406,7 +406,7 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
element.$2,
style: TextStyles.textLSemibold.copyWith(color: appTheme.black),
@@ -422,9 +422,9 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> {
),
],
);
}).toList(),
SizedBox(height: 20),
_ComplainButton(),
}),
const SizedBox(height: 20),
const _ComplainButton(),
],
);
}
@@ -439,13 +439,13 @@ class _ComplaintSentWidget extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.complaint_sent,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -454,13 +454,13 @@ class _ComplaintSentWidget extends StatelessWidget {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
CustomOutlinedButton(
text: s.ok,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () {
@@ -481,13 +481,13 @@ class _ComplaintFailedWidget extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHandlerBar(),
SizedBox(height: 20),
const BottomSheetHandlerBar(),
const SizedBox(height: 20),
Text(
s.could_not_send_complain,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
const SizedBox(height: 8),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.7,
child: Text(
@@ -496,13 +496,13 @@ class _ComplaintFailedWidget extends StatelessWidget {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
CustomOutlinedButton(
text: s.ok,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () {
@@ -523,14 +523,14 @@ class _ComplainButton extends StatelessWidget {
return BlocBuilder<ComplainingCubit, ComplainingState>(
builder: (context, state) {
if (state.isLoading) {
return Loader();
return const Loader();
}
return CustomOutlinedButton(
text: s.send_complain,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () async {
@@ -558,7 +558,7 @@ class _CategoryButton extends StatelessWidget {
category.getTranslatedText(),
style: TextStyles.textLSemibold.copyWith(color: appTheme.black),
),
Spacer(),
const Spacer(),
SvgPicture.asset('assets/icons/right_arrow.svg'),
],
),

View File

@@ -12,8 +12,7 @@ part of 'complaining_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ComplainingState {
@@ -35,19 +34,17 @@ mixin _$ComplainingState {
/// @nodoc
abstract class $ComplainingStateCopyWith<$Res> {
factory $ComplainingStateCopyWith(
ComplainingState value,
$Res Function(ComplainingState) then,
) = _$ComplainingStateCopyWithImpl<$Res, ComplainingState>;
ComplainingState value, $Res Function(ComplainingState) then) =
_$ComplainingStateCopyWithImpl<$Res, ComplainingState>;
@useResult
$Res call({
bool isLoading,
bool? wasSentSuccessfully,
ComplainType? category,
ComplainedContent? contentType,
int? contentId,
String? contentSlug,
ComplainModel complainInfo,
});
$Res call(
{bool isLoading,
bool? wasSentSuccessfully,
ComplainType? category,
ComplainedContent? contentType,
int? contentId,
String? contentSlug,
ComplainModel complainInfo});
$ComplainModelCopyWith<$Res> get complainInfo;
}
@@ -75,46 +72,36 @@ class _$ComplainingStateCopyWithImpl<$Res, $Val extends ComplainingState>
Object? contentSlug = freezed,
Object? complainInfo = null,
}) {
return _then(
_value.copyWith(
isLoading:
null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
wasSentSuccessfully:
freezed == wasSentSuccessfully
? _value.wasSentSuccessfully
: wasSentSuccessfully // ignore: cast_nullable_to_non_nullable
as bool?,
category:
freezed == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as ComplainType?,
contentType:
freezed == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ComplainedContent?,
contentId:
freezed == contentId
? _value.contentId
: contentId // ignore: cast_nullable_to_non_nullable
as int?,
contentSlug:
freezed == contentSlug
? _value.contentSlug
: contentSlug // ignore: cast_nullable_to_non_nullable
as String?,
complainInfo:
null == complainInfo
? _value.complainInfo
: complainInfo // ignore: cast_nullable_to_non_nullable
as ComplainModel,
)
as $Val,
);
return _then(_value.copyWith(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
wasSentSuccessfully: freezed == wasSentSuccessfully
? _value.wasSentSuccessfully
: wasSentSuccessfully // ignore: cast_nullable_to_non_nullable
as bool?,
category: freezed == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as ComplainType?,
contentType: freezed == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ComplainedContent?,
contentId: freezed == contentId
? _value.contentId
: contentId // ignore: cast_nullable_to_non_nullable
as int?,
contentSlug: freezed == contentSlug
? _value.contentSlug
: contentSlug // ignore: cast_nullable_to_non_nullable
as String?,
complainInfo: null == complainInfo
? _value.complainInfo
: complainInfo // ignore: cast_nullable_to_non_nullable
as ComplainModel,
) as $Val);
}
/// Create a copy of ComplainingState
@@ -131,21 +118,19 @@ class _$ComplainingStateCopyWithImpl<$Res, $Val extends ComplainingState>
/// @nodoc
abstract class _$$ComplainingStateImplCopyWith<$Res>
implements $ComplainingStateCopyWith<$Res> {
factory _$$ComplainingStateImplCopyWith(
_$ComplainingStateImpl value,
$Res Function(_$ComplainingStateImpl) then,
) = __$$ComplainingStateImplCopyWithImpl<$Res>;
factory _$$ComplainingStateImplCopyWith(_$ComplainingStateImpl value,
$Res Function(_$ComplainingStateImpl) then) =
__$$ComplainingStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
bool isLoading,
bool? wasSentSuccessfully,
ComplainType? category,
ComplainedContent? contentType,
int? contentId,
String? contentSlug,
ComplainModel complainInfo,
});
$Res call(
{bool isLoading,
bool? wasSentSuccessfully,
ComplainType? category,
ComplainedContent? contentType,
int? contentId,
String? contentSlug,
ComplainModel complainInfo});
@override
$ComplainModelCopyWith<$Res> get complainInfo;
@@ -155,10 +140,9 @@ abstract class _$$ComplainingStateImplCopyWith<$Res>
class __$$ComplainingStateImplCopyWithImpl<$Res>
extends _$ComplainingStateCopyWithImpl<$Res, _$ComplainingStateImpl>
implements _$$ComplainingStateImplCopyWith<$Res> {
__$$ComplainingStateImplCopyWithImpl(
_$ComplainingStateImpl _value,
$Res Function(_$ComplainingStateImpl) _then,
) : super(_value, _then);
__$$ComplainingStateImplCopyWithImpl(_$ComplainingStateImpl _value,
$Res Function(_$ComplainingStateImpl) _then)
: super(_value, _then);
/// Create a copy of ComplainingState
/// with the given fields replaced by the non-null parameter values.
@@ -173,60 +157,50 @@ class __$$ComplainingStateImplCopyWithImpl<$Res>
Object? contentSlug = freezed,
Object? complainInfo = null,
}) {
return _then(
_$ComplainingStateImpl(
isLoading:
null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
wasSentSuccessfully:
freezed == wasSentSuccessfully
? _value.wasSentSuccessfully
: wasSentSuccessfully // ignore: cast_nullable_to_non_nullable
as bool?,
category:
freezed == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as ComplainType?,
contentType:
freezed == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ComplainedContent?,
contentId:
freezed == contentId
? _value.contentId
: contentId // ignore: cast_nullable_to_non_nullable
as int?,
contentSlug:
freezed == contentSlug
? _value.contentSlug
: contentSlug // ignore: cast_nullable_to_non_nullable
as String?,
complainInfo:
null == complainInfo
? _value.complainInfo
: complainInfo // ignore: cast_nullable_to_non_nullable
as ComplainModel,
),
);
return _then(_$ComplainingStateImpl(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
wasSentSuccessfully: freezed == wasSentSuccessfully
? _value.wasSentSuccessfully
: wasSentSuccessfully // ignore: cast_nullable_to_non_nullable
as bool?,
category: freezed == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as ComplainType?,
contentType: freezed == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ComplainedContent?,
contentId: freezed == contentId
? _value.contentId
: contentId // ignore: cast_nullable_to_non_nullable
as int?,
contentSlug: freezed == contentSlug
? _value.contentSlug
: contentSlug // ignore: cast_nullable_to_non_nullable
as String?,
complainInfo: null == complainInfo
? _value.complainInfo
: complainInfo // ignore: cast_nullable_to_non_nullable
as ComplainModel,
));
}
}
/// @nodoc
class _$ComplainingStateImpl implements _ComplainingState {
_$ComplainingStateImpl({
this.isLoading = false,
this.wasSentSuccessfully = null,
this.category = null,
this.contentType = null,
this.contentId = null,
this.contentSlug = null,
this.complainInfo = const ComplainModel(),
});
_$ComplainingStateImpl(
{this.isLoading = false,
this.wasSentSuccessfully = null,
this.category = null,
this.contentType = null,
this.contentId = null,
this.contentSlug = null,
this.complainInfo = const ComplainModel()});
@override
@JsonKey()
@@ -277,16 +251,8 @@ class _$ComplainingStateImpl implements _ComplainingState {
}
@override
int get hashCode => Object.hash(
runtimeType,
isLoading,
wasSentSuccessfully,
category,
contentType,
contentId,
contentSlug,
complainInfo,
);
int get hashCode => Object.hash(runtimeType, isLoading, wasSentSuccessfully,
category, contentType, contentId, contentSlug, complainInfo);
/// Create a copy of ComplainingState
/// with the given fields replaced by the non-null parameter values.
@@ -295,21 +261,18 @@ class _$ComplainingStateImpl implements _ComplainingState {
@pragma('vm:prefer-inline')
_$$ComplainingStateImplCopyWith<_$ComplainingStateImpl> get copyWith =>
__$$ComplainingStateImplCopyWithImpl<_$ComplainingStateImpl>(
this,
_$identity,
);
this, _$identity);
}
abstract class _ComplainingState implements ComplainingState {
factory _ComplainingState({
final bool isLoading,
final bool? wasSentSuccessfully,
final ComplainType? category,
final ComplainedContent? contentType,
final int? contentId,
final String? contentSlug,
final ComplainModel complainInfo,
}) = _$ComplainingStateImpl;
factory _ComplainingState(
{final bool isLoading,
final bool? wasSentSuccessfully,
final ComplainType? category,
final ComplainedContent? contentType,
final int? contentId,
final String? contentSlug,
final ComplainModel complainInfo}) = _$ComplainingStateImpl;
@override
bool get isLoading;

View File

@@ -12,12 +12,10 @@ part of 'consultant_profile_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ConsultantProfileModel _$ConsultantProfileModelFromJson(
Map<String, dynamic> json,
) {
Map<String, dynamic> json) {
return _ConsultantProfileModel.fromJson(json);
}
@@ -45,29 +43,25 @@ mixin _$ConsultantProfileModel {
/// @nodoc
abstract class $ConsultantProfileModelCopyWith<$Res> {
factory $ConsultantProfileModelCopyWith(
ConsultantProfileModel value,
$Res Function(ConsultantProfileModel) then,
) = _$ConsultantProfileModelCopyWithImpl<$Res, ConsultantProfileModel>;
factory $ConsultantProfileModelCopyWith(ConsultantProfileModel value,
$Res Function(ConsultantProfileModel) then) =
_$ConsultantProfileModelCopyWithImpl<$Res, ConsultantProfileModel>;
@useResult
$Res call({
@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates,
});
$Res call(
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates});
$SocialLinksModelCopyWith<$Res>? get socialLinks;
}
/// @nodoc
class _$ConsultantProfileModelCopyWithImpl<
$Res,
$Val extends ConsultantProfileModel
>
class _$ConsultantProfileModelCopyWithImpl<$Res,
$Val extends ConsultantProfileModel>
implements $ConsultantProfileModelCopyWith<$Res> {
_$ConsultantProfileModelCopyWithImpl(this._value, this._then);
@@ -86,31 +80,24 @@ class _$ConsultantProfileModelCopyWithImpl<
Object? photos = freezed,
Object? certificates = freezed,
}) {
return _then(
_value.copyWith(
hasMedicalEducation:
freezed == hasMedicalEducation
? _value.hasMedicalEducation
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
as bool?,
socialLinks:
freezed == socialLinks
? _value.socialLinks
: socialLinks // ignore: cast_nullable_to_non_nullable
as SocialLinksModel?,
photos:
freezed == photos
? _value.photos
: photos // ignore: cast_nullable_to_non_nullable
as List<String>?,
certificates:
freezed == certificates
? _value.certificates
: certificates // ignore: cast_nullable_to_non_nullable
as List<CertificatesModel>?,
)
as $Val,
);
return _then(_value.copyWith(
hasMedicalEducation: freezed == hasMedicalEducation
? _value.hasMedicalEducation
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
as bool?,
socialLinks: freezed == socialLinks
? _value.socialLinks
: socialLinks // ignore: cast_nullable_to_non_nullable
as SocialLinksModel?,
photos: freezed == photos
? _value.photos
: photos // ignore: cast_nullable_to_non_nullable
as List<String>?,
certificates: freezed == certificates
? _value.certificates
: certificates // ignore: cast_nullable_to_non_nullable
as List<CertificatesModel>?,
) as $Val);
}
/// Create a copy of ConsultantProfileModel
@@ -132,20 +119,19 @@ class _$ConsultantProfileModelCopyWithImpl<
abstract class _$$ConsultantProfileModelImplCopyWith<$Res>
implements $ConsultantProfileModelCopyWith<$Res> {
factory _$$ConsultantProfileModelImplCopyWith(
_$ConsultantProfileModelImpl value,
$Res Function(_$ConsultantProfileModelImpl) then,
) = __$$ConsultantProfileModelImplCopyWithImpl<$Res>;
_$ConsultantProfileModelImpl value,
$Res Function(_$ConsultantProfileModelImpl) then) =
__$$ConsultantProfileModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates,
});
$Res call(
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates});
@override
$SocialLinksModelCopyWith<$Res>? get socialLinks;
@@ -153,13 +139,13 @@ abstract class _$$ConsultantProfileModelImplCopyWith<$Res>
/// @nodoc
class __$$ConsultantProfileModelImplCopyWithImpl<$Res>
extends
_$ConsultantProfileModelCopyWithImpl<$Res, _$ConsultantProfileModelImpl>
extends _$ConsultantProfileModelCopyWithImpl<$Res,
_$ConsultantProfileModelImpl>
implements _$$ConsultantProfileModelImplCopyWith<$Res> {
__$$ConsultantProfileModelImplCopyWithImpl(
_$ConsultantProfileModelImpl _value,
$Res Function(_$ConsultantProfileModelImpl) _then,
) : super(_value, _then);
_$ConsultantProfileModelImpl _value,
$Res Function(_$ConsultantProfileModelImpl) _then)
: super(_value, _then);
/// Create a copy of ConsultantProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -171,46 +157,40 @@ class __$$ConsultantProfileModelImplCopyWithImpl<$Res>
Object? photos = freezed,
Object? certificates = freezed,
}) {
return _then(
_$ConsultantProfileModelImpl(
hasMedicalEducation:
freezed == hasMedicalEducation
? _value.hasMedicalEducation
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
as bool?,
socialLinks:
freezed == socialLinks
? _value.socialLinks
: socialLinks // ignore: cast_nullable_to_non_nullable
as SocialLinksModel?,
photos:
freezed == photos
? _value._photos
: photos // ignore: cast_nullable_to_non_nullable
as List<String>?,
certificates:
freezed == certificates
? _value._certificates
: certificates // ignore: cast_nullable_to_non_nullable
as List<CertificatesModel>?,
),
);
return _then(_$ConsultantProfileModelImpl(
hasMedicalEducation: freezed == hasMedicalEducation
? _value.hasMedicalEducation
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
as bool?,
socialLinks: freezed == socialLinks
? _value.socialLinks
: socialLinks // ignore: cast_nullable_to_non_nullable
as SocialLinksModel?,
photos: freezed == photos
? _value._photos
: photos // ignore: cast_nullable_to_non_nullable
as List<String>?,
certificates: freezed == certificates
? _value._certificates
: certificates // ignore: cast_nullable_to_non_nullable
as List<CertificatesModel>?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
const _$ConsultantProfileModelImpl({
@JsonKey(name: 'has_medical_education', includeIfNull: false)
this.hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false) this.socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates,
}) : _photos = photos,
_certificates = certificates;
const _$ConsultantProfileModelImpl(
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
this.hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false) this.socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates})
: _photos = photos,
_certificates = certificates;
factory _$ConsultantProfileModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ConsultantProfileModelImplFromJson(json);
@@ -258,21 +238,18 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
(identical(other.socialLinks, socialLinks) ||
other.socialLinks == socialLinks) &&
const DeepCollectionEquality().equals(other._photos, _photos) &&
const DeepCollectionEquality().equals(
other._certificates,
_certificates,
));
const DeepCollectionEquality()
.equals(other._certificates, _certificates));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
hasMedicalEducation,
socialLinks,
const DeepCollectionEquality().hash(_photos),
const DeepCollectionEquality().hash(_certificates),
);
runtimeType,
hasMedicalEducation,
socialLinks,
const DeepCollectionEquality().hash(_photos),
const DeepCollectionEquality().hash(_certificates));
/// Create a copy of ConsultantProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -280,29 +257,28 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
@override
@pragma('vm:prefer-inline')
_$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl>
get copyWith =>
__$$ConsultantProfileModelImplCopyWithImpl<_$ConsultantProfileModelImpl>(
this,
_$identity,
);
get copyWith => __$$ConsultantProfileModelImplCopyWithImpl<
_$ConsultantProfileModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ConsultantProfileModelImplToJson(this);
return _$$ConsultantProfileModelImplToJson(
this,
);
}
}
abstract class _ConsultantProfileModel implements ConsultantProfileModel {
const factory _ConsultantProfileModel({
@JsonKey(name: 'has_medical_education', includeIfNull: false)
final bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
final SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates,
}) = _$ConsultantProfileModelImpl;
const factory _ConsultantProfileModel(
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
final bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
final SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates}) =
_$ConsultantProfileModelImpl;
factory _ConsultantProfileModel.fromJson(Map<String, dynamic> json) =
_$ConsultantProfileModelImpl.fromJson;
@@ -325,7 +301,7 @@ abstract class _ConsultantProfileModel implements ConsultantProfileModel {
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}
SocialLinksModel _$SocialLinksModelFromJson(Map<String, dynamic> json) {
@@ -358,18 +334,16 @@ mixin _$SocialLinksModel {
/// @nodoc
abstract class $SocialLinksModelCopyWith<$Res> {
factory $SocialLinksModelCopyWith(
SocialLinksModel value,
$Res Function(SocialLinksModel) then,
) = _$SocialLinksModelCopyWithImpl<$Res, SocialLinksModel>;
SocialLinksModel value, $Res Function(SocialLinksModel) then) =
_$SocialLinksModelCopyWithImpl<$Res, SocialLinksModel>;
@useResult
$Res call({
@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink,
});
$Res call(
{@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink});
}
/// @nodoc
@@ -393,66 +367,55 @@ class _$SocialLinksModelCopyWithImpl<$Res, $Val extends SocialLinksModel>
Object? instaLink = freezed,
Object? personalSiteLink = freezed,
}) {
return _then(
_value.copyWith(
vkLink:
freezed == vkLink
? _value.vkLink
: vkLink // ignore: cast_nullable_to_non_nullable
as String?,
tgLink:
freezed == tgLink
? _value.tgLink
: tgLink // ignore: cast_nullable_to_non_nullable
as String?,
fbLink:
freezed == fbLink
? _value.fbLink
: fbLink // ignore: cast_nullable_to_non_nullable
as String?,
instaLink:
freezed == instaLink
? _value.instaLink
: instaLink // ignore: cast_nullable_to_non_nullable
as String?,
personalSiteLink:
freezed == personalSiteLink
? _value.personalSiteLink
: personalSiteLink // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
return _then(_value.copyWith(
vkLink: freezed == vkLink
? _value.vkLink
: vkLink // ignore: cast_nullable_to_non_nullable
as String?,
tgLink: freezed == tgLink
? _value.tgLink
: tgLink // ignore: cast_nullable_to_non_nullable
as String?,
fbLink: freezed == fbLink
? _value.fbLink
: fbLink // ignore: cast_nullable_to_non_nullable
as String?,
instaLink: freezed == instaLink
? _value.instaLink
: instaLink // ignore: cast_nullable_to_non_nullable
as String?,
personalSiteLink: freezed == personalSiteLink
? _value.personalSiteLink
: personalSiteLink // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$SocialLinksModelImplCopyWith<$Res>
implements $SocialLinksModelCopyWith<$Res> {
factory _$$SocialLinksModelImplCopyWith(
_$SocialLinksModelImpl value,
$Res Function(_$SocialLinksModelImpl) then,
) = __$$SocialLinksModelImplCopyWithImpl<$Res>;
factory _$$SocialLinksModelImplCopyWith(_$SocialLinksModelImpl value,
$Res Function(_$SocialLinksModelImpl) then) =
__$$SocialLinksModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink,
});
$Res call(
{@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink});
}
/// @nodoc
class __$$SocialLinksModelImplCopyWithImpl<$Res>
extends _$SocialLinksModelCopyWithImpl<$Res, _$SocialLinksModelImpl>
implements _$$SocialLinksModelImplCopyWith<$Res> {
__$$SocialLinksModelImplCopyWithImpl(
_$SocialLinksModelImpl _value,
$Res Function(_$SocialLinksModelImpl) _then,
) : super(_value, _then);
__$$SocialLinksModelImplCopyWithImpl(_$SocialLinksModelImpl _value,
$Res Function(_$SocialLinksModelImpl) _then)
: super(_value, _then);
/// Create a copy of SocialLinksModel
/// with the given fields replaced by the non-null parameter values.
@@ -465,49 +428,41 @@ class __$$SocialLinksModelImplCopyWithImpl<$Res>
Object? instaLink = freezed,
Object? personalSiteLink = freezed,
}) {
return _then(
_$SocialLinksModelImpl(
vkLink:
freezed == vkLink
? _value.vkLink
: vkLink // ignore: cast_nullable_to_non_nullable
as String?,
tgLink:
freezed == tgLink
? _value.tgLink
: tgLink // ignore: cast_nullable_to_non_nullable
as String?,
fbLink:
freezed == fbLink
? _value.fbLink
: fbLink // ignore: cast_nullable_to_non_nullable
as String?,
instaLink:
freezed == instaLink
? _value.instaLink
: instaLink // ignore: cast_nullable_to_non_nullable
as String?,
personalSiteLink:
freezed == personalSiteLink
? _value.personalSiteLink
: personalSiteLink // ignore: cast_nullable_to_non_nullable
as String?,
),
);
return _then(_$SocialLinksModelImpl(
vkLink: freezed == vkLink
? _value.vkLink
: vkLink // ignore: cast_nullable_to_non_nullable
as String?,
tgLink: freezed == tgLink
? _value.tgLink
: tgLink // ignore: cast_nullable_to_non_nullable
as String?,
fbLink: freezed == fbLink
? _value.fbLink
: fbLink // ignore: cast_nullable_to_non_nullable
as String?,
instaLink: freezed == instaLink
? _value.instaLink
: instaLink // ignore: cast_nullable_to_non_nullable
as String?,
personalSiteLink: freezed == personalSiteLink
? _value.personalSiteLink
: personalSiteLink // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$SocialLinksModelImpl implements _SocialLinksModel {
const _$SocialLinksModelImpl({
@JsonKey(name: 'vk_link', includeIfNull: false) this.vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) this.tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) this.fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) this.instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
this.personalSiteLink,
});
const _$SocialLinksModelImpl(
{@JsonKey(name: 'vk_link', includeIfNull: false) this.vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) this.tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) this.fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) this.instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
this.personalSiteLink});
factory _$SocialLinksModelImpl.fromJson(Map<String, dynamic> json) =>
_$$SocialLinksModelImplFromJson(json);
@@ -550,13 +505,7 @@ class _$SocialLinksModelImpl implements _SocialLinksModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
vkLink,
tgLink,
fbLink,
instaLink,
personalSiteLink,
);
runtimeType, vkLink, tgLink, fbLink, instaLink, personalSiteLink);
/// Create a copy of SocialLinksModel
/// with the given fields replaced by the non-null parameter values.
@@ -565,25 +514,25 @@ class _$SocialLinksModelImpl implements _SocialLinksModel {
@pragma('vm:prefer-inline')
_$$SocialLinksModelImplCopyWith<_$SocialLinksModelImpl> get copyWith =>
__$$SocialLinksModelImplCopyWithImpl<_$SocialLinksModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$SocialLinksModelImplToJson(this);
return _$$SocialLinksModelImplToJson(
this,
);
}
}
abstract class _SocialLinksModel implements SocialLinksModel {
const factory _SocialLinksModel({
@JsonKey(name: 'vk_link', includeIfNull: false) final String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) final String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) final String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) final String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
final String? personalSiteLink,
}) = _$SocialLinksModelImpl;
const factory _SocialLinksModel(
{@JsonKey(name: 'vk_link', includeIfNull: false) final String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) final String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) final String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false)
final String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
final String? personalSiteLink}) = _$SocialLinksModelImpl;
factory _SocialLinksModel.fromJson(Map<String, dynamic> json) =
_$SocialLinksModelImpl.fromJson;
@@ -634,9 +583,8 @@ mixin _$CertificatesModel {
/// @nodoc
abstract class $CertificatesModelCopyWith<$Res> {
factory $CertificatesModelCopyWith(
CertificatesModel value,
$Res Function(CertificatesModel) then,
) = _$CertificatesModelCopyWithImpl<$Res, CertificatesModel>;
CertificatesModel value, $Res Function(CertificatesModel) then) =
_$CertificatesModelCopyWithImpl<$Res, CertificatesModel>;
@useResult
$Res call({String title, String date});
}
@@ -655,32 +603,29 @@ class _$CertificatesModelCopyWithImpl<$Res, $Val extends CertificatesModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? title = null, Object? date = null}) {
return _then(
_value.copyWith(
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
$Res call({
Object? title = null,
Object? date = null,
}) {
return _then(_value.copyWith(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$CertificatesModelImplCopyWith<$Res>
implements $CertificatesModelCopyWith<$Res> {
factory _$$CertificatesModelImplCopyWith(
_$CertificatesModelImpl value,
$Res Function(_$CertificatesModelImpl) then,
) = __$$CertificatesModelImplCopyWithImpl<$Res>;
factory _$$CertificatesModelImplCopyWith(_$CertificatesModelImpl value,
$Res Function(_$CertificatesModelImpl) then) =
__$$CertificatesModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String title, String date});
@@ -690,30 +635,28 @@ abstract class _$$CertificatesModelImplCopyWith<$Res>
class __$$CertificatesModelImplCopyWithImpl<$Res>
extends _$CertificatesModelCopyWithImpl<$Res, _$CertificatesModelImpl>
implements _$$CertificatesModelImplCopyWith<$Res> {
__$$CertificatesModelImplCopyWithImpl(
_$CertificatesModelImpl _value,
$Res Function(_$CertificatesModelImpl) _then,
) : super(_value, _then);
__$$CertificatesModelImplCopyWithImpl(_$CertificatesModelImpl _value,
$Res Function(_$CertificatesModelImpl) _then)
: super(_value, _then);
/// Create a copy of CertificatesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? title = null, Object? date = null}) {
return _then(
_$CertificatesModelImpl(
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? title = null,
Object? date = null,
}) {
return _then(_$CertificatesModelImpl(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -755,21 +698,20 @@ class _$CertificatesModelImpl implements _CertificatesModel {
@pragma('vm:prefer-inline')
_$$CertificatesModelImplCopyWith<_$CertificatesModelImpl> get copyWith =>
__$$CertificatesModelImplCopyWithImpl<_$CertificatesModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$CertificatesModelImplToJson(this);
return _$$CertificatesModelImplToJson(
this,
);
}
}
abstract class _CertificatesModel implements CertificatesModel {
const factory _CertificatesModel({
required final String title,
required final String date,
}) = _$CertificatesModelImpl;
const factory _CertificatesModel(
{required final String title,
required final String date}) = _$CertificatesModelImpl;
factory _CertificatesModel.fromJson(Map<String, dynamic> json) =
_$CertificatesModelImpl.fromJson;

View File

@@ -7,60 +7,62 @@ part of 'consultant_profile_model.dart';
// **************************************************************************
_$ConsultantProfileModelImpl _$$ConsultantProfileModelImplFromJson(
Map<String, dynamic> json,
) => _$ConsultantProfileModelImpl(
hasMedicalEducation: json['has_medical_education'] as bool?,
socialLinks:
json['social_links'] == null
Map<String, dynamic> json) =>
_$ConsultantProfileModelImpl(
hasMedicalEducation: json['has_medical_education'] as bool?,
socialLinks: json['social_links'] == null
? null
: SocialLinksModel.fromJson(
json['social_links'] as Map<String, dynamic>,
),
photos:
(json['cert_photos'] as List<dynamic>?)?.map((e) => e as String).toList(),
certificates:
(json['completed_courses'] as List<dynamic>?)
json['social_links'] as Map<String, dynamic>),
photos: (json['cert_photos'] as List<dynamic>?)
?.map((e) => e as String)
.toList(),
certificates: (json['completed_courses'] as List<dynamic>?)
?.map((e) => CertificatesModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
);
Map<String, dynamic> _$$ConsultantProfileModelImplToJson(
_$ConsultantProfileModelImpl instance,
) => <String, dynamic>{
if (instance.hasMedicalEducation case final value?)
'has_medical_education': value,
if (instance.socialLinks case final value?) 'social_links': value,
if (instance.photos case final value?) 'cert_photos': value,
if (instance.certificates case final value?) 'completed_courses': value,
};
_$ConsultantProfileModelImpl instance) =>
<String, dynamic>{
if (instance.hasMedicalEducation case final value?)
'has_medical_education': value,
if (instance.socialLinks case final value?) 'social_links': value,
if (instance.photos case final value?) 'cert_photos': value,
if (instance.certificates case final value?) 'completed_courses': value,
};
_$SocialLinksModelImpl _$$SocialLinksModelImplFromJson(
Map<String, dynamic> json,
) => _$SocialLinksModelImpl(
vkLink: json['vk_link'] as String?,
tgLink: json['tg_link'] as String?,
fbLink: json['fb_link'] as String?,
instaLink: json['insta_link'] as String?,
personalSiteLink: json['personal_site_link'] as String?,
);
Map<String, dynamic> json) =>
_$SocialLinksModelImpl(
vkLink: json['vk_link'] as String?,
tgLink: json['tg_link'] as String?,
fbLink: json['fb_link'] as String?,
instaLink: json['insta_link'] as String?,
personalSiteLink: json['personal_site_link'] as String?,
);
Map<String, dynamic> _$$SocialLinksModelImplToJson(
_$SocialLinksModelImpl instance,
) => <String, dynamic>{
if (instance.vkLink case final value?) 'vk_link': value,
if (instance.tgLink case final value?) 'tg_link': value,
if (instance.fbLink case final value?) 'fb_link': value,
if (instance.instaLink case final value?) 'insta_link': value,
if (instance.personalSiteLink case final value?) 'personal_site_link': value,
};
_$SocialLinksModelImpl instance) =>
<String, dynamic>{
if (instance.vkLink case final value?) 'vk_link': value,
if (instance.tgLink case final value?) 'tg_link': value,
if (instance.fbLink case final value?) 'fb_link': value,
if (instance.instaLink case final value?) 'insta_link': value,
if (instance.personalSiteLink case final value?)
'personal_site_link': value,
};
_$CertificatesModelImpl _$$CertificatesModelImplFromJson(
Map<String, dynamic> json,
) => _$CertificatesModelImpl(
title: json['title'] as String,
date: json['date'] as String,
);
Map<String, dynamic> json) =>
_$CertificatesModelImpl(
title: json['title'] as String,
date: json['date'] as String,
);
Map<String, dynamic> _$$CertificatesModelImplToJson(
_$CertificatesModelImpl instance,
) => <String, dynamic>{'title': instance.title, 'date': instance.date};
_$CertificatesModelImpl instance) =>
<String, dynamic>{
'title': instance.title,
'date': instance.date,
};

View File

@@ -12,7 +12,7 @@ class RegisterConsultantCubit extends Cubit<RegisterConsultantState> {
RegisterConsultantCubit({
required this.consultantRepository,
}) : super(
RegisterConsultantState(
const RegisterConsultantState(
consultant: ConsultantProfileModel(
socialLinks: SocialLinksModel(),
hasMedicalEducation: true,

View File

@@ -12,8 +12,7 @@ part of 'register_consultant_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$RegisterConsultantState {
@@ -29,10 +28,9 @@ mixin _$RegisterConsultantState {
/// @nodoc
abstract class $RegisterConsultantStateCopyWith<$Res> {
factory $RegisterConsultantStateCopyWith(
RegisterConsultantState value,
$Res Function(RegisterConsultantState) then,
) = _$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>;
factory $RegisterConsultantStateCopyWith(RegisterConsultantState value,
$Res Function(RegisterConsultantState) then) =
_$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>;
@useResult
$Res call({ConsultantProfileModel consultant, bool acceptOffer});
@@ -40,10 +38,8 @@ abstract class $RegisterConsultantStateCopyWith<$Res> {
}
/// @nodoc
class _$RegisterConsultantStateCopyWithImpl<
$Res,
$Val extends RegisterConsultantState
>
class _$RegisterConsultantStateCopyWithImpl<$Res,
$Val extends RegisterConsultantState>
implements $RegisterConsultantStateCopyWith<$Res> {
_$RegisterConsultantStateCopyWithImpl(this._value, this._then);
@@ -56,22 +52,20 @@ class _$RegisterConsultantStateCopyWithImpl<
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? consultant = null, Object? acceptOffer = null}) {
return _then(
_value.copyWith(
consultant:
null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer:
null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
$Res call({
Object? consultant = null,
Object? acceptOffer = null,
}) {
return _then(_value.copyWith(
consultant: null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer: null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
/// Create a copy of RegisterConsultantState
@@ -89,9 +83,9 @@ class _$RegisterConsultantStateCopyWithImpl<
abstract class _$$RegisterConsultantStateImplCopyWith<$Res>
implements $RegisterConsultantStateCopyWith<$Res> {
factory _$$RegisterConsultantStateImplCopyWith(
_$RegisterConsultantStateImpl value,
$Res Function(_$RegisterConsultantStateImpl) then,
) = __$$RegisterConsultantStateImplCopyWithImpl<$Res>;
_$RegisterConsultantStateImpl value,
$Res Function(_$RegisterConsultantStateImpl) then) =
__$$RegisterConsultantStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({ConsultantProfileModel consultant, bool acceptOffer});
@@ -102,46 +96,40 @@ abstract class _$$RegisterConsultantStateImplCopyWith<$Res>
/// @nodoc
class __$$RegisterConsultantStateImplCopyWithImpl<$Res>
extends
_$RegisterConsultantStateCopyWithImpl<
$Res,
_$RegisterConsultantStateImpl
>
extends _$RegisterConsultantStateCopyWithImpl<$Res,
_$RegisterConsultantStateImpl>
implements _$$RegisterConsultantStateImplCopyWith<$Res> {
__$$RegisterConsultantStateImplCopyWithImpl(
_$RegisterConsultantStateImpl _value,
$Res Function(_$RegisterConsultantStateImpl) _then,
) : super(_value, _then);
_$RegisterConsultantStateImpl _value,
$Res Function(_$RegisterConsultantStateImpl) _then)
: super(_value, _then);
/// Create a copy of RegisterConsultantState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? consultant = null, Object? acceptOffer = null}) {
return _then(
_$RegisterConsultantStateImpl(
consultant:
null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer:
null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
),
);
$Res call({
Object? consultant = null,
Object? acceptOffer = null,
}) {
return _then(_$RegisterConsultantStateImpl(
consultant: null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer: null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
const _$RegisterConsultantStateImpl({
required this.consultant,
required this.acceptOffer,
});
const _$RegisterConsultantStateImpl(
{required this.consultant, required this.acceptOffer});
@override
final ConsultantProfileModel consultant;
@@ -173,16 +161,14 @@ class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
@override
@pragma('vm:prefer-inline')
_$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl>
get copyWith => __$$RegisterConsultantStateImplCopyWithImpl<
_$RegisterConsultantStateImpl
>(this, _$identity);
get copyWith => __$$RegisterConsultantStateImplCopyWithImpl<
_$RegisterConsultantStateImpl>(this, _$identity);
}
abstract class _RegisterConsultantState implements RegisterConsultantState {
const factory _RegisterConsultantState({
required final ConsultantProfileModel consultant,
required final bool acceptOffer,
}) = _$RegisterConsultantStateImpl;
const factory _RegisterConsultantState(
{required final ConsultantProfileModel consultant,
required final bool acceptOffer}) = _$RegisterConsultantStateImpl;
@override
ConsultantProfileModel get consultant;
@@ -194,5 +180,5 @@ abstract class _RegisterConsultantState implements RegisterConsultantState {
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl>
get copyWith => throw _privateConstructorUsedError;
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -30,13 +30,13 @@ class _AdditionalSettingsScreenState extends State<AdditionalSettingsScreen> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80, top: 16),
padding: const EdgeInsets.only(bottom: 80, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Дополнительные настройки',
style: TextStyle(
@@ -82,11 +82,11 @@ class _AdditionalSettingsScreenState extends State<AdditionalSettingsScreen> {
required bool value,
}) {
return ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
onTap: onTap,
title: Text(
title,
style: TextStyle(
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
height: 1,

View File

@@ -14,16 +14,16 @@ class _BecomeConsultantScreenState extends State<BecomeConsultantScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Стать консультантом'),
title: const Text('Стать консультантом'),
automaticallyImplyLeading: false,
centerTitle: false,
leading: IconButton(
onPressed: () => GoRouter.of(context).pop(),
icon: Icon(Icons.close),
icon: const Icon(Icons.close),
),
),
body: Padding(
padding: const EdgeInsets.all(16),
body: const Padding(
padding: EdgeInsets.all(16),
child: Text(
'Чтобы стать консультантом необходимо пройти короткую регистрацию. Подготовьте свои дипломы и/или сертификаты в формате jpg, они Вам пригодятся для проверки и подтверждения. Также необходимо будет указать ссылки на Ваши соц. сети и указать тип лица (физ. лицо или юр. лицо). На данный момент доступна регистрация в качестве физ. лица.\n\nВнутри Итвио разница между обычным пользователем и консультантом заключается в дополнительных возможностях последнего создавать публичные диеты, рецепты и планы питания; участвовать в ежемесячных рейтингах.',
style: TextStyle(
@@ -46,7 +46,7 @@ class _BecomeConsultantScreenState extends State<BecomeConsultantScreen> {
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Начать регистрацию',
style: TextStyle(

View File

@@ -52,12 +52,12 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
controller: scrollController,
padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'Добавьте дипломы\nи сертификаты',
style: TextStyle(
fontSize: 24,
@@ -68,7 +68,7 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
const SizedBox(height: 16),
ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => _diplomaInfo(diploma: diplomasList[index]),
separatorBuilder: (context, index) => Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
@@ -117,14 +117,14 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
Icons.keyboard_arrow_down_rounded,
color: Colors.grey.shade700,
),
contentPadding: EdgeInsets.symmetric(horizontal: 12),
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
title: Text(
diploma.date?.format('dd MMMM yyyy', 'ru') ?? 'Дата выдачи',
style: TextStyle(
color: diploma.date == null ? Colors.grey.shade400 : Colors.black,
),
),
tileColor: Color(0xFFF6F6F6),
tileColor: const Color(0xFFF6F6F6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
@@ -144,10 +144,10 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
height: 52,
width: 52,
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: Icon(
child: const Icon(
Icons.delete_outline_rounded,
),
),

View File

@@ -18,13 +18,13 @@ class _LastStepScreenState extends State<LastStepScreen> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80, top: 16),
padding: const EdgeInsets.only(bottom: 80, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Последний шаг',
style: TextStyle(
@@ -37,7 +37,7 @@ class _LastStepScreenState extends State<LastStepScreen> {
const SizedBox(height: 16),
CheckboxListTile(
value: checkboxState,
title: Text(
title: const Text(
'Я ознакомлен и принимаю договор публичной офёрты',
style: TextStyle(
fontSize: 18,
@@ -63,8 +63,8 @@ class _LastStepScreenState extends State<LastStepScreen> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: TextButton(
onPressed: () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')),
child: Text(
onPressed: () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')),
child: const Text(
'Договор офёрты',
style: TextStyle(
height: 1,

View File

@@ -29,12 +29,12 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
Widget build(BuildContext context) {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'Загрузите фото или сканы дипломов и сертификатов',
style: TextStyle(
fontSize: 24,
@@ -46,7 +46,7 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 3 / 4,
crossAxisSpacing: 8,
@@ -67,7 +67,7 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
},
child: Ink(
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: Icon(
@@ -98,7 +98,7 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
children: [
Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
image: DecorationImage(
@@ -119,14 +119,14 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
});
_saveState();
},
customBorder: CircleBorder(),
customBorder: const CircleBorder(),
child: Ink(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Color(0xFFF1F2F6),
shape: BoxShape.circle,
),
child: Icon(
child: const Icon(
size: 20,
Icons.close,
color: Colors.black,

View File

@@ -8,21 +8,21 @@ class RegistrationAsScreen extends StatefulWidget {
State<RegistrationAsScreen> createState() => _RegistrationAsScreenState();
}
enum RegistrationAsType { Physical, SelfBusy, IP, OOO }
enum RegistrationAsType { physical, selfBusy, iP, ooo }
class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
RegistrationAsType registrationAsType = RegistrationAsType.Physical;
RegistrationAsType registrationAsType = RegistrationAsType.physical;
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80, top: 16),
padding: const EdgeInsets.only(bottom: 80, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Регистрация в качестве',
style: TextStyle(
@@ -34,9 +34,9 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
),
const SizedBox(height: 16),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.Physical,
value: RegistrationAsType.physical,
groupValue: registrationAsType,
title: Text(
title: const Text(
'Физического лица',
style: TextStyle(
fontSize: 18,
@@ -45,12 +45,12 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
),
activeColor: appTheme.blueA400,
onChanged: (value) {},
contentPadding: EdgeInsets.symmetric(horizontal: 8),
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.SelfBusy,
value: RegistrationAsType.selfBusy,
groupValue: registrationAsType,
title: Text(
title: const Text(
'Самозанятого',
style: TextStyle(
fontSize: 18,
@@ -58,12 +58,12 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
),
),
onChanged: null,
contentPadding: EdgeInsets.symmetric(horizontal: 8),
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.IP,
value: RegistrationAsType.iP,
groupValue: registrationAsType,
title: Text(
title: const Text(
'Индивидуального предпринимателя',
style: TextStyle(
fontSize: 18,
@@ -71,12 +71,12 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
),
),
onChanged: null,
contentPadding: EdgeInsets.symmetric(horizontal: 8),
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.OOO,
value: RegistrationAsType.ooo,
groupValue: registrationAsType,
title: Text(
title: const Text(
'Общества с ограниченной ответственностью',
style: TextStyle(
fontSize: 18,
@@ -84,16 +84,16 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
),
),
onChanged: null,
contentPadding: EdgeInsets.symmetric(horizontal: 8),
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
Padding(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 16,
),
child: _divider(context),
),
Padding(
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'* На данный момент регистрация доступна только в качестве физического лица. Остальные варианты скоро появятся',

View File

@@ -17,21 +17,21 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
final telegramController = TextEditingController();
final webSiteController = TextEditingController();
var maskFormatter = new MaskTextInputFormatter(
var maskFormatter = MaskTextInputFormatter(
mask: 'https://########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
},
type: MaskAutoCompletionType.lazy,
);
var maskTgFormatter = new MaskTextInputFormatter(
var maskTgFormatter = MaskTextInputFormatter(
mask: 'https://tg.me/########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
},
type: MaskAutoCompletionType.lazy,
);
var maskVkFormatter = new MaskTextInputFormatter(
var maskVkFormatter = MaskTextInputFormatter(
mask: 'https://vk.com/########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
@@ -50,12 +50,12 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'Социальные сети',
style: TextStyle(
fontSize: 24,
@@ -70,9 +70,9 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
Container(
height: 52,
width: 52,
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: SvgPicture.asset(
@@ -100,9 +100,9 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
Container(
height: 52,
width: 52,
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: SvgPicture.asset(
@@ -130,9 +130,9 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
Container(
height: 52,
width: 52,
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: SvgPicture.asset(

View File

@@ -39,7 +39,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.2,
padding: EdgeInsets.only(left: 16, right: 4),
padding: const EdgeInsets.only(left: 16, right: 4),
child: FloatingActionButton.extended(
heroTag: 'backButtonRegistration',
highlightElevation: 0,
@@ -48,7 +48,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: Color(0xFFEAF2FD),
backgroundColor: const Color(0xFFEAF2FD),
onPressed: () async {
setState(() {
pageController.previousPage(
@@ -66,7 +66,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.only(left: 4, right: 16),
padding: const EdgeInsets.only(left: 4, right: 16),
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
highlightElevation: 0,
@@ -86,17 +86,18 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
});
try {
await registrationConsultantCubit.registerConsultant();
if (!context.mounted) return;
await showModalBottomSheet(
useRootNavigator: true,
showDragHandle: true,
context: context,
builder: (context) => Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Спасибо!\nВаши данные отправлены на модерацию',
textAlign: TextAlign.center,
style: TextStyle(
@@ -112,7 +113,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
height: 160,
),
const SizedBox(height: 16),
Text(
const Text(
'В течении трех рабочих дней Вам придет уведомление о смене статуса',
textAlign: TextAlign.center,
style: TextStyle(
@@ -134,7 +135,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Закрыть',
style: TextStyle(
@@ -151,6 +152,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
);
} catch (e) {
if (!context.mounted) return;
showDialog(
context: context,
builder: (context) => AlertDialog(
@@ -176,7 +178,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
context: context,
builder: (context) => AlertDialog(
actionsPadding: const EdgeInsets.symmetric(horizontal: 4),
content: Text('Примите договор публичной офёрты'),
content: const Text('Примите договор публичной офёрты'),
actions: [
TextButton(
child: const Text('Ок'),
@@ -198,7 +200,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
});
}
},
label: isLoading ? CircularProgressIndicator() : Text(
label: isLoading ? const CircularProgressIndicator() : Text(
'Продолжить',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),
),
@@ -210,7 +212,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
automaticallyImplyLeading: false,
leading: Builder(
builder: (context) => IconButton(
icon: Icon(Icons.close_rounded),
icon: const Icon(Icons.close_rounded),
onPressed: () => GoRouter.of(context).pop(),
),
),
@@ -249,7 +251,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
),
body: PageView(
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
controller: pageController,
onPageChanged: (index) {
setState(() {
@@ -257,7 +259,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
progressValue = step / 6;
});
},
children: [
children: const [
CertificatesAndDiplomasScreen(),
PhotoOrScansScreen(),
AdditionalSettingsScreen(),

View File

@@ -50,11 +50,11 @@ class _ConsultantService implements ConsultantService {
}
final _options = _setStreamType<List<String>>(
Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'/api/consultant_request/photos/upload',

View File

@@ -12,8 +12,7 @@ part of 'rating_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
RatingModel _$RatingModelFromJson(Map<String, dynamic> json) {
return _RatingModel.fromJson(json);
@@ -38,9 +37,8 @@ mixin _$RatingModel {
/// @nodoc
abstract class $RatingModelCopyWith<$Res> {
factory $RatingModelCopyWith(
RatingModel value,
$Res Function(RatingModel) then,
) = _$RatingModelCopyWithImpl<$Res, RatingModel>;
RatingModel value, $Res Function(RatingModel) then) =
_$RatingModelCopyWithImpl<$Res, RatingModel>;
@useResult
$Res call({DateTime date, String title, int amount});
}
@@ -64,26 +62,20 @@ class _$RatingModelCopyWithImpl<$Res, $Val extends RatingModel>
Object? title = null,
Object? amount = null,
}) {
return _then(
_value.copyWith(
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
amount:
null == amount
? _value.amount
: amount // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
return _then(_value.copyWith(
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
amount: null == amount
? _value.amount
: amount // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
@@ -91,9 +83,8 @@ class _$RatingModelCopyWithImpl<$Res, $Val extends RatingModel>
abstract class _$$RatingModelImplCopyWith<$Res>
implements $RatingModelCopyWith<$Res> {
factory _$$RatingModelImplCopyWith(
_$RatingModelImpl value,
$Res Function(_$RatingModelImpl) then,
) = __$$RatingModelImplCopyWithImpl<$Res>;
_$RatingModelImpl value, $Res Function(_$RatingModelImpl) then) =
__$$RatingModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({DateTime date, String title, int amount});
@@ -104,9 +95,8 @@ class __$$RatingModelImplCopyWithImpl<$Res>
extends _$RatingModelCopyWithImpl<$Res, _$RatingModelImpl>
implements _$$RatingModelImplCopyWith<$Res> {
__$$RatingModelImplCopyWithImpl(
_$RatingModelImpl _value,
$Res Function(_$RatingModelImpl) _then,
) : super(_value, _then);
_$RatingModelImpl _value, $Res Function(_$RatingModelImpl) _then)
: super(_value, _then);
/// Create a copy of RatingModel
/// with the given fields replaced by the non-null parameter values.
@@ -117,36 +107,28 @@ class __$$RatingModelImplCopyWithImpl<$Res>
Object? title = null,
Object? amount = null,
}) {
return _then(
_$RatingModelImpl(
date:
null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
amount:
null == amount
? _value.amount
: amount // ignore: cast_nullable_to_non_nullable
as int,
),
);
return _then(_$RatingModelImpl(
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
amount: null == amount
? _value.amount
: amount // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RatingModelImpl implements _RatingModel {
_$RatingModelImpl({
required this.date,
required this.title,
required this.amount,
});
_$RatingModelImpl(
{required this.date, required this.title, required this.amount});
factory _$RatingModelImpl.fromJson(Map<String, dynamic> json) =>
_$$RatingModelImplFromJson(json);
@@ -187,16 +169,17 @@ class _$RatingModelImpl implements _RatingModel {
@override
Map<String, dynamic> toJson() {
return _$$RatingModelImplToJson(this);
return _$$RatingModelImplToJson(
this,
);
}
}
abstract class _RatingModel implements RatingModel {
factory _RatingModel({
required final DateTime date,
required final String title,
required final int amount,
}) = _$RatingModelImpl;
factory _RatingModel(
{required final DateTime date,
required final String title,
required final int amount}) = _$RatingModelImpl;
factory _RatingModel.fromJson(Map<String, dynamic> json) =
_$RatingModelImpl.fromJson;

View File

@@ -37,11 +37,11 @@ class ConsultantRatingPageContent extends StatelessWidget {
body: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 16),
RatingWidget(
const SizedBox(height: 16),
const RatingWidget(
rating: 1058,
),
SizedBox(height: 16),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CustomOutlinedButton(
@@ -49,15 +49,15 @@ class ConsultantRatingPageContent extends StatelessWidget {
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () {},
),
),
SizedBox(height: 16),
StatisticWidget(),
SizedBox(height: 16),
const SizedBox(height: 16),
const StatisticWidget(),
const SizedBox(height: 16),
RatingHistoryWidget(
ratingHistory: [
RatingModel(date: DateTime.now(), title: ' djkasjdasjkdkjasjkdjkaskjdjklasjkld', amount: 201300),

View File

@@ -51,11 +51,11 @@ class _PeriodFilterWidgetState extends State<PeriodFilterWidget> {
items: periodDropDownTitles
.mapIndexed(
(index, value) => DropdownMenuItem(
value: periodDropDownTitles[index],
child: Text(
periodDropDownTitles[index],
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
value: periodDropDownTitles[index],
),
)
.toList(),

View File

@@ -12,7 +12,7 @@ class RatingHistoryItem extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
height: 80,
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: appTheme.gray100,
borderRadius: BorderRadius.circular(20),
@@ -29,7 +29,7 @@ class RatingHistoryItem extends StatelessWidget {
date.format('dd.MM.yyyy'),
style: TextStyles.textXSSemibold.copyWith(color: appTheme.gray),
),
Spacer(),
const Spacer(),
Text(
title,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),

View File

@@ -15,7 +15,7 @@ class RatingHistoryWidget extends StatelessWidget {
Widget build(BuildContext context) {
final s = S.of(context);
return MainBackgroundBouble(
padding: EdgeInsets.only(
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
@@ -28,7 +28,7 @@ class RatingHistoryWidget extends StatelessWidget {
s.rating_history,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
Spacer(),
const Spacer(),
SvgPicture.asset(
'assets/icons/question_mark.svg',
height: 22,
@@ -40,15 +40,15 @@ class RatingHistoryWidget extends StatelessWidget {
),
],
),
SizedBox(
const SizedBox(
height: 16,
),
PeriodFilterWidget(),
SizedBox(
const PeriodFilterWidget(),
const SizedBox(
height: 12,
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Padding(
padding: index == ratingHistory.length - 1 ? EdgeInsets.zero : const EdgeInsets.only(bottom: 12),

View File

@@ -40,7 +40,7 @@ class RatingWidget extends StatelessWidget {
rating.toString(),
style: TextStyles.headingFS40FW600.copyWith(color: appTheme.blueA400),
),
SizedBox(height: 4),
const SizedBox(height: 4),
Text(
s.your_rating,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),

View File

@@ -10,7 +10,7 @@ class StatisticBouble extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
height: 80,
padding: EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
color: appTheme.gray100,
borderRadius: BorderRadius.circular(20),
@@ -22,7 +22,7 @@ class StatisticBouble extends StatelessWidget {
number.toString(),
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.blueA400),
),
SizedBox(
const SizedBox(
height: 4,
),
Text(

View File

@@ -14,7 +14,7 @@ class StatisticWidget extends StatelessWidget {
Widget build(BuildContext context) {
final s = S.of(context);
return MainBackgroundBouble(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
children: [
Row(
@@ -23,7 +23,7 @@ class StatisticWidget extends StatelessWidget {
s.statistic,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
Spacer(),
const Spacer(),
SvgPicture.asset(
'assets/icons/question_mark.svg',
height: 22,
@@ -35,41 +35,41 @@ class StatisticWidget extends StatelessWidget {
),
],
),
SizedBox(
const SizedBox(
height: 16,
),
PeriodFilterWidget(),
SizedBox(
const PeriodFilterWidget(),
const SizedBox(
height: 12,
),
Row(
children: [
Expanded(child: StatisticBouble(number: 12, title: s.invited_people_count)),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: StatisticBouble(number: 12, title: s.published_posts_count)),
],
),
SizedBox(
const SizedBox(
height: 8,
),
Row(
children: [
Expanded(child: StatisticBouble(number: 12, title: s.published_recipes_count)),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: StatisticBouble(number: 12, title: s.published_diets_count)),
],
),
SizedBox(
const SizedBox(
height: 8,
),
Row(
children: [
Expanded(child: StatisticBouble(number: 12, title: s.consultations_count)),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: StatisticBouble(number: 12, title: s.active_consultations_count)),
],
),
SizedBox(
const SizedBox(
height: 8,
),
],

View File

@@ -29,11 +29,11 @@ class ConsultationsEntity {
}
enum LegendOfPlanDay {
Empty, // Дневник не заполнялся и никаких движений в тот день не было.
NotCompleted, // Начат дневник питания, но не закончен.
EndBuyUserDontCheck, // Дневник закончен и прокомментирован консультантом но не просмотрен пользователем.
CompletedButConsultantCommentEmpty, // Дневник заполнен, но не прокомментирован консультантом.
FullCompleted, // Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии.
empty, // Дневник не заполнялся и никаких движений в тот день не было.
notCompleted, // Начат дневник питания, но не закончен.
endBuyUserDontCheck, // Дневник закончен и прокомментирован консультантом но не просмотрен пользователем.
completedButConsultantCommentEmpty, // Дневник заполнен, но не прокомментирован консультантом.
fullCompleted, // Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии.
}
class DayOfPlanEntity {
@@ -53,7 +53,7 @@ List<ConsultationsEntity> generateTestData() {
List<ConsultationsEntity> testConsultations = List.generate(20, (index) {
DateTime startDate = DateTime.now().subtract(Duration(days: random.nextInt(30)));
DateTime endDate = startDate.add(Duration(days: 30));
DateTime endDate = startDate.add(const Duration(days: 30));
List<DayOfPlanEntity> days = List.generate(30, (i) {
DateTime dayDate = startDate.add(Duration(days: i));

View File

@@ -8,18 +8,18 @@ class ConsultationsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFFF0F2F5),
backgroundColor: const Color(0xFFF0F2F5),
appBar: AppBar(
title: Text('Консультации'),
title: const Text('Консультации'),
centerTitle: true,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.vertical(
bottom: Radius.circular(12),
),
),
),
body: ListView.separated(
padding: EdgeInsets.symmetric(vertical: 12),
padding: const EdgeInsets.symmetric(vertical: 12),
itemBuilder: (context, index) => ConsultationCardWidget(
consultationsEntity: testData[index],
),

View File

@@ -1,155 +0,0 @@
import 'package:flutter/material.dart';
class InfoByOrderScreen extends StatefulWidget {
static const name = 'infoByOrderScreen';
static const path = '/info-by-order-screen';
const InfoByOrderScreen({super.key});
@override
State<InfoByOrderScreen> createState() => _InfoByOrderScreenState();
}
class _InfoByOrderScreenState extends State<InfoByOrderScreen> {
bool _isHelpExpanded = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Информация о заказе"), leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {})),
body: ListView(
padding: EdgeInsets.all(16.0),
children: [
_buildProfileSection(),
SizedBox(height: 10),
_buildOrderStatus(),
SizedBox(height: 20),
_buildPlanDetails(),
SizedBox(height: 20),
_buildOptionDetails(),
SizedBox(height: 20),
_buildOrderProgress(),
SizedBox(height: 20),
_buildHelpSection(),
SizedBox(height: 20),
_buildCancelButton(),
],
),
);
}
Widget _buildProfileSection() {
return Row(
children: [
CircleAvatar(
radius: 30,
backgroundImage: AssetImage('assets/profile.jpg'), // Замените на реальный путь
),
SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Дмитрий Коваль", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
Text("Консультант 128-й в рейтинге", style: TextStyle(color: Colors.grey)),
],
),
],
);
}
Widget _buildOrderStatus() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Статус заказа", style: TextStyle(fontWeight: FontWeight.bold)),
Chip(label: Text("Заказ оплачен", style: TextStyle(color: Colors.white)), backgroundColor: Colors.green),
],
),
Text("Сумма заказа: 2500₽"),
Text("Время выполнения плана: 7 дней"),
],
);
}
Widget _buildPlanDetails() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Название плана", style: TextStyle(fontWeight: FontWeight.bold)),
Text("В мире, где технологии становятся все более..."),
SizedBox(height: 10),
Image.asset('assets/plan_image.jpg', height: 150, fit: BoxFit.cover),
],
);
}
Widget _buildOptionDetails() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Название опции", style: TextStyle(fontWeight: FontWeight.bold)),
Text("Поддержка 24/7"),
Text("Составление индивидуальной диеты"),
Text("Длинное название опции..."),
],
);
}
Widget _buildOrderProgress() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Этапы заказа", style: TextStyle(fontWeight: FontWeight.bold)),
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ создан")),
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Выбрана дата старта")),
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ оплачен")),
ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("В процессе")),
ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("Завершен")),
],
);
}
Widget _buildHelpSection() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
leading: Icon(Icons.help_outline),
title: Text("Помощь", style: TextStyle(fontWeight: FontWeight.bold)),
trailing: Icon(_isHelpExpanded ? Icons.expand_less : Icons.expand_more),
onTap: () {
setState(() {
_isHelpExpanded = !_isHelpExpanded;
});
},
),
if (_isHelpExpanded) ...[
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Продавец не отвечает на мои сообщения", style: TextStyle(fontWeight: FontWeight.bold)),
Text("Ответ некоторых продавцов может занять больше времени, чем вы ожидали..."),
SizedBox(height: 10),
Text("Работа, которую сдал продавец, отличалась от описания", style: TextStyle(fontWeight: FontWeight.bold)),
Text("У вас есть три дня, чтобы проверить сданную на проверку работу..."),
],
),
),
],
],
);
}
Widget _buildCancelButton() {
return ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.red, padding: EdgeInsets.symmetric(vertical: 15)),
onPressed: () {},
child: Text("Отменить заказ", style: TextStyle(color: Colors.white)),
);
}
}

View File

@@ -42,7 +42,7 @@ class ConsultationCardWidget extends StatelessWidget {
children: [
Row(
children: [
CircleAvatar(
const CircleAvatar(
radius: 30,
),
const SizedBox(width: 12),
@@ -51,7 +51,7 @@ class ConsultationCardWidget extends StatelessWidget {
children: [
Text(
consultationsEntity.name,
style: TextStyle(
style: const TextStyle(
height: 1,
color: Color(0xFF323F4B),
fontSize: 16,
@@ -61,7 +61,7 @@ class ConsultationCardWidget extends StatelessWidget {
const SizedBox(height: 4),
Text(
consultationsEntity.planName,
style: TextStyle(
style: const TextStyle(
height: 1,
color: Color(0xFF88949F),
fontSize: 14,
@@ -89,14 +89,14 @@ class ConsultationCardWidget extends StatelessWidget {
),
),
const SizedBox(height: 12),
CustomDivider(),
const CustomDivider(),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'День ${consultationsEntity.currentDayOfPlan} из ${consultationsEntity.totalDaysOfPlan}',
style: TextStyle(
style: const TextStyle(
height: 1,
color: Color(0xFF323F4B),
fontSize: 16,
@@ -116,7 +116,7 @@ class ConsultationCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Легенда',
style: TextStyle(
height: 1,
@@ -130,7 +130,7 @@ class ConsultationCardWidget extends StatelessWidget {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => _legendTitle(titles[index], legendColors[index]),
separatorBuilder: (context, index) => SizedBox(height: 16),
separatorBuilder: (context, index) => const SizedBox(height: 16),
itemCount: titles.length,
),
const SizedBox(height: 16),
@@ -139,7 +139,7 @@ class ConsultationCardWidget extends StatelessWidget {
),
);
},
child: Icon(
child: const Icon(
Icons.help_outline_rounded,
color: Color(0xFF323F4B),
size: 20,
@@ -157,11 +157,11 @@ class ConsultationCardWidget extends StatelessWidget {
headerVisible: false,
calendarFormat: CalendarFormat.week,
calendarStyle: CalendarStyle(
weekendDecoration: BoxDecoration(
weekendDecoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
defaultDecoration: BoxDecoration(
defaultDecoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
@@ -169,7 +169,7 @@ class ConsultationCardWidget extends StatelessWidget {
color: appTheme.blueA400,
shape: BoxShape.circle,
),
todayTextStyle: TextStyle(
todayTextStyle: const TextStyle(
color: Colors.black,
),
todayDecoration: BoxDecoration(
@@ -183,11 +183,11 @@ class ConsultationCardWidget extends StatelessWidget {
),
),
const SizedBox(height: 16),
CustomDivider(),
const CustomDivider(),
const SizedBox(height: 12),
Text(
'${consultationsEntity.paymentAmount} ₽',
style: TextStyle(
style: const TextStyle(
color: Color(0xFF019A3E),
fontSize: 20,
fontWeight: FontWeight.w600,
@@ -201,12 +201,12 @@ class ConsultationCardWidget extends StatelessWidget {
onTap: () {},
child: Ink(
width: MediaQuery.of(context).size.width - 32 - 52 - 8,
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Комментировать отчёт',
style: TextStyle(
@@ -227,9 +227,9 @@ class ConsultationCardWidget extends StatelessWidget {
width: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
),
child: Center(
child: const Center(
child: Icon(
Icons.chat_outlined,
size: 24,
@@ -261,7 +261,7 @@ class ConsultationCardWidget extends StatelessWidget {
Flexible(
child: Text(
text,
style: TextStyle(
style: const TextStyle(
height: 1,
fontSize: 16,
fontWeight: FontWeight.w500,

View File

@@ -12,8 +12,7 @@ part of 'create_diet_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CreateDietModel {
@@ -37,20 +36,18 @@ mixin _$CreateDietModel {
/// @nodoc
abstract class $CreateDietModelCopyWith<$Res> {
factory $CreateDietModelCopyWith(
CreateDietModel value,
$Res Function(CreateDietModel) then,
) = _$CreateDietModelCopyWithImpl<$Res, CreateDietModel>;
CreateDietModel value, $Res Function(CreateDietModel) then) =
_$CreateDietModelCopyWithImpl<$Res, CreateDietModel>;
@useResult
$Res call({
String? imageUrl,
String? name,
String? details,
DietState? state,
int? duration,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule,
});
$Res call(
{String? imageUrl,
String? name,
String? details,
DietState? state,
int? duration,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
/// @nodoc
@@ -77,73 +74,60 @@ class _$CreateDietModelCopyWithImpl<$Res, $Val extends CreateDietModel>
Object? image = freezed,
Object? dailySchedule = freezed,
}) {
return _then(
_value.copyWith(
imageUrl:
freezed == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String?,
name:
freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
details:
freezed == details
? _value.details
: details // ignore: cast_nullable_to_non_nullable
as String?,
state:
freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as DietState?,
duration:
freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type:
null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as XFile?,
dailySchedule:
freezed == dailySchedule
? _value.dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
as List<List<List<DailySchedule>>>?,
)
as $Val,
);
return _then(_value.copyWith(
imageUrl: freezed == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String?,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
details: freezed == details
? _value.details
: details // ignore: cast_nullable_to_non_nullable
as String?,
state: freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as DietState?,
duration: freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as XFile?,
dailySchedule: freezed == dailySchedule
? _value.dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
as List<List<List<DailySchedule>>>?,
) as $Val);
}
}
/// @nodoc
abstract class _$$CreateDietModelImplCopyWith<$Res>
implements $CreateDietModelCopyWith<$Res> {
factory _$$CreateDietModelImplCopyWith(
_$CreateDietModelImpl value,
$Res Function(_$CreateDietModelImpl) then,
) = __$$CreateDietModelImplCopyWithImpl<$Res>;
factory _$$CreateDietModelImplCopyWith(_$CreateDietModelImpl value,
$Res Function(_$CreateDietModelImpl) then) =
__$$CreateDietModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String? imageUrl,
String? name,
String? details,
DietState? state,
int? duration,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule,
});
$Res call(
{String? imageUrl,
String? name,
String? details,
DietState? state,
int? duration,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
/// @nodoc
@@ -151,9 +135,8 @@ class __$$CreateDietModelImplCopyWithImpl<$Res>
extends _$CreateDietModelCopyWithImpl<$Res, _$CreateDietModelImpl>
implements _$$CreateDietModelImplCopyWith<$Res> {
__$$CreateDietModelImplCopyWithImpl(
_$CreateDietModelImpl _value,
$Res Function(_$CreateDietModelImpl) _then,
) : super(_value, _then);
_$CreateDietModelImpl _value, $Res Function(_$CreateDietModelImpl) _then)
: super(_value, _then);
/// Create a copy of CreateDietModel
/// with the given fields replaced by the non-null parameter values.
@@ -169,68 +152,58 @@ class __$$CreateDietModelImplCopyWithImpl<$Res>
Object? image = freezed,
Object? dailySchedule = freezed,
}) {
return _then(
_$CreateDietModelImpl(
imageUrl:
freezed == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String?,
name:
freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
details:
freezed == details
? _value.details
: details // ignore: cast_nullable_to_non_nullable
as String?,
state:
freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as DietState?,
duration:
freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type:
null == type
? _value._type
: type // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as XFile?,
dailySchedule:
freezed == dailySchedule
? _value._dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
as List<List<List<DailySchedule>>>?,
),
);
return _then(_$CreateDietModelImpl(
imageUrl: freezed == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String?,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
details: freezed == details
? _value.details
: details // ignore: cast_nullable_to_non_nullable
as String?,
state: freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as DietState?,
duration: freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type: null == type
? _value._type
: type // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as XFile?,
dailySchedule: freezed == dailySchedule
? _value._dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
as List<List<List<DailySchedule>>>?,
));
}
}
/// @nodoc
class _$CreateDietModelImpl extends _CreateDietModel {
const _$CreateDietModelImpl({
this.imageUrl,
this.name,
this.details,
this.state,
this.duration,
required final Map<String, bool> type,
this.image,
final List<List<List<DailySchedule>>>? dailySchedule,
}) : _type = type,
_dailySchedule = dailySchedule,
super._();
const _$CreateDietModelImpl(
{this.imageUrl,
this.name,
this.details,
this.state,
this.duration,
required final Map<String, bool> type,
this.image,
final List<List<List<DailySchedule>>>? dailySchedule})
: _type = type,
_dailySchedule = dailySchedule,
super._();
@override
final String? imageUrl;
@@ -281,24 +254,21 @@ class _$CreateDietModelImpl extends _CreateDietModel {
other.duration == duration) &&
const DeepCollectionEquality().equals(other._type, _type) &&
(identical(other.image, image) || other.image == image) &&
const DeepCollectionEquality().equals(
other._dailySchedule,
_dailySchedule,
));
const DeepCollectionEquality()
.equals(other._dailySchedule, _dailySchedule));
}
@override
int get hashCode => Object.hash(
runtimeType,
imageUrl,
name,
details,
state,
duration,
const DeepCollectionEquality().hash(_type),
image,
const DeepCollectionEquality().hash(_dailySchedule),
);
runtimeType,
imageUrl,
name,
details,
state,
duration,
const DeepCollectionEquality().hash(_type),
image,
const DeepCollectionEquality().hash(_dailySchedule));
/// Create a copy of CreateDietModel
/// with the given fields replaced by the non-null parameter values.
@@ -307,22 +277,20 @@ class _$CreateDietModelImpl extends _CreateDietModel {
@pragma('vm:prefer-inline')
_$$CreateDietModelImplCopyWith<_$CreateDietModelImpl> get copyWith =>
__$$CreateDietModelImplCopyWithImpl<_$CreateDietModelImpl>(
this,
_$identity,
);
this, _$identity);
}
abstract class _CreateDietModel extends CreateDietModel {
const factory _CreateDietModel({
final String? imageUrl,
final String? name,
final String? details,
final DietState? state,
final int? duration,
required final Map<String, bool> type,
final XFile? image,
final List<List<List<DailySchedule>>>? dailySchedule,
}) = _$CreateDietModelImpl;
const factory _CreateDietModel(
{final String? imageUrl,
final String? name,
final String? details,
final DietState? state,
final int? duration,
required final Map<String, bool> type,
final XFile? image,
final List<List<List<DailySchedule>>>? dailySchedule}) =
_$CreateDietModelImpl;
const _CreateDietModel._() : super._();
@override

View File

@@ -39,7 +39,7 @@ class CreateDietScreen extends StatelessWidget {
}
class CreateDietScreenContent extends StatefulWidget {
CreateDietScreenContent({super.key, this.diet});
const CreateDietScreenContent({super.key, this.diet});
final Diet? diet;
@override
@@ -66,18 +66,20 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
return BlocBuilder<CreateDietCubit, CreateDietState>(
builder: (context, state) {
if (state.published) {
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(const Duration(milliseconds: 500), () {
if (!context.mounted) return;
context.pop();
showBottomSheetWithBlur(
userRootNavigator: true,
context: context,
child: SuccessPublishedDietBottomSheet(
title: '${state.dietData.name ?? 'Диета'}',
title: state.dietData.name ?? 'Диета',
),
);
});
} else if (state.drafted) {
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(const Duration(milliseconds: 500), () {
if (!context.mounted) return;
context.pop();
showBottomSheetWithBlur(
context: context,
@@ -103,13 +105,13 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
body: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 8),
const SizedBox(height: 8),
MainBackgroundBouble(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16),
const SizedBox(height: 16),
CustomTextFormField(
hintText: s.enter_diet_name,
controller: nameController,
@@ -119,12 +121,12 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
},
),
if (state.dietNameError != null) ...[
SizedBox(
const SizedBox(
height: 4,
),
CustomErrorWidget(error: state.dietNameError ?? ''),
],
SizedBox(height: 12),
const SizedBox(height: 12),
SizedBox(
height: 132,
child: CustomTextFormField(
@@ -141,30 +143,30 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
),
),
if (state.dietDescriptionError != null) ...[
SizedBox(
const SizedBox(
height: 4,
),
CustomErrorWidget(error: state.dietDescriptionError ?? ''),
],
SizedBox(height: 12),
DietDurationDropDownWidget(),
SizedBox(height: 12),
StatusDropDownWidget(),
SizedBox(height: 16),
DietTypeChoiceWidget(),
SizedBox(height: 16),
DietImagePickerWidget(),
SizedBox(height: 16),
const SizedBox(height: 12),
const DietDurationDropDownWidget(),
const SizedBox(height: 12),
const StatusDropDownWidget(),
const SizedBox(height: 16),
const DietTypeChoiceWidget(),
const SizedBox(height: 16),
const DietImagePickerWidget(),
const SizedBox(height: 16),
],
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
MainBackgroundBouble(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Center(
child: Text(
s.diet_plan + ' (${state.dietData.duration ?? 0} ' + getDayForm(state.dietData.duration ?? 0, s) + ')',
'${s.diet_plan} (${state.dietData.duration ?? 0} ${getDayForm(state.dietData.duration ?? 0, s)})',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
@@ -172,16 +174,16 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
),
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
ListView.separated(
padding: const EdgeInsets.all(0),
itemBuilder: (context, index) => DayWidget(index: index),
itemCount: state.dietData.dailySchedule?.length ?? 0,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) => SizedBox(height: 8),
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) => const SizedBox(height: 8),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
@@ -192,19 +194,20 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
: () async {
final diet = await context.read<CreateDietCubit>().getDietForPreview();
if (diet == null) return;
if (!context.mounted) return;
GoRouter.of(context).pushNamed(DietPreviewScreen.name, extra: diet);
},
text: s.preview,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.gray),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.dottedBorder),
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
if (state.isDietPublishing)
Loader()
const Loader()
else
CustomOutlinedButton(
onPressed: () async {
@@ -213,11 +216,13 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
widget.diet!.id,
);
if (result == 'error') {
if (!context.mounted) return;
showErrorDialog(context, title: '${s.could_not_update_diet} ${state.dietData.name}');
}
} else {
final result = await context.read<CreateDietCubit>().createDiet();
if (result == 'error') {
if (!context.mounted) return;
showErrorDialog(context, title: '${s.could_not_publish_diet} ${state.dietData.name}');
}
}
@@ -226,14 +231,14 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
),
],
),
),
SizedBox(height: 20),
const SizedBox(height: 20),
],
),
),

View File

@@ -53,7 +53,7 @@ class CreateDietCubit extends Cubit<CreateDietState> {
name: diet.name,
duration: diet.duration,
type: type,
imageUrl: baseUrl + '/storage/' + diet.image,
imageUrl: '$baseUrl/storage/${diet.image}',
),
);
emit(state.copyWith(dietStateIndex: dietStateIndex, durationIndex: durationValues.indexOf(diet.duration)));

View File

@@ -12,8 +12,7 @@ part of 'create_diet_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CreateDietState {
@@ -45,28 +44,26 @@ mixin _$CreateDietState {
/// @nodoc
abstract class $CreateDietStateCopyWith<$Res> {
factory $CreateDietStateCopyWith(
CreateDietState value,
$Res Function(CreateDietState) then,
) = _$CreateDietStateCopyWithImpl<$Res, CreateDietState>;
CreateDietState value, $Res Function(CreateDietState) then) =
_$CreateDietStateCopyWithImpl<$Res, CreateDietState>;
@useResult
$Res call({
bool isLoading,
bool isDietPublishing,
String? errorMessage,
CreateDietModel dietData,
List<List<DailySchedule>>? copiedDay,
String? dietNameError,
String? dietDescriptionError,
String? dietDurationError,
String? dietStateError,
String? dietImageError,
List<String> dailyScheduleErrors,
int? durationIndex,
int? dietStateIndex,
bool published,
bool drafted,
bool isDietBeingEdited,
});
$Res call(
{bool isLoading,
bool isDietPublishing,
String? errorMessage,
CreateDietModel dietData,
List<List<DailySchedule>>? copiedDay,
String? dietNameError,
String? dietDescriptionError,
String? dietDurationError,
String? dietStateError,
String? dietImageError,
List<String> dailyScheduleErrors,
int? durationIndex,
int? dietStateIndex,
bool published,
bool drafted,
bool isDietBeingEdited});
$CreateDietModelCopyWith<$Res> get dietData;
}
@@ -103,91 +100,72 @@ class _$CreateDietStateCopyWithImpl<$Res, $Val extends CreateDietState>
Object? drafted = null,
Object? isDietBeingEdited = null,
}) {
return _then(
_value.copyWith(
isLoading:
null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
isDietPublishing:
null == isDietPublishing
? _value.isDietPublishing
: isDietPublishing // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage:
freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
dietData:
null == dietData
? _value.dietData
: dietData // ignore: cast_nullable_to_non_nullable
as CreateDietModel,
copiedDay:
freezed == copiedDay
? _value.copiedDay
: copiedDay // ignore: cast_nullable_to_non_nullable
as List<List<DailySchedule>>?,
dietNameError:
freezed == dietNameError
? _value.dietNameError
: dietNameError // ignore: cast_nullable_to_non_nullable
as String?,
dietDescriptionError:
freezed == dietDescriptionError
? _value.dietDescriptionError
: dietDescriptionError // ignore: cast_nullable_to_non_nullable
as String?,
dietDurationError:
freezed == dietDurationError
? _value.dietDurationError
: dietDurationError // ignore: cast_nullable_to_non_nullable
as String?,
dietStateError:
freezed == dietStateError
? _value.dietStateError
: dietStateError // ignore: cast_nullable_to_non_nullable
as String?,
dietImageError:
freezed == dietImageError
? _value.dietImageError
: dietImageError // ignore: cast_nullable_to_non_nullable
as String?,
dailyScheduleErrors:
null == dailyScheduleErrors
? _value.dailyScheduleErrors
: dailyScheduleErrors // ignore: cast_nullable_to_non_nullable
as List<String>,
durationIndex:
freezed == durationIndex
? _value.durationIndex
: durationIndex // ignore: cast_nullable_to_non_nullable
as int?,
dietStateIndex:
freezed == dietStateIndex
? _value.dietStateIndex
: dietStateIndex // ignore: cast_nullable_to_non_nullable
as int?,
published:
null == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as bool,
drafted:
null == drafted
? _value.drafted
: drafted // ignore: cast_nullable_to_non_nullable
as bool,
isDietBeingEdited:
null == isDietBeingEdited
? _value.isDietBeingEdited
: isDietBeingEdited // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
return _then(_value.copyWith(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
isDietPublishing: null == isDietPublishing
? _value.isDietPublishing
: isDietPublishing // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
dietData: null == dietData
? _value.dietData
: dietData // ignore: cast_nullable_to_non_nullable
as CreateDietModel,
copiedDay: freezed == copiedDay
? _value.copiedDay
: copiedDay // ignore: cast_nullable_to_non_nullable
as List<List<DailySchedule>>?,
dietNameError: freezed == dietNameError
? _value.dietNameError
: dietNameError // ignore: cast_nullable_to_non_nullable
as String?,
dietDescriptionError: freezed == dietDescriptionError
? _value.dietDescriptionError
: dietDescriptionError // ignore: cast_nullable_to_non_nullable
as String?,
dietDurationError: freezed == dietDurationError
? _value.dietDurationError
: dietDurationError // ignore: cast_nullable_to_non_nullable
as String?,
dietStateError: freezed == dietStateError
? _value.dietStateError
: dietStateError // ignore: cast_nullable_to_non_nullable
as String?,
dietImageError: freezed == dietImageError
? _value.dietImageError
: dietImageError // ignore: cast_nullable_to_non_nullable
as String?,
dailyScheduleErrors: null == dailyScheduleErrors
? _value.dailyScheduleErrors
: dailyScheduleErrors // ignore: cast_nullable_to_non_nullable
as List<String>,
durationIndex: freezed == durationIndex
? _value.durationIndex
: durationIndex // ignore: cast_nullable_to_non_nullable
as int?,
dietStateIndex: freezed == dietStateIndex
? _value.dietStateIndex
: dietStateIndex // ignore: cast_nullable_to_non_nullable
as int?,
published: null == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as bool,
drafted: null == drafted
? _value.drafted
: drafted // ignore: cast_nullable_to_non_nullable
as bool,
isDietBeingEdited: null == isDietBeingEdited
? _value.isDietBeingEdited
: isDietBeingEdited // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
/// Create a copy of CreateDietState
@@ -204,30 +182,28 @@ class _$CreateDietStateCopyWithImpl<$Res, $Val extends CreateDietState>
/// @nodoc
abstract class _$$CreateDietStateImplCopyWith<$Res>
implements $CreateDietStateCopyWith<$Res> {
factory _$$CreateDietStateImplCopyWith(
_$CreateDietStateImpl value,
$Res Function(_$CreateDietStateImpl) then,
) = __$$CreateDietStateImplCopyWithImpl<$Res>;
factory _$$CreateDietStateImplCopyWith(_$CreateDietStateImpl value,
$Res Function(_$CreateDietStateImpl) then) =
__$$CreateDietStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
bool isLoading,
bool isDietPublishing,
String? errorMessage,
CreateDietModel dietData,
List<List<DailySchedule>>? copiedDay,
String? dietNameError,
String? dietDescriptionError,
String? dietDurationError,
String? dietStateError,
String? dietImageError,
List<String> dailyScheduleErrors,
int? durationIndex,
int? dietStateIndex,
bool published,
bool drafted,
bool isDietBeingEdited,
});
$Res call(
{bool isLoading,
bool isDietPublishing,
String? errorMessage,
CreateDietModel dietData,
List<List<DailySchedule>>? copiedDay,
String? dietNameError,
String? dietDescriptionError,
String? dietDurationError,
String? dietStateError,
String? dietImageError,
List<String> dailyScheduleErrors,
int? durationIndex,
int? dietStateIndex,
bool published,
bool drafted,
bool isDietBeingEdited});
@override
$CreateDietModelCopyWith<$Res> get dietData;
@@ -238,9 +214,8 @@ class __$$CreateDietStateImplCopyWithImpl<$Res>
extends _$CreateDietStateCopyWithImpl<$Res, _$CreateDietStateImpl>
implements _$$CreateDietStateImplCopyWith<$Res> {
__$$CreateDietStateImplCopyWithImpl(
_$CreateDietStateImpl _value,
$Res Function(_$CreateDietStateImpl) _then,
) : super(_value, _then);
_$CreateDietStateImpl _value, $Res Function(_$CreateDietStateImpl) _then)
: super(_value, _then);
/// Create a copy of CreateDietState
/// with the given fields replaced by the non-null parameter values.
@@ -264,115 +239,97 @@ class __$$CreateDietStateImplCopyWithImpl<$Res>
Object? drafted = null,
Object? isDietBeingEdited = null,
}) {
return _then(
_$CreateDietStateImpl(
isLoading:
null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
isDietPublishing:
null == isDietPublishing
? _value.isDietPublishing
: isDietPublishing // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage:
freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
dietData:
null == dietData
? _value.dietData
: dietData // ignore: cast_nullable_to_non_nullable
as CreateDietModel,
copiedDay:
freezed == copiedDay
? _value._copiedDay
: copiedDay // ignore: cast_nullable_to_non_nullable
as List<List<DailySchedule>>?,
dietNameError:
freezed == dietNameError
? _value.dietNameError
: dietNameError // ignore: cast_nullable_to_non_nullable
as String?,
dietDescriptionError:
freezed == dietDescriptionError
? _value.dietDescriptionError
: dietDescriptionError // ignore: cast_nullable_to_non_nullable
as String?,
dietDurationError:
freezed == dietDurationError
? _value.dietDurationError
: dietDurationError // ignore: cast_nullable_to_non_nullable
as String?,
dietStateError:
freezed == dietStateError
? _value.dietStateError
: dietStateError // ignore: cast_nullable_to_non_nullable
as String?,
dietImageError:
freezed == dietImageError
? _value.dietImageError
: dietImageError // ignore: cast_nullable_to_non_nullable
as String?,
dailyScheduleErrors:
null == dailyScheduleErrors
? _value._dailyScheduleErrors
: dailyScheduleErrors // ignore: cast_nullable_to_non_nullable
as List<String>,
durationIndex:
freezed == durationIndex
? _value.durationIndex
: durationIndex // ignore: cast_nullable_to_non_nullable
as int?,
dietStateIndex:
freezed == dietStateIndex
? _value.dietStateIndex
: dietStateIndex // ignore: cast_nullable_to_non_nullable
as int?,
published:
null == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as bool,
drafted:
null == drafted
? _value.drafted
: drafted // ignore: cast_nullable_to_non_nullable
as bool,
isDietBeingEdited:
null == isDietBeingEdited
? _value.isDietBeingEdited
: isDietBeingEdited // ignore: cast_nullable_to_non_nullable
as bool,
),
);
return _then(_$CreateDietStateImpl(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
isDietPublishing: null == isDietPublishing
? _value.isDietPublishing
: isDietPublishing // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
dietData: null == dietData
? _value.dietData
: dietData // ignore: cast_nullable_to_non_nullable
as CreateDietModel,
copiedDay: freezed == copiedDay
? _value._copiedDay
: copiedDay // ignore: cast_nullable_to_non_nullable
as List<List<DailySchedule>>?,
dietNameError: freezed == dietNameError
? _value.dietNameError
: dietNameError // ignore: cast_nullable_to_non_nullable
as String?,
dietDescriptionError: freezed == dietDescriptionError
? _value.dietDescriptionError
: dietDescriptionError // ignore: cast_nullable_to_non_nullable
as String?,
dietDurationError: freezed == dietDurationError
? _value.dietDurationError
: dietDurationError // ignore: cast_nullable_to_non_nullable
as String?,
dietStateError: freezed == dietStateError
? _value.dietStateError
: dietStateError // ignore: cast_nullable_to_non_nullable
as String?,
dietImageError: freezed == dietImageError
? _value.dietImageError
: dietImageError // ignore: cast_nullable_to_non_nullable
as String?,
dailyScheduleErrors: null == dailyScheduleErrors
? _value._dailyScheduleErrors
: dailyScheduleErrors // ignore: cast_nullable_to_non_nullable
as List<String>,
durationIndex: freezed == durationIndex
? _value.durationIndex
: durationIndex // ignore: cast_nullable_to_non_nullable
as int?,
dietStateIndex: freezed == dietStateIndex
? _value.dietStateIndex
: dietStateIndex // ignore: cast_nullable_to_non_nullable
as int?,
published: null == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as bool,
drafted: null == drafted
? _value.drafted
: drafted // ignore: cast_nullable_to_non_nullable
as bool,
isDietBeingEdited: null == isDietBeingEdited
? _value.isDietBeingEdited
: isDietBeingEdited // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$CreateDietStateImpl implements _CreateDietState {
const _$CreateDietStateImpl({
required this.isLoading,
required this.isDietPublishing,
required this.errorMessage,
required this.dietData,
final List<List<DailySchedule>>? copiedDay,
this.dietNameError,
this.dietDescriptionError,
this.dietDurationError,
this.dietStateError,
this.dietImageError,
required final List<String> dailyScheduleErrors,
this.durationIndex,
this.dietStateIndex,
this.published = false,
this.drafted = false,
this.isDietBeingEdited = false,
}) : _copiedDay = copiedDay,
_dailyScheduleErrors = dailyScheduleErrors;
const _$CreateDietStateImpl(
{required this.isLoading,
required this.isDietPublishing,
required this.errorMessage,
required this.dietData,
final List<List<DailySchedule>>? copiedDay,
this.dietNameError,
this.dietDescriptionError,
this.dietDurationError,
this.dietStateError,
this.dietImageError,
required final List<String> dailyScheduleErrors,
this.durationIndex,
this.dietStateIndex,
this.published = false,
this.drafted = false,
this.isDietBeingEdited = false})
: _copiedDay = copiedDay,
_dailyScheduleErrors = dailyScheduleErrors;
@override
final bool isLoading;
@@ -443,10 +400,8 @@ class _$CreateDietStateImpl implements _CreateDietState {
other.errorMessage == errorMessage) &&
(identical(other.dietData, dietData) ||
other.dietData == dietData) &&
const DeepCollectionEquality().equals(
other._copiedDay,
_copiedDay,
) &&
const DeepCollectionEquality()
.equals(other._copiedDay, _copiedDay) &&
(identical(other.dietNameError, dietNameError) ||
other.dietNameError == dietNameError) &&
(identical(other.dietDescriptionError, dietDescriptionError) ||
@@ -457,10 +412,8 @@ class _$CreateDietStateImpl implements _CreateDietState {
other.dietStateError == dietStateError) &&
(identical(other.dietImageError, dietImageError) ||
other.dietImageError == dietImageError) &&
const DeepCollectionEquality().equals(
other._dailyScheduleErrors,
_dailyScheduleErrors,
) &&
const DeepCollectionEquality()
.equals(other._dailyScheduleErrors, _dailyScheduleErrors) &&
(identical(other.durationIndex, durationIndex) ||
other.durationIndex == durationIndex) &&
(identical(other.dietStateIndex, dietStateIndex) ||
@@ -474,24 +427,23 @@ class _$CreateDietStateImpl implements _CreateDietState {
@override
int get hashCode => Object.hash(
runtimeType,
isLoading,
isDietPublishing,
errorMessage,
dietData,
const DeepCollectionEquality().hash(_copiedDay),
dietNameError,
dietDescriptionError,
dietDurationError,
dietStateError,
dietImageError,
const DeepCollectionEquality().hash(_dailyScheduleErrors),
durationIndex,
dietStateIndex,
published,
drafted,
isDietBeingEdited,
);
runtimeType,
isLoading,
isDietPublishing,
errorMessage,
dietData,
const DeepCollectionEquality().hash(_copiedDay),
dietNameError,
dietDescriptionError,
dietDurationError,
dietStateError,
dietImageError,
const DeepCollectionEquality().hash(_dailyScheduleErrors),
durationIndex,
dietStateIndex,
published,
drafted,
isDietBeingEdited);
/// Create a copy of CreateDietState
/// with the given fields replaced by the non-null parameter values.
@@ -500,30 +452,27 @@ class _$CreateDietStateImpl implements _CreateDietState {
@pragma('vm:prefer-inline')
_$$CreateDietStateImplCopyWith<_$CreateDietStateImpl> get copyWith =>
__$$CreateDietStateImplCopyWithImpl<_$CreateDietStateImpl>(
this,
_$identity,
);
this, _$identity);
}
abstract class _CreateDietState implements CreateDietState {
const factory _CreateDietState({
required final bool isLoading,
required final bool isDietPublishing,
required final String? errorMessage,
required final CreateDietModel dietData,
final List<List<DailySchedule>>? copiedDay,
final String? dietNameError,
final String? dietDescriptionError,
final String? dietDurationError,
final String? dietStateError,
final String? dietImageError,
required final List<String> dailyScheduleErrors,
final int? durationIndex,
final int? dietStateIndex,
final bool published,
final bool drafted,
final bool isDietBeingEdited,
}) = _$CreateDietStateImpl;
const factory _CreateDietState(
{required final bool isLoading,
required final bool isDietPublishing,
required final String? errorMessage,
required final CreateDietModel dietData,
final List<List<DailySchedule>>? copiedDay,
final String? dietNameError,
final String? dietDescriptionError,
final String? dietDurationError,
final String? dietStateError,
final String? dietImageError,
required final List<String> dailyScheduleErrors,
final int? durationIndex,
final int? dietStateIndex,
final bool published,
final bool drafted,
final bool isDietBeingEdited}) = _$CreateDietStateImpl;
@override
bool get isLoading;

View File

@@ -62,7 +62,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
backgroundColor: appTheme.gray100,
resizeToAvoidBottomInset: true,
bottomSheet: Container(
padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
@@ -97,7 +97,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
BookmarkButton(
isFavorite: widget.diet.isFavorite,
onTap: () {},
@@ -109,7 +109,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
],
),
SizedBox(height: 8),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -127,27 +127,27 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
hintText: s.comment.capitalize(),
hintStyle: TextStyles.textMMedium.copyWith(color: appTheme.lightGray600),
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
@@ -156,7 +156,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
GestureDetector(
onTap: () {},
child: Container(
@@ -196,7 +196,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
disableActions: true,
path: 'diet/${widget.diet.id}',
),
anchor: Aligned(
anchor: const Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
@@ -218,11 +218,11 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
body: SingleChildScrollView(
controller: scrollController,
padding: EdgeInsets.only(bottom: 160),
padding: const EdgeInsets.only(bottom: 160),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 8),
const SizedBox(height: 8),
MainBackgroundBouble(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -246,20 +246,21 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
InfoBouble(
backgroundColor: appTheme.whiteA700,
children: [
SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
widget.diet.totalViews.toString(),
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
backgroundColor: appTheme.whiteA700,
),
SizedBox(width: 12),
const SizedBox(width: 12),
GestureDetector(
onTap: () {},
child: InfoBouble(
backgroundColor: appTheme.whiteA700,
children: [
SvgPicture.asset(
'assets/icons/heart.svg',
@@ -267,33 +268,32 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
height: 12,
colorFilter: widget.diet.wasLikedByMe ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null,
),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
widget.diet.totalLikes.toString(),
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
backgroundColor: appTheme.whiteA700,
),
),
SizedBox(width: 12),
const SizedBox(width: 12),
InfoBouble(
backgroundColor: appTheme.whiteA700,
children: [
SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
widget.diet.totalComments.toString(),
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
backgroundColor: appTheme.whiteA700,
),
],
),
),
],
),
SizedBox(height: 16),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
@@ -301,12 +301,12 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
InfoRow(diet: widget.diet, type: ProductType.diet,),
ExpandableText(
text: widget.diet.details,
),
SizedBox(height: 20),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: AuthorCard(
@@ -314,17 +314,17 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
title: s.diet_author,
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
MainBackgroundBouble(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Center(
child: Text(
s.diet_plan + '(${widget.diet.duration.toString()} ' + getDayForm(widget.diet.duration, s) + ')',
'${s.diet_plan}(${widget.diet.duration.toString()} ${getDayForm(widget.diet.duration, s)})',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
@@ -332,9 +332,9 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return _dayOfPlan(widget.diet.dailySchedule[index] ?? {}, index, s);
@@ -342,20 +342,20 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
itemCount: widget.diet.dailySchedule.length,
),
MainBackgroundBouble(
padding: EdgeInsets.symmetric(vertical: 16),
padding: const EdgeInsets.symmetric(vertical: 16),
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
alignment: Alignment.centerLeft,
child: Text(
'0' + ' ' + getCommentForm(widget.diet.totalComments, s),
'0 ${getCommentForm(widget.diet.totalComments, s)}',
style: TextStyles.textMMedium.copyWith(
color: appTheme.gray500,
),
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
),
),
@@ -366,7 +366,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
}
_dayOfPlan(Map<int, Map<int, DailySchedule>> day, int dayNumber, S s) {
_choiceChipWidget(int index) {
choiceChipWidget(int index) {
return ChoiceChip(
selectedColor: appTheme.blueA400,
pressElevation: 0,
@@ -393,7 +393,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: MainBackgroundBouble(
padding: EdgeInsets.only(
padding: const EdgeInsets.only(
top: 16,
),
child: Column(
@@ -404,13 +404,13 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
s.day + ' ' + (dayNumber + 1).toString(),
'${s.day} ${dayNumber + 1}',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
const Padding(
padding: EdgeInsets.symmetric(vertical: 12),
child: CustomDivider(),
),
Text(
@@ -422,21 +422,21 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_choiceChipWidget(0),
_choiceChipWidget(1),
_choiceChipWidget(2),
_choiceChipWidget(3),
_choiceChipWidget(4),
choiceChipWidget(0),
choiceChipWidget(1),
choiceChipWidget(2),
choiceChipWidget(3),
choiceChipWidget(4),
],
),
SizedBox(height: 8),
const SizedBox(height: 8),
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => _daily(day[widget.selectedIndexes[dayNumber] + 1]?[index + 1], s),
itemCount: day[widget.selectedIndexes[dayNumber] + 1]?.length ?? 0,
),
SizedBox(height: 8),
const SizedBox(height: 8),
],
),
),
@@ -453,7 +453,7 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
}
_daily(DailySchedule? daily, S s) {
if (daily == null) return SizedBox.shrink();
if (daily == null) return const SizedBox.shrink();
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Row(
@@ -467,9 +467,9 @@ class _DietPreviewScreenState extends State<DietPreviewScreen> {
),
),
),
Spacer(),
const Spacer(),
Text(
daily.quantity.toString() + ' ' + getLocalizedMeasurementUnits(s, daily.portion),
'${daily.quantity} ${getLocalizedMeasurementUnits(s, daily.portion)}',
style: TextStyles.textMSemibold.copyWith(
color: appTheme.black,
),

View File

@@ -54,7 +54,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Добавление блюда',
style: TextStyle(
fontSize: 20,
@@ -75,7 +75,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
onChanged: (query) {
EasyDebounce.debounce(
'glossary-search',
Duration(milliseconds: 250),
const Duration(milliseconds: 250),
() async {
selectedGlossary = null;
if (query.isEmpty) {
@@ -113,7 +113,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
),
glossariesList.isEmpty ? const SizedBox(height: 16) : const SizedBox.shrink(),
Container(
constraints: BoxConstraints(
constraints: const BoxConstraints(
maxHeight: 256,
),
child: ListView.separated(
@@ -135,7 +135,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
),
title: Text(
glossariesList[i].name,
style: TextStyle(
style: const TextStyle(
height: 1,
),
),
@@ -152,12 +152,12 @@ class _AddMealWidgetState extends State<AddMealWidget> {
Icons.add_rounded,
color: Colors.grey.shade400,
),
contentPadding: EdgeInsets.only(left: 12),
contentPadding: const EdgeInsets.only(left: 12),
);
},
itemCount: glossariesList.length,
separatorBuilder: (BuildContext context, int index) {
return CustomDivider();
return const CustomDivider();
},
),
),
@@ -179,9 +179,9 @@ class _AddMealWidgetState extends State<AddMealWidget> {
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
),
child: Icon(
child: const Icon(
Icons.delete_outline_rounded,
color: Colors.red,
),
@@ -201,7 +201,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
child: Center(
child: Text(
widget.portionIndex == null ? 'Добавить' : 'Сохранить',
style: TextStyle(
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white,
@@ -220,10 +220,10 @@ class _AddMealWidgetState extends State<AddMealWidget> {
Future<void> addPortion() async {
final portionIndex = widget.portionIndex;
var measurementUnits = selectedGlossary?.grInPortion == null
? Portion.PCS
? Portion.pcs
: selectedGlossary?.grInPortion == 0
? Portion.GRAMS
: Portion.PCS;
? Portion.grams
: Portion.pcs;
final glossary = selectedGlossary;
if (glossary != null) {
final [calories, carbohydrates, proteins, fats] = _getCPFC(glossary, measurementUnits);
@@ -265,7 +265,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
),
);
if (newGlossary != null) {
measurementUnits = Portion.GRAMS;
measurementUnits = Portion.grams;
final [calories, carbohydrates, proteins, fats] = _getCPFC(newGlossary, measurementUnits);
final portion = DailySchedule(
dailyNutrition: DailyNutrition(energy: calories, proteins: proteins, fats: fats, carbohydrates: carbohydrates),
@@ -297,7 +297,7 @@ class _AddMealWidgetState extends State<AddMealWidget> {
final double carbohydrates;
final double proteins;
final double fats;
if (measurementUnits == Portion.GRAMS) {
if (measurementUnits == Portion.grams) {
calories = (glossary.energyOn100Gr * int.parse(quantityController.text) / 100);
carbohydrates = (glossary.carbohydratesOn100Gr * int.parse(quantityController.text) / 100);
proteins = (glossary.proteinsOn100Gr * int.parse(quantityController.text) / 100);
@@ -310,5 +310,4 @@ class _AddMealWidgetState extends State<AddMealWidget> {
}
return [calories, carbohydrates, proteins, fats];
}
}

View File

@@ -17,7 +17,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
class DayWidget extends StatefulWidget {
DayWidget({
const DayWidget({
super.key,
required this.index,
});
@@ -47,10 +47,10 @@ class _DayWidgetState extends State<DayWidget> {
Row(
children: [
Text(
s.day + ' ${widget.index + 1}',
'${s.day} ${widget.index + 1}',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
Spacer(),
const Spacer(),
GestureDetector(
onTap: () {
context.read<CreateDietCubit>().copyDay(widget.index);
@@ -65,23 +65,23 @@ class _DayWidgetState extends State<DayWidget> {
),
],
),
SizedBox(
const SizedBox(
height: 12,
),
CustomDivider(),
SizedBox(
const CustomDivider(),
const SizedBox(
height: 12,
),
Text(
s.meal,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
SizedBox(height: 16),
const SizedBox(height: 16),
Row(
children: [
ChoiceChipWidget(
chipsLabelList: chipsLabelList,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
fontSize: TextStyles.textMMedium.fontSize,
fontWeight: TextStyles.textMMedium.fontWeight,
index: 0,
@@ -92,10 +92,10 @@ class _DayWidgetState extends State<DayWidget> {
});
},
),
Spacer(),
const Spacer(),
ChoiceChipWidget(
chipsLabelList: chipsLabelList,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
fontSize: TextStyles.textMMedium.fontSize,
fontWeight: TextStyles.textMMedium.fontWeight,
index: 1,
@@ -106,10 +106,10 @@ class _DayWidgetState extends State<DayWidget> {
});
},
),
Spacer(),
const Spacer(),
ChoiceChipWidget(
chipsLabelList: chipsLabelList,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
fontSize: TextStyles.textMMedium.fontSize,
fontWeight: TextStyles.textMMedium.fontWeight,
index: 2,
@@ -120,10 +120,10 @@ class _DayWidgetState extends State<DayWidget> {
});
},
),
Spacer(),
const Spacer(),
ChoiceChipWidget(
chipsLabelList: chipsLabelList,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
fontSize: TextStyles.textMMedium.fontSize,
fontWeight: TextStyles.textMMedium.fontWeight,
index: 3,
@@ -134,10 +134,10 @@ class _DayWidgetState extends State<DayWidget> {
});
},
),
Spacer(),
const Spacer(),
ChoiceChipWidget(
chipsLabelList: chipsLabelList,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
fontSize: TextStyles.textMMedium.fontSize,
fontWeight: TextStyles.textMMedium.fontWeight,
index: 4,
@@ -151,10 +151,10 @@ class _DayWidgetState extends State<DayWidget> {
],
),
ListView.separated(
separatorBuilder: (context, index) => SizedBox(
separatorBuilder: (context, index) => const SizedBox(
height: 8,
),
padding: EdgeInsets.all(0),
padding: const EdgeInsets.all(0),
itemBuilder: (context, index) {
final product = state.dietData.dailySchedule?[widget.index][_selectedMealIndex][index];
if (product != null) {
@@ -174,9 +174,9 @@ class _DayWidgetState extends State<DayWidget> {
},
itemCount: state.dietData.dailySchedule?[widget.index][_selectedMealIndex].length ?? 0,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
),
SizedBox(height: 16),
const SizedBox(height: 16),
Row(
children: [
GestureDetector(
@@ -184,8 +184,8 @@ class _DayWidgetState extends State<DayWidget> {
context.read<CreateDietCubit>().pasteCopiedDay(widget.index);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 14),
decoration: BoxDecoration(color: appTheme.gray50, borderRadius: BorderRadius.all(Radius.circular(12))),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
decoration: BoxDecoration(color: appTheme.gray50, borderRadius: const BorderRadius.all(Radius.circular(12))),
child: SvgPicture.asset(
'assets/icons/paste2.svg',
width: 28,
@@ -193,7 +193,7 @@ class _DayWidgetState extends State<DayWidget> {
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(
child: CustomOutlinedButton(
onPressed: () {
@@ -209,7 +209,7 @@ class _DayWidgetState extends State<DayWidget> {
color: appTheme.whiteA700,
),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
),
@@ -217,10 +217,10 @@ class _DayWidgetState extends State<DayWidget> {
],
),
if (state.dailyScheduleErrors[widget.index].isNotEmpty) ...[
SizedBox(height: 12),
const SizedBox(height: 12),
CustomErrorWidget(error: state.dailyScheduleErrors[widget.index]),
],
SizedBox(height: 20),
const SizedBox(height: 20),
],
),
),
@@ -274,7 +274,7 @@ class _DayWidgetState extends State<DayWidget> {
carbohydrates: carbohydrates,
);
}
return CpfcContainer(
return const CpfcContainer(
calories: 0,
proteins: 0,
fats: 0,
@@ -302,7 +302,7 @@ class _DayWidgetState extends State<DayWidget> {
quantityControllerText: quantity.toString(),
);
},
trailing: Icon(Icons.more_vert_rounded),
trailing: const Icon(Icons.more_vert_rounded),
title: Text(product),
subtitle: Text('$quantity $portion'),
shape: RoundedRectangleBorder(
@@ -324,7 +324,7 @@ class _DayWidgetState extends State<DayWidget> {
return showModalBottomSheet(
useRootNavigator: true,
context: context,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
),
isScrollControlled: true,

View File

@@ -26,9 +26,9 @@ class _DietDurationDropDownWidgetState extends State<DietDurationDropDownWidget>
super.didChangeDependencies();
final s = S.of(context);
if (durationDropDownTitles.isEmpty) {
durationValues.forEach((element) {
for (var element in durationValues) {
durationDropDownTitles.add('$element ${getDayForm(element, s)}');
});
}
}
}
@@ -54,18 +54,18 @@ class _DietDurationDropDownWidgetState extends State<DietDurationDropDownWidget>
items: durationDropDownTitles
.mapIndexed(
(index, value) => DropdownMenuItem(
value: durationDropDownTitles[index],
child: Text(
durationDropDownTitles[index],
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
value: durationDropDownTitles[index],
),
)
.toList(),
value: state.durationIndex == null ? null : durationDropDownTitles[state.durationIndex ?? 0],
),
if (state.dietDurationError != null) ...[
SizedBox(
const SizedBox(
height: 4,
),
CustomErrorWidget(error: state.dietDurationError ?? ''),

View File

@@ -31,12 +31,13 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
final picker = ImagePicker();
final image = await picker.pickImage(source: ImageSource.camera);
cubit.setImage(image);
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: Row(
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
const Icon(Icons.photo_camera),
const SizedBox(width: 8),
Text(s.photo),
],
),
@@ -46,12 +47,13 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
final picker = ImagePicker();
final image = await picker.pickImage(source: ImageSource.gallery);
cubit.setImage(image);
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: Row(
children: [
Icon(Icons.photo),
SizedBox(width: 8),
const Icon(Icons.photo),
const SizedBox(width: 8),
Text(s.gallery),
],
),
@@ -96,7 +98,7 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
color: appTheme.gray50,
),
width: MediaQuery.sizeOf(context).width,
padding: hasImage ? null : EdgeInsets.all(8),
padding: hasImage ? null : const EdgeInsets.all(8),
child: hasImage
? Padding(
padding: const EdgeInsets.only(top: 6, right: 6),
@@ -113,7 +115,7 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
color: appTheme.dividerColor,
shape: BoxShape.circle,
),
child: Icon(
child: const Icon(
Icons.close_rounded,
color: Colors.grey,
size: 16,
@@ -126,20 +128,20 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
children: [
DottedBorder(
stackFit: StackFit.expand,
dashPattern: [14, 14],
dashPattern: const [14, 14],
color: state.dietImageError != null ? appTheme.red : appTheme.dottedBorder,
borderType: BorderType.RRect,
radius: Radius.circular(12),
child: SizedBox.expand(),
radius: const Radius.circular(12),
child: const SizedBox.expand(),
),
Center(
child: Column(
children: [
SizedBox(
const SizedBox(
height: 48,
),
SvgPicture.asset('assets/icons/eatvio_logo.svg'),
SizedBox(
const SizedBox(
height: 24,
),
Text(
@@ -153,7 +155,7 @@ class _DietImagePickerWidgetState extends State<DietImagePickerWidget> {
),
),
),
if (state.dietImageError != null) ...[SizedBox(height: 8), CustomErrorWidget(error: state.dietImageError ?? '')],
if (state.dietImageError != null) ...[const SizedBox(height: 8), CustomErrorWidget(error: state.dietImageError ?? '')],
],
);
},

View File

@@ -9,7 +9,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
class DietTypeChoiceWidget extends StatefulWidget {
DietTypeChoiceWidget({super.key});
const DietTypeChoiceWidget({super.key});
@override
State<DietTypeChoiceWidget> createState() => _DietTypeChoiceWidgetState();
@@ -76,12 +76,12 @@ class _DietTypeChoiceWidgetState extends State<DietTypeChoiceWidget> {
height: 80,
child: Column(
children: [
SizedBox(height: 16),
const SizedBox(height: 16),
SvgPicture.asset(
choiceContent[index].$1,
height: 30,
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
choiceContent[index].$2,
overflow: TextOverflow.clip,

View File

@@ -11,7 +11,7 @@ class CustomErrorWidget extends StatelessWidget {
return Row(
children: [
SvgPicture.asset('assets/icons/error_icon.svg', width: 14, height: 14),
SizedBox(
const SizedBox(
width: 2,
),
Expanded(

View File

@@ -26,7 +26,7 @@ class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
super.didChangeDependencies();
final s = S.of(context);
if (dietStateTitles.isEmpty) {
dietStates.forEach((elem) {
for (var elem in dietStates) {
switch (elem) {
case DietState.active:
dietStateTitles.add(s.active_diet_state);
@@ -35,7 +35,7 @@ class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
case DietState.personal:
dietStateTitles.add(s.personal_diet_state);
}
});
}
}
}
@@ -62,18 +62,18 @@ class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
items: dietStateTitles
.mapIndexed(
(index, value) => DropdownMenuItem(
value: dietStates[index],
child: Text(
dietStateTitles[index],
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
value: dietStates[index],
),
)
.toList(),
value: state.dietStateIndex == null ? null : dietStates[state.dietStateIndex ?? 0],
),
if (state.dietStateError != null) ...[
SizedBox(
const SizedBox(
height: 4,
),
CustomErrorWidget(error: state.dietStateError ?? ''),

Some files were not shown because too many files have changed in this diff Show More