forked from eatvio/eatvio_app
feat: consultants rating
This commit is contained in:
82
android/.kotlin/errors/errors-1737375866289.log
Normal file
82
android/.kotlin/errors/errors-1737375866289.log
Normal file
@@ -0,0 +1,82 @@
|
||||
kotlin version: 2.0.21
|
||||
error message: Daemon compilation failed: null
|
||||
java.lang.Exception
|
||||
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)
|
||||
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:240)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:159)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:111)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
|
||||
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
|
||||
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
|
||||
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
|
||||
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
|
||||
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
|
||||
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:174)
|
||||
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:194)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:127)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:169)
|
||||
at org.gradle.internal.Factories$1.create(Factories.java:31)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:263)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:127)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:132)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:133)
|
||||
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
|
||||
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
|
||||
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
|
||||
at java.base/java.lang.Thread.run(Unknown Source)
|
||||
Caused by: java.nio.file.DirectoryNotEmptyException: C:\Users\Alex\AppData\Local\Temp\kotlin-backups16986209765282043117
|
||||
at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
|
||||
at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
|
||||
at java.base/java.nio.file.Files.delete(Unknown Source)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction$cleanupStash$2$1$1.invoke(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction$cleanupStash$2$1$1.invoke(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.cleanupStash$lambda$11$lambda$10$lambda$9(CompilationTransaction.kt:244)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
|
||||
at java.base/java.util.ArrayList.forEach(Unknown Source)
|
||||
at java.base/java.util.stream.SortedOps$RefSortingSink.end(Unknown Source)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
|
||||
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.cleanupStash(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.close(CompilationTransaction.kt:254)
|
||||
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.tryCompileIncrementally(IncrementalCompilerRunner.kt:747)
|
||||
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:120)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:675)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1660)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
|
||||
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
|
||||
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
|
||||
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
|
||||
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
|
||||
... 3 more
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ if (keystorePropertiesFile.exists()) {
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.eatvioapp.app"
|
||||
namespace = "ru.eatvioapp.app"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = "25.1.8937393"
|
||||
|
||||
@@ -27,7 +27,7 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.eatvioapp.app"
|
||||
applicationId = "ru.eatvioapp.app"
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.eatvioapp.app">
|
||||
package="ru.eatvioapp.app">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.eatvioapp.app">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.eatvioapp.app
|
||||
package ru.eatvioapp.app
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.eatvioapp.app">
|
||||
package="ru.eatvioapp.app">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
|
||||
3
assets/icons/go_to_arrow.svg
Normal file
3
assets/icons/go_to_arrow.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.0747132 0.909366C0.113849 0.973406 0.199235 1.05523 0.263275 1.09793C0.380682 1.16908 0.426933 1.16908 3.18776 1.16908L5.99484 1.16908L3.21267 3.95126C0.188562 6.98248 0.316641 6.83661 0.377123 7.1746C0.409143 7.35249 0.647514 7.59086 0.825403 7.62288C1.16339 7.68336 1.01752 7.81144 4.04518 4.78733L6.83092 2.00516L6.83092 4.81224C6.83092 7.58018 6.83092 7.61932 6.90563 7.73673C7.01236 7.91461 7.17958 8 7.40728 8C7.63853 8 7.80219 7.9075 7.91248 7.71538C7.98719 7.59086 7.98719 7.54816 7.99787 4.09357C8.00498 1.61736 7.99431 0.553589 7.96585 0.446856C7.91604 0.261852 7.73815 0.0839639 7.55314 0.0341549C7.44641 0.00569296 6.38264 -0.00498009 3.90643 0.0021348C0.451837 0.0128083 0.409143 0.0128083 0.284622 0.0875216C0.0889444 0.20137 0 0.36147 0 0.596282C0 0.735035 0.0213466 0.831095 0.0747132 0.909366Z" fill="#323F4B"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 940 B |
@@ -28,6 +28,7 @@ import 'package:eatvio_app/features/diary/repositories/diary_repository.dart';
|
||||
import 'package:eatvio_app/features/diary/services/diary_service.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/cubit/about_diet_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
@@ -100,6 +101,7 @@ Future<void> init() async {
|
||||
sl.registerFactory<MyDietsCubit>(() => MyDietsCubit(myDietsRepository: sl()));
|
||||
sl.registerFactory<MyPlansCubit>(() => MyPlansCubit(myPlansRepository: sl()));
|
||||
sl.registerFactory<UserDetailsCubit>(() => UserDetailsCubit(profileRepository: sl()));
|
||||
sl.registerFactory<ConsultantsCubit>(() => ConsultantsCubit(feedRepository: sl()));
|
||||
|
||||
// Repository
|
||||
sl.registerLazySingleton<ChatRepository>(() => ChatRepository(chatService: sl()));
|
||||
|
||||
@@ -310,11 +310,15 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
SizedBox(width: 8),
|
||||
_iconButton(
|
||||
icon: Icons.reply_rounded,
|
||||
onTap: () => Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString(),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'blog_post_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _BlogPostService implements BlogPostService {
|
||||
_BlogPostService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_BlogPostService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,23 +23,21 @@ class _BlogPostService implements BlogPostService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = formData;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -56,23 +50,21 @@ class _BlogPostService implements BlogPostService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = formData;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/update/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/update/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -82,22 +74,16 @@ class _BlogPostService implements BlogPostService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/delete/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/delete/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -114,10 +100,7 @@ class _BlogPostService implements BlogPostService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'calendar_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _CalendarService implements CalendarService {
|
||||
_CalendarService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_CalendarService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,27 +23,23 @@ class _CalendarService implements CalendarService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<CalendarModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/calendar/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<CalendarModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/calendar/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
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>))
|
||||
.map(
|
||||
(dynamic i) => CalendarModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -69,10 +61,7 @@ class _CalendarService implements CalendarService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'chat_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _ChatService implements ChatService {
|
||||
_ChatService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_ChatService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -28,22 +24,16 @@ class _ChatService implements ChatService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ChatRoomPreviewModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ChatRoomPreviewModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ChatRoomPreviewModel _value;
|
||||
try {
|
||||
@@ -61,27 +51,23 @@ class _ChatService implements ChatService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Map<String, ChatRoomModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Map<String, ChatRoomModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Map<String, ChatRoomModel> _value;
|
||||
try {
|
||||
_value = _result.data!.map((k, dynamic v) =>
|
||||
MapEntry(k, ChatRoomModel.fromJson(v as Map<String, dynamic>)));
|
||||
_value = _result.data!.map(
|
||||
(k, dynamic v) =>
|
||||
MapEntry(k, ChatRoomModel.fromJson(v as Map<String, dynamic>)),
|
||||
);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
@@ -101,31 +87,26 @@ class _ChatService implements ChatService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
if (data != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'data',
|
||||
data,
|
||||
));
|
||||
_data.fields.add(MapEntry('data', data));
|
||||
}
|
||||
if (media_data != null) {
|
||||
_data.files.addAll(media_data.map((i) => MapEntry('media_data[]', i)));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/${id}/message/send',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/${id}/message/send',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -138,22 +119,16 @@ class _ChatService implements ChatService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ChatMessagesModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/show/${id}/messages?page=${page}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ChatMessagesModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/show/${id}/messages?page=${page}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ChatMessagesModel _value;
|
||||
try {
|
||||
@@ -171,22 +146,16 @@ class _ChatService implements ChatService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<WebsocketInfoModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/ws/params',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<WebsocketInfoModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/ws/params',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late WebsocketInfoModel _value;
|
||||
try {
|
||||
@@ -204,22 +173,16 @@ class _ChatService implements ChatService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ChatRoomModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/get_by_user/${user}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ChatRoomModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/chat/get_by_user/${user}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ChatRoomModel _value;
|
||||
try {
|
||||
@@ -244,10 +207,7 @@ class _ChatService implements ChatService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'consultant_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _ConsultantService implements ConsultantService {
|
||||
_ConsultantService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_ConsultantService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -22,28 +18,23 @@ class _ConsultantService implements ConsultantService {
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<void> consultantRegistration(
|
||||
{required ConsultantProfileModel consultantModel}) async {
|
||||
Future<void> consultantRegistration({
|
||||
required ConsultantProfileModel consultantModel,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = consultantModel;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/registration',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/registration',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -57,23 +48,21 @@ class _ConsultantService implements ConsultantService {
|
||||
if (photos != null) {
|
||||
_data.files.addAll(photos.map((i) => MapEntry('photos[]', i)));
|
||||
}
|
||||
final _options = _setStreamType<List<String>>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/photos/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<String>>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/photos/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<String> _value;
|
||||
try {
|
||||
@@ -98,10 +87,7 @@ class _ConsultantService implements ConsultantService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'create_diet_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _CreateDietService implements CreateDietService {
|
||||
_CreateDietService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_CreateDietService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -39,81 +35,57 @@ class _CreateDietService implements CreateDietService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
if (name != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'name',
|
||||
name,
|
||||
));
|
||||
_data.fields.add(MapEntry('name', name));
|
||||
}
|
||||
if (duration != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'duration',
|
||||
duration.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('duration', duration.toString()));
|
||||
}
|
||||
if (state != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'state',
|
||||
state,
|
||||
));
|
||||
_data.fields.add(MapEntry('state', state));
|
||||
}
|
||||
if (meatType != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'type[meat]',
|
||||
meatType,
|
||||
));
|
||||
_data.fields.add(MapEntry('type[meat]', meatType));
|
||||
}
|
||||
if (carbType != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'type[carb]',
|
||||
carbType,
|
||||
));
|
||||
_data.fields.add(MapEntry('type[carb]', carbType));
|
||||
}
|
||||
if (vegType != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'type[veg]',
|
||||
vegType,
|
||||
));
|
||||
_data.fields.add(MapEntry('type[veg]', vegType));
|
||||
}
|
||||
if (lightType != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'type[light]',
|
||||
lightType,
|
||||
));
|
||||
_data.fields.add(MapEntry('type[light]', lightType));
|
||||
}
|
||||
if (details != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'details',
|
||||
details,
|
||||
));
|
||||
_data.fields.add(MapEntry('details', details));
|
||||
}
|
||||
if (image != null) {
|
||||
if (image != null) {
|
||||
_data.files.add(MapEntry(
|
||||
'image',
|
||||
MultipartFile.fromFileSync(
|
||||
image.path,
|
||||
filename: image.path.split(Platform.pathSeparator).last,
|
||||
_data.files.add(
|
||||
MapEntry(
|
||||
'image',
|
||||
MultipartFile.fromFileSync(
|
||||
image.path,
|
||||
filename: image.path.split(Platform.pathSeparator).last,
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
final _options = _setStreamType<CreatedDiet>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<CreatedDiet>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CreatedDiet _value;
|
||||
try {
|
||||
@@ -135,22 +107,16 @@ class _CreateDietService implements CreateDietService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/create/${id}/daily_schedule',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/create/${id}/daily_schedule',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -167,10 +133,7 @@ class _CreateDietService implements CreateDietService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'create_plan_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _CreatePlanService implements CreatePlanService {
|
||||
_CreatePlanService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_CreatePlanService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -28,23 +24,21 @@ class _CreatePlanService implements CreatePlanService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -58,22 +52,16 @@ class _CreatePlanService implements CreatePlanService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_option',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_option',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -87,22 +75,16 @@ class _CreatePlanService implements CreatePlanService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(model);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_options',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/create/${slug}/packet_options',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -119,10 +101,7 @@ class _CreatePlanService implements CreatePlanService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'diary_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _DiaryService implements DiaryService {
|
||||
_DiaryService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_DiaryService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -22,33 +18,30 @@ class _DiaryService implements DiaryService {
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<List<DiaryDayModel>> getDiaryIndexByDate(
|
||||
{required String date}) async {
|
||||
Future<List<DiaryDayModel>> getDiaryIndexByDate({
|
||||
required String date,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<DiaryDayModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/index/${date}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<DiaryDayModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/index/${date}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<DiaryDayModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => DiaryDayModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) => DiaryDayModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -63,22 +56,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DiaryDayWrapperModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<DiaryDayWrapperModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DiaryDayWrapperModel _value;
|
||||
try {
|
||||
@@ -96,22 +83,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<NutritionDataModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/dailyNutritionData',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<NutritionDataModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/dailyNutritionData',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late NutritionDataModel _value;
|
||||
try {
|
||||
@@ -133,30 +114,30 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.files.add(MapEntry(
|
||||
'photo',
|
||||
MultipartFile.fromFileSync(
|
||||
photo.path,
|
||||
filename: photo.path.split(Platform.pathSeparator).last,
|
||||
_data.files.add(
|
||||
MapEntry(
|
||||
'photo',
|
||||
MultipartFile.fromFileSync(
|
||||
photo.path,
|
||||
filename: photo.path.split(Platform.pathSeparator).last,
|
||||
),
|
||||
),
|
||||
));
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/photo/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/photo/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -170,22 +151,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'DELETE',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diaryId}/meals/${typeNo}/photo/${userAttachment}/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'DELETE', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diaryId}/meals/${typeNo}/photo/${userAttachment}/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -203,40 +178,27 @@ class _DiaryService implements DiaryService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'product_name',
|
||||
productName,
|
||||
));
|
||||
_data.fields.add(MapEntry(
|
||||
'portion',
|
||||
portion,
|
||||
));
|
||||
_data.fields.add(MapEntry(
|
||||
'quantity',
|
||||
quantity.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('product_name', productName));
|
||||
_data.fields.add(MapEntry('portion', portion));
|
||||
_data.fields.add(MapEntry('quantity', quantity.toString()));
|
||||
if (productNutritionalValueId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'product_nutritional_value_id',
|
||||
productNutritionalValueId.toString(),
|
||||
));
|
||||
_data.fields.add(
|
||||
MapEntry(
|
||||
'product_nutritional_value_id',
|
||||
productNutritionalValueId.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portion/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portion/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -252,22 +214,16 @@ class _DiaryService implements DiaryService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(productInMeal);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'PUT',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'PUT', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -281,22 +237,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/${portionModel}/mark_eaten',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/${portionModel}/mark_eaten',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -310,22 +260,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/${portionModel}/unmark_eaten',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/${portionModel}/unmark_eaten',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -339,22 +283,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/restore',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/restore',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -368,22 +306,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'DELETE',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'DELETE', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/portions/${portionModel}/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -396,22 +328,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = finishDiaryDayModel;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/finishDay',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/finishDay',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -425,22 +351,16 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = {'satiety': satiety};
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/satiety/fill',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/satiety/fill',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -454,49 +374,38 @@ class _DiaryService implements DiaryService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = {'time': time};
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/time/fill',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/${diary}/meals/${typeNo}/time/fill',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GlossaryModerationModel> sendProductToModeration(
|
||||
{required Map<String, dynamic> data}) async {
|
||||
Future<GlossaryModerationModel> sendProductToModeration({
|
||||
required Map<String, dynamic> data,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(data);
|
||||
final _options = _setStreamType<GlossaryModerationModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/product_nutritional_values/sendToModeration',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<GlossaryModerationModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/product_nutritional_values/sendToModeration',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late GlossaryModerationModel _value;
|
||||
try {
|
||||
@@ -521,10 +430,7 @@ class _DiaryService implements DiaryService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import 'package:share_plus/share_plus.dart';
|
||||
|
||||
class MoreOptions extends StatelessWidget {
|
||||
const MoreOptions({super.key, this.disableActions, required this.path});
|
||||
|
||||
final String path;
|
||||
final bool? disableActions;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
@@ -52,11 +54,15 @@ class MoreOptions extends StatelessWidget {
|
||||
GestureDetector(
|
||||
onTap: disableActions == true
|
||||
? null
|
||||
: () => Share.shareUri(
|
||||
: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
'$baseUrl/ru/$path',
|
||||
),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'diet_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _DietService implements DietService {
|
||||
_DietService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_DietService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _DietService implements DietService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DietLikesModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<DietLikesModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DietLikesModel _value;
|
||||
try {
|
||||
@@ -60,22 +50,16 @@ class _DietService implements DietService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/add_to_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/add_to_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
@@ -93,22 +77,16 @@ class _DietService implements DietService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/remove_from_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/remove_from_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
@@ -126,22 +104,16 @@ class _DietService implements DietService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
@@ -166,10 +138,7 @@ class _DietService implements DietService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
30
lib/features/feed/models/feed_consultant_model.dart
Normal file
30
lib/features/feed/models/feed_consultant_model.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:eatvio_app/core/models/pagination_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/badge_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'feed_consultant_model.freezed.dart';
|
||||
part 'feed_consultant_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class FeedConsultantPaginationModel with _$FeedConsultantPaginationModel {
|
||||
const factory FeedConsultantPaginationModel({
|
||||
required List<FeedConsultantModel> data,
|
||||
required Links links,
|
||||
required Meta meta,
|
||||
}) = _FeedConsultantPaginationModel;
|
||||
|
||||
factory FeedConsultantPaginationModel.fromJson(Map<String, Object?> json) => _$FeedConsultantPaginationModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class FeedConsultantModel with _$FeedConsultantModel {
|
||||
const factory FeedConsultantModel({
|
||||
required String slug,
|
||||
required String name,
|
||||
@JsonKey(name: 'rating_place') required int ratingPlace,
|
||||
@JsonKey(name: 'profile_photo_url') required String photo,
|
||||
required List<BadgeModel> badges,
|
||||
}) = _FeedConsultantModel;
|
||||
|
||||
factory FeedConsultantModel.fromJson(Map<String, Object?> json) => _$FeedConsultantModelFromJson(json);
|
||||
}
|
||||
499
lib/features/feed/models/feed_consultant_model.freezed.dart
Normal file
499
lib/features/feed/models/feed_consultant_model.freezed.dart
Normal file
@@ -0,0 +1,499 @@
|
||||
// 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 'feed_consultant_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');
|
||||
|
||||
FeedConsultantPaginationModel _$FeedConsultantPaginationModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _FeedConsultantPaginationModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FeedConsultantPaginationModel {
|
||||
List<FeedConsultantModel> get data => throw _privateConstructorUsedError;
|
||||
Links get links => throw _privateConstructorUsedError;
|
||||
Meta get meta => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this FeedConsultantPaginationModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$FeedConsultantPaginationModelCopyWith<FeedConsultantPaginationModel>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $FeedConsultantPaginationModelCopyWith<$Res> {
|
||||
factory $FeedConsultantPaginationModelCopyWith(
|
||||
FeedConsultantPaginationModel value,
|
||||
$Res Function(FeedConsultantPaginationModel) then) =
|
||||
_$FeedConsultantPaginationModelCopyWithImpl<$Res,
|
||||
FeedConsultantPaginationModel>;
|
||||
@useResult
|
||||
$Res call({List<FeedConsultantModel> data, Links links, Meta meta});
|
||||
|
||||
$LinksCopyWith<$Res> get links;
|
||||
$MetaCopyWith<$Res> get meta;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$FeedConsultantPaginationModelCopyWithImpl<$Res,
|
||||
$Val extends FeedConsultantPaginationModel>
|
||||
implements $FeedConsultantPaginationModelCopyWith<$Res> {
|
||||
_$FeedConsultantPaginationModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? data = null,
|
||||
Object? links = null,
|
||||
Object? meta = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
data: null == data
|
||||
? _value.data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedConsultantModel>,
|
||||
links: null == links
|
||||
? _value.links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as Links,
|
||||
meta: null == meta
|
||||
? _value.meta
|
||||
: meta // ignore: cast_nullable_to_non_nullable
|
||||
as Meta,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LinksCopyWith<$Res> get links {
|
||||
return $LinksCopyWith<$Res>(_value.links, (value) {
|
||||
return _then(_value.copyWith(links: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$MetaCopyWith<$Res> get meta {
|
||||
return $MetaCopyWith<$Res>(_value.meta, (value) {
|
||||
return _then(_value.copyWith(meta: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FeedConsultantPaginationModelImplCopyWith<$Res>
|
||||
implements $FeedConsultantPaginationModelCopyWith<$Res> {
|
||||
factory _$$FeedConsultantPaginationModelImplCopyWith(
|
||||
_$FeedConsultantPaginationModelImpl value,
|
||||
$Res Function(_$FeedConsultantPaginationModelImpl) then) =
|
||||
__$$FeedConsultantPaginationModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<FeedConsultantModel> data, Links links, Meta meta});
|
||||
|
||||
@override
|
||||
$LinksCopyWith<$Res> get links;
|
||||
@override
|
||||
$MetaCopyWith<$Res> get meta;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FeedConsultantPaginationModelImplCopyWithImpl<$Res>
|
||||
extends _$FeedConsultantPaginationModelCopyWithImpl<$Res,
|
||||
_$FeedConsultantPaginationModelImpl>
|
||||
implements _$$FeedConsultantPaginationModelImplCopyWith<$Res> {
|
||||
__$$FeedConsultantPaginationModelImplCopyWithImpl(
|
||||
_$FeedConsultantPaginationModelImpl _value,
|
||||
$Res Function(_$FeedConsultantPaginationModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? data = null,
|
||||
Object? links = null,
|
||||
Object? meta = null,
|
||||
}) {
|
||||
return _then(_$FeedConsultantPaginationModelImpl(
|
||||
data: null == data
|
||||
? _value._data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedConsultantModel>,
|
||||
links: null == links
|
||||
? _value.links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as Links,
|
||||
meta: null == meta
|
||||
? _value.meta
|
||||
: meta // ignore: cast_nullable_to_non_nullable
|
||||
as Meta,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$FeedConsultantPaginationModelImpl
|
||||
implements _FeedConsultantPaginationModel {
|
||||
const _$FeedConsultantPaginationModelImpl(
|
||||
{required final List<FeedConsultantModel> data,
|
||||
required this.links,
|
||||
required this.meta})
|
||||
: _data = data;
|
||||
|
||||
factory _$FeedConsultantPaginationModelImpl.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$$FeedConsultantPaginationModelImplFromJson(json);
|
||||
|
||||
final List<FeedConsultantModel> _data;
|
||||
@override
|
||||
List<FeedConsultantModel> get data {
|
||||
if (_data is EqualUnmodifiableListView) return _data;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_data);
|
||||
}
|
||||
|
||||
@override
|
||||
final Links links;
|
||||
@override
|
||||
final Meta meta;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedConsultantPaginationModel(data: $data, links: $links, meta: $meta)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$FeedConsultantPaginationModelImpl &&
|
||||
const DeepCollectionEquality().equals(other._data, _data) &&
|
||||
(identical(other.links, links) || other.links == links) &&
|
||||
(identical(other.meta, meta) || other.meta == meta));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$FeedConsultantPaginationModelImplCopyWith<
|
||||
_$FeedConsultantPaginationModelImpl>
|
||||
get copyWith => __$$FeedConsultantPaginationModelImplCopyWithImpl<
|
||||
_$FeedConsultantPaginationModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$FeedConsultantPaginationModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _FeedConsultantPaginationModel
|
||||
implements FeedConsultantPaginationModel {
|
||||
const factory _FeedConsultantPaginationModel(
|
||||
{required final List<FeedConsultantModel> data,
|
||||
required final Links links,
|
||||
required final Meta meta}) = _$FeedConsultantPaginationModelImpl;
|
||||
|
||||
factory _FeedConsultantPaginationModel.fromJson(Map<String, dynamic> json) =
|
||||
_$FeedConsultantPaginationModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
List<FeedConsultantModel> get data;
|
||||
@override
|
||||
Links get links;
|
||||
@override
|
||||
Meta get meta;
|
||||
|
||||
/// Create a copy of FeedConsultantPaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$FeedConsultantPaginationModelImplCopyWith<
|
||||
_$FeedConsultantPaginationModelImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
FeedConsultantModel _$FeedConsultantModelFromJson(Map<String, dynamic> json) {
|
||||
return _FeedConsultantModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FeedConsultantModel {
|
||||
String get slug => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'rating_place')
|
||||
int get ratingPlace => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'profile_photo_url')
|
||||
String get photo => throw _privateConstructorUsedError;
|
||||
List<BadgeModel> get badges => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this FeedConsultantModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of FeedConsultantModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$FeedConsultantModelCopyWith<FeedConsultantModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $FeedConsultantModelCopyWith<$Res> {
|
||||
factory $FeedConsultantModelCopyWith(
|
||||
FeedConsultantModel value, $Res Function(FeedConsultantModel) then) =
|
||||
_$FeedConsultantModelCopyWithImpl<$Res, FeedConsultantModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String slug,
|
||||
String name,
|
||||
@JsonKey(name: 'rating_place') int ratingPlace,
|
||||
@JsonKey(name: 'profile_photo_url') String photo,
|
||||
List<BadgeModel> badges});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$FeedConsultantModelCopyWithImpl<$Res, $Val extends FeedConsultantModel>
|
||||
implements $FeedConsultantModelCopyWith<$Res> {
|
||||
_$FeedConsultantModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of FeedConsultantModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? slug = null,
|
||||
Object? name = null,
|
||||
Object? ratingPlace = null,
|
||||
Object? photo = null,
|
||||
Object? badges = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
slug: null == slug
|
||||
? _value.slug
|
||||
: slug // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
ratingPlace: null == ratingPlace
|
||||
? _value.ratingPlace
|
||||
: ratingPlace // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
photo: null == photo
|
||||
? _value.photo
|
||||
: photo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
badges: null == badges
|
||||
? _value.badges
|
||||
: badges // ignore: cast_nullable_to_non_nullable
|
||||
as List<BadgeModel>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FeedConsultantModelImplCopyWith<$Res>
|
||||
implements $FeedConsultantModelCopyWith<$Res> {
|
||||
factory _$$FeedConsultantModelImplCopyWith(_$FeedConsultantModelImpl value,
|
||||
$Res Function(_$FeedConsultantModelImpl) then) =
|
||||
__$$FeedConsultantModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String slug,
|
||||
String name,
|
||||
@JsonKey(name: 'rating_place') int ratingPlace,
|
||||
@JsonKey(name: 'profile_photo_url') String photo,
|
||||
List<BadgeModel> badges});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FeedConsultantModelImplCopyWithImpl<$Res>
|
||||
extends _$FeedConsultantModelCopyWithImpl<$Res, _$FeedConsultantModelImpl>
|
||||
implements _$$FeedConsultantModelImplCopyWith<$Res> {
|
||||
__$$FeedConsultantModelImplCopyWithImpl(_$FeedConsultantModelImpl _value,
|
||||
$Res Function(_$FeedConsultantModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of FeedConsultantModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? slug = null,
|
||||
Object? name = null,
|
||||
Object? ratingPlace = null,
|
||||
Object? photo = null,
|
||||
Object? badges = null,
|
||||
}) {
|
||||
return _then(_$FeedConsultantModelImpl(
|
||||
slug: null == slug
|
||||
? _value.slug
|
||||
: slug // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
ratingPlace: null == ratingPlace
|
||||
? _value.ratingPlace
|
||||
: ratingPlace // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
photo: null == photo
|
||||
? _value.photo
|
||||
: photo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
badges: null == badges
|
||||
? _value._badges
|
||||
: badges // ignore: cast_nullable_to_non_nullable
|
||||
as List<BadgeModel>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$FeedConsultantModelImpl implements _FeedConsultantModel {
|
||||
const _$FeedConsultantModelImpl(
|
||||
{required this.slug,
|
||||
required this.name,
|
||||
@JsonKey(name: 'rating_place') required this.ratingPlace,
|
||||
@JsonKey(name: 'profile_photo_url') required this.photo,
|
||||
required final List<BadgeModel> badges})
|
||||
: _badges = badges;
|
||||
|
||||
factory _$FeedConsultantModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$FeedConsultantModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String slug;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
@JsonKey(name: 'rating_place')
|
||||
final int ratingPlace;
|
||||
@override
|
||||
@JsonKey(name: 'profile_photo_url')
|
||||
final String photo;
|
||||
final List<BadgeModel> _badges;
|
||||
@override
|
||||
List<BadgeModel> get badges {
|
||||
if (_badges is EqualUnmodifiableListView) return _badges;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_badges);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedConsultantModel(slug: $slug, name: $name, ratingPlace: $ratingPlace, photo: $photo, badges: $badges)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$FeedConsultantModelImpl &&
|
||||
(identical(other.slug, slug) || other.slug == slug) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.ratingPlace, ratingPlace) ||
|
||||
other.ratingPlace == ratingPlace) &&
|
||||
(identical(other.photo, photo) || other.photo == photo) &&
|
||||
const DeepCollectionEquality().equals(other._badges, _badges));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, slug, name, ratingPlace, photo,
|
||||
const DeepCollectionEquality().hash(_badges));
|
||||
|
||||
/// Create a copy of FeedConsultantModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$FeedConsultantModelImplCopyWith<_$FeedConsultantModelImpl> get copyWith =>
|
||||
__$$FeedConsultantModelImplCopyWithImpl<_$FeedConsultantModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$FeedConsultantModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _FeedConsultantModel implements FeedConsultantModel {
|
||||
const factory _FeedConsultantModel(
|
||||
{required final String slug,
|
||||
required final String name,
|
||||
@JsonKey(name: 'rating_place') required final int ratingPlace,
|
||||
@JsonKey(name: 'profile_photo_url') required final String photo,
|
||||
required final List<BadgeModel> badges}) = _$FeedConsultantModelImpl;
|
||||
|
||||
factory _FeedConsultantModel.fromJson(Map<String, dynamic> json) =
|
||||
_$FeedConsultantModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get slug;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
@JsonKey(name: 'rating_place')
|
||||
int get ratingPlace;
|
||||
@override
|
||||
@JsonKey(name: 'profile_photo_url')
|
||||
String get photo;
|
||||
@override
|
||||
List<BadgeModel> get badges;
|
||||
|
||||
/// Create a copy of FeedConsultantModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$FeedConsultantModelImplCopyWith<_$FeedConsultantModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
48
lib/features/feed/models/feed_consultant_model.g.dart
Normal file
48
lib/features/feed/models/feed_consultant_model.g.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_consultant_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$FeedConsultantPaginationModelImpl
|
||||
_$$FeedConsultantPaginationModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$FeedConsultantPaginationModelImpl(
|
||||
data: (json['data'] as List<dynamic>)
|
||||
.map((e) =>
|
||||
FeedConsultantModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
links: Links.fromJson(json['links'] as Map<String, dynamic>),
|
||||
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$FeedConsultantPaginationModelImplToJson(
|
||||
_$FeedConsultantPaginationModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'data': instance.data,
|
||||
'links': instance.links,
|
||||
'meta': instance.meta,
|
||||
};
|
||||
|
||||
_$FeedConsultantModelImpl _$$FeedConsultantModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$FeedConsultantModelImpl(
|
||||
slug: json['slug'] as String,
|
||||
name: json['name'] as String,
|
||||
ratingPlace: (json['rating_place'] as num).toInt(),
|
||||
photo: json['profile_photo_url'] as String,
|
||||
badges: (json['badges'] as List<dynamic>)
|
||||
.map((e) => BadgeModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$FeedConsultantModelImplToJson(
|
||||
_$FeedConsultantModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'slug': instance.slug,
|
||||
'name': instance.name,
|
||||
'rating_place': instance.ratingPlace,
|
||||
'profile_photo_url': instance.photo,
|
||||
'badges': instance.badges,
|
||||
};
|
||||
@@ -21,6 +21,8 @@ class Recipes with _$Recipes {
|
||||
required String type,
|
||||
required String slug,
|
||||
@JsonKey(name: 'total_comments') required int commentsCount,
|
||||
@JsonKey(name: 'was_liked_by_me') required bool wasLikedByMe,
|
||||
@JsonKey(name: 'energy_per_serving') required double calories,
|
||||
@JsonKey(name: 'total_likes') required int likesCount,
|
||||
@JsonKey(name: 'total_views') required int viewsCount,
|
||||
required Author author,
|
||||
|
||||
@@ -39,6 +39,10 @@ mixin _$Recipes {
|
||||
String get slug => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_comments')
|
||||
int get commentsCount => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'was_liked_by_me')
|
||||
bool get wasLikedByMe => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'energy_per_serving')
|
||||
double get calories => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_likes')
|
||||
int get likesCount => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_views')
|
||||
@@ -74,6 +78,8 @@ abstract class $RecipesCopyWith<$Res> {
|
||||
String type,
|
||||
String slug,
|
||||
@JsonKey(name: 'total_comments') int commentsCount,
|
||||
@JsonKey(name: 'was_liked_by_me') bool wasLikedByMe,
|
||||
@JsonKey(name: 'energy_per_serving') double calories,
|
||||
@JsonKey(name: 'total_likes') int likesCount,
|
||||
@JsonKey(name: 'total_views') int viewsCount,
|
||||
Author author});
|
||||
@@ -110,6 +116,8 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
|
||||
Object? type = null,
|
||||
Object? slug = null,
|
||||
Object? commentsCount = null,
|
||||
Object? wasLikedByMe = null,
|
||||
Object? calories = null,
|
||||
Object? likesCount = null,
|
||||
Object? viewsCount = null,
|
||||
Object? author = null,
|
||||
@@ -171,6 +179,14 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
|
||||
? _value.commentsCount
|
||||
: commentsCount // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
wasLikedByMe: null == wasLikedByMe
|
||||
? _value.wasLikedByMe
|
||||
: wasLikedByMe // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
calories: null == calories
|
||||
? _value.calories
|
||||
: calories // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
likesCount: null == likesCount
|
||||
? _value.likesCount
|
||||
: likesCount // ignore: cast_nullable_to_non_nullable
|
||||
@@ -219,6 +235,8 @@ abstract class _$$RecipesImplCopyWith<$Res> implements $RecipesCopyWith<$Res> {
|
||||
String type,
|
||||
String slug,
|
||||
@JsonKey(name: 'total_comments') int commentsCount,
|
||||
@JsonKey(name: 'was_liked_by_me') bool wasLikedByMe,
|
||||
@JsonKey(name: 'energy_per_serving') double calories,
|
||||
@JsonKey(name: 'total_likes') int likesCount,
|
||||
@JsonKey(name: 'total_views') int viewsCount,
|
||||
Author author});
|
||||
@@ -254,6 +272,8 @@ class __$$RecipesImplCopyWithImpl<$Res>
|
||||
Object? type = null,
|
||||
Object? slug = null,
|
||||
Object? commentsCount = null,
|
||||
Object? wasLikedByMe = null,
|
||||
Object? calories = null,
|
||||
Object? likesCount = null,
|
||||
Object? viewsCount = null,
|
||||
Object? author = null,
|
||||
@@ -315,6 +335,14 @@ class __$$RecipesImplCopyWithImpl<$Res>
|
||||
? _value.commentsCount
|
||||
: commentsCount // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
wasLikedByMe: null == wasLikedByMe
|
||||
? _value.wasLikedByMe
|
||||
: wasLikedByMe // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
calories: null == calories
|
||||
? _value.calories
|
||||
: calories // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
likesCount: null == likesCount
|
||||
? _value.likesCount
|
||||
: likesCount // ignore: cast_nullable_to_non_nullable
|
||||
@@ -349,6 +377,8 @@ class _$RecipesImpl implements _Recipes {
|
||||
required this.type,
|
||||
required this.slug,
|
||||
@JsonKey(name: 'total_comments') required this.commentsCount,
|
||||
@JsonKey(name: 'was_liked_by_me') required this.wasLikedByMe,
|
||||
@JsonKey(name: 'energy_per_serving') required this.calories,
|
||||
@JsonKey(name: 'total_likes') required this.likesCount,
|
||||
@JsonKey(name: 'total_views') required this.viewsCount,
|
||||
required this.author})
|
||||
@@ -404,6 +434,12 @@ class _$RecipesImpl implements _Recipes {
|
||||
@JsonKey(name: 'total_comments')
|
||||
final int commentsCount;
|
||||
@override
|
||||
@JsonKey(name: 'was_liked_by_me')
|
||||
final bool wasLikedByMe;
|
||||
@override
|
||||
@JsonKey(name: 'energy_per_serving')
|
||||
final double calories;
|
||||
@override
|
||||
@JsonKey(name: 'total_likes')
|
||||
final int likesCount;
|
||||
@override
|
||||
@@ -414,7 +450,7 @@ class _$RecipesImpl implements _Recipes {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Recipes(id: $id, image: $image, state: $state, cookingTime: $cookingTime, ingredients: $ingredients, description: $description, steps: $steps, videoUrl: $videoUrl, createdAt: $createdAt, updatedAt: $updatedAt, title: $title, type: $type, slug: $slug, commentsCount: $commentsCount, likesCount: $likesCount, viewsCount: $viewsCount, author: $author)';
|
||||
return 'Recipes(id: $id, image: $image, state: $state, cookingTime: $cookingTime, ingredients: $ingredients, description: $description, steps: $steps, videoUrl: $videoUrl, createdAt: $createdAt, updatedAt: $updatedAt, title: $title, type: $type, slug: $slug, commentsCount: $commentsCount, wasLikedByMe: $wasLikedByMe, calories: $calories, likesCount: $likesCount, viewsCount: $viewsCount, author: $author)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -443,6 +479,10 @@ class _$RecipesImpl implements _Recipes {
|
||||
(identical(other.slug, slug) || other.slug == slug) &&
|
||||
(identical(other.commentsCount, commentsCount) ||
|
||||
other.commentsCount == commentsCount) &&
|
||||
(identical(other.wasLikedByMe, wasLikedByMe) ||
|
||||
other.wasLikedByMe == wasLikedByMe) &&
|
||||
(identical(other.calories, calories) ||
|
||||
other.calories == calories) &&
|
||||
(identical(other.likesCount, likesCount) ||
|
||||
other.likesCount == likesCount) &&
|
||||
(identical(other.viewsCount, viewsCount) ||
|
||||
@@ -452,25 +492,28 @@ class _$RecipesImpl implements _Recipes {
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
image,
|
||||
state,
|
||||
cookingTime,
|
||||
const DeepCollectionEquality().hash(_ingredients),
|
||||
description,
|
||||
const DeepCollectionEquality().hash(_steps),
|
||||
videoUrl,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
title,
|
||||
type,
|
||||
slug,
|
||||
commentsCount,
|
||||
likesCount,
|
||||
viewsCount,
|
||||
author);
|
||||
int get hashCode => Object.hashAll([
|
||||
runtimeType,
|
||||
id,
|
||||
image,
|
||||
state,
|
||||
cookingTime,
|
||||
const DeepCollectionEquality().hash(_ingredients),
|
||||
description,
|
||||
const DeepCollectionEquality().hash(_steps),
|
||||
videoUrl,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
title,
|
||||
type,
|
||||
slug,
|
||||
commentsCount,
|
||||
wasLikedByMe,
|
||||
calories,
|
||||
likesCount,
|
||||
viewsCount,
|
||||
author
|
||||
]);
|
||||
|
||||
/// Create a copy of Recipes
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -504,6 +547,8 @@ abstract class _Recipes implements Recipes {
|
||||
required final String type,
|
||||
required final String slug,
|
||||
@JsonKey(name: 'total_comments') required final int commentsCount,
|
||||
@JsonKey(name: 'was_liked_by_me') required final bool wasLikedByMe,
|
||||
@JsonKey(name: 'energy_per_serving') required final double calories,
|
||||
@JsonKey(name: 'total_likes') required final int likesCount,
|
||||
@JsonKey(name: 'total_views') required final int viewsCount,
|
||||
required final Author author}) = _$RecipesImpl;
|
||||
@@ -544,6 +589,12 @@ abstract class _Recipes implements Recipes {
|
||||
@JsonKey(name: 'total_comments')
|
||||
int get commentsCount;
|
||||
@override
|
||||
@JsonKey(name: 'was_liked_by_me')
|
||||
bool get wasLikedByMe;
|
||||
@override
|
||||
@JsonKey(name: 'energy_per_serving')
|
||||
double get calories;
|
||||
@override
|
||||
@JsonKey(name: 'total_likes')
|
||||
int get likesCount;
|
||||
@override
|
||||
|
||||
@@ -26,6 +26,8 @@ _$RecipesImpl _$$RecipesImplFromJson(Map<String, dynamic> json) =>
|
||||
type: json['type'] as String,
|
||||
slug: json['slug'] as String,
|
||||
commentsCount: (json['total_comments'] as num).toInt(),
|
||||
wasLikedByMe: json['was_liked_by_me'] as bool,
|
||||
calories: (json['energy_per_serving'] as num).toDouble(),
|
||||
likesCount: (json['total_likes'] as num).toInt(),
|
||||
viewsCount: (json['total_views'] as num).toInt(),
|
||||
author: Author.fromJson(json['author'] as Map<String, dynamic>),
|
||||
@@ -47,6 +49,8 @@ Map<String, dynamic> _$$RecipesImplToJson(_$RecipesImpl instance) =>
|
||||
'type': instance.type,
|
||||
'slug': instance.slug,
|
||||
'total_comments': instance.commentsCount,
|
||||
'was_liked_by_me': instance.wasLikedByMe,
|
||||
'energy_per_serving': instance.calories,
|
||||
'total_likes': instance.likesCount,
|
||||
'total_views': instance.viewsCount,
|
||||
'author': instance.author,
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/consultants_cubit/consultants_state.dart';
|
||||
import 'package:eatvio_app/features/feed/repositories/feed_repository.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class ConsultantsCubit extends Cubit<ConsultantsState> {
|
||||
final FeedRepository feedRepository;
|
||||
|
||||
ConsultantsCubit({
|
||||
required this.feedRepository,
|
||||
}) : super(ConsultantsState());
|
||||
|
||||
getConsultants() async {
|
||||
emit(ConsultantsState.loading());
|
||||
try {
|
||||
emit(
|
||||
ConsultantsState.loaded(
|
||||
consultantsList: await feedRepository.getConsultants(),
|
||||
isLoading: false,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(ConsultantsState.error(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'consultants_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ConsultantsState with _$ConsultantsState {
|
||||
const factory ConsultantsState() = _ConsultantsState;
|
||||
|
||||
const factory ConsultantsState.loading() = ConsultantsStateLoading;
|
||||
|
||||
const factory ConsultantsState.loaded({
|
||||
required List<FeedConsultantModel> consultantsList,
|
||||
required bool isLoading,
|
||||
}) = ConsultantsStateLoaded;
|
||||
|
||||
const factory ConsultantsState.error({
|
||||
required String errorMessage,
|
||||
}) = ConsultantsStateError;
|
||||
}
|
||||
@@ -0,0 +1,686 @@
|
||||
// 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 'consultants_state.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');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ConsultantsState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value) $default, {
|
||||
required TResult Function(ConsultantsStateLoading value) loading,
|
||||
required TResult Function(ConsultantsStateLoaded value) loaded,
|
||||
required TResult Function(ConsultantsStateError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ConsultantsState value)? $default, {
|
||||
TResult? Function(ConsultantsStateLoading value)? loading,
|
||||
TResult? Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult? Function(ConsultantsStateError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value)? $default, {
|
||||
TResult Function(ConsultantsStateLoading value)? loading,
|
||||
TResult Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult Function(ConsultantsStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ConsultantsStateCopyWith<$Res> {
|
||||
factory $ConsultantsStateCopyWith(
|
||||
ConsultantsState value, $Res Function(ConsultantsState) then) =
|
||||
_$ConsultantsStateCopyWithImpl<$Res, ConsultantsState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ConsultantsStateCopyWithImpl<$Res, $Val extends ConsultantsState>
|
||||
implements $ConsultantsStateCopyWith<$Res> {
|
||||
_$ConsultantsStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConsultantsStateImplCopyWith<$Res> {
|
||||
factory _$$ConsultantsStateImplCopyWith(_$ConsultantsStateImpl value,
|
||||
$Res Function(_$ConsultantsStateImpl) then) =
|
||||
__$$ConsultantsStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConsultantsStateImplCopyWithImpl<$Res>
|
||||
extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateImpl>
|
||||
implements _$$ConsultantsStateImplCopyWith<$Res> {
|
||||
__$$ConsultantsStateImplCopyWithImpl(_$ConsultantsStateImpl _value,
|
||||
$Res Function(_$ConsultantsStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConsultantsStateImpl implements _ConsultantsState {
|
||||
const _$ConsultantsStateImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ConsultantsState()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$ConsultantsStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value) $default, {
|
||||
required TResult Function(ConsultantsStateLoading value) loading,
|
||||
required TResult Function(ConsultantsStateLoaded value) loaded,
|
||||
required TResult Function(ConsultantsStateError value) error,
|
||||
}) {
|
||||
return $default(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ConsultantsState value)? $default, {
|
||||
TResult? Function(ConsultantsStateLoading value)? loading,
|
||||
TResult? Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult? Function(ConsultantsStateError value)? error,
|
||||
}) {
|
||||
return $default?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value)? $default, {
|
||||
TResult Function(ConsultantsStateLoading value)? loading,
|
||||
TResult Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult Function(ConsultantsStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ConsultantsState implements ConsultantsState {
|
||||
const factory _ConsultantsState() = _$ConsultantsStateImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConsultantsStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$ConsultantsStateLoadingImplCopyWith(
|
||||
_$ConsultantsStateLoadingImpl value,
|
||||
$Res Function(_$ConsultantsStateLoadingImpl) then) =
|
||||
__$$ConsultantsStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConsultantsStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateLoadingImpl>
|
||||
implements _$$ConsultantsStateLoadingImplCopyWith<$Res> {
|
||||
__$$ConsultantsStateLoadingImplCopyWithImpl(
|
||||
_$ConsultantsStateLoadingImpl _value,
|
||||
$Res Function(_$ConsultantsStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConsultantsStateLoadingImpl implements ConsultantsStateLoading {
|
||||
const _$ConsultantsStateLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ConsultantsState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConsultantsStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value) $default, {
|
||||
required TResult Function(ConsultantsStateLoading value) loading,
|
||||
required TResult Function(ConsultantsStateLoaded value) loaded,
|
||||
required TResult Function(ConsultantsStateError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ConsultantsState value)? $default, {
|
||||
TResult? Function(ConsultantsStateLoading value)? loading,
|
||||
TResult? Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult? Function(ConsultantsStateError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value)? $default, {
|
||||
TResult Function(ConsultantsStateLoading value)? loading,
|
||||
TResult Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult Function(ConsultantsStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ConsultantsStateLoading implements ConsultantsState {
|
||||
const factory ConsultantsStateLoading() = _$ConsultantsStateLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConsultantsStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$ConsultantsStateLoadedImplCopyWith(
|
||||
_$ConsultantsStateLoadedImpl value,
|
||||
$Res Function(_$ConsultantsStateLoadedImpl) then) =
|
||||
__$$ConsultantsStateLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({List<FeedConsultantModel> consultantsList, bool isLoading});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConsultantsStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateLoadedImpl>
|
||||
implements _$$ConsultantsStateLoadedImplCopyWith<$Res> {
|
||||
__$$ConsultantsStateLoadedImplCopyWithImpl(
|
||||
_$ConsultantsStateLoadedImpl _value,
|
||||
$Res Function(_$ConsultantsStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? consultantsList = null,
|
||||
Object? isLoading = null,
|
||||
}) {
|
||||
return _then(_$ConsultantsStateLoadedImpl(
|
||||
consultantsList: null == consultantsList
|
||||
? _value._consultantsList
|
||||
: consultantsList // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedConsultantModel>,
|
||||
isLoading: null == isLoading
|
||||
? _value.isLoading
|
||||
: isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded {
|
||||
const _$ConsultantsStateLoadedImpl(
|
||||
{required final List<FeedConsultantModel> consultantsList,
|
||||
required this.isLoading})
|
||||
: _consultantsList = consultantsList;
|
||||
|
||||
final List<FeedConsultantModel> _consultantsList;
|
||||
@override
|
||||
List<FeedConsultantModel> get consultantsList {
|
||||
if (_consultantsList is EqualUnmodifiableListView) return _consultantsList;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_consultantsList);
|
||||
}
|
||||
|
||||
@override
|
||||
final bool isLoading;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ConsultantsState.loaded(consultantsList: $consultantsList, isLoading: $isLoading)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConsultantsStateLoadedImpl &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._consultantsList, _consultantsList) &&
|
||||
(identical(other.isLoading, isLoading) ||
|
||||
other.isLoading == isLoading));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,
|
||||
const DeepCollectionEquality().hash(_consultantsList), isLoading);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ConsultantsStateLoadedImplCopyWith<_$ConsultantsStateLoadedImpl>
|
||||
get copyWith => __$$ConsultantsStateLoadedImplCopyWithImpl<
|
||||
_$ConsultantsStateLoadedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loaded(consultantsList, isLoading);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loaded?.call(consultantsList, isLoading);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(consultantsList, isLoading);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value) $default, {
|
||||
required TResult Function(ConsultantsStateLoading value) loading,
|
||||
required TResult Function(ConsultantsStateLoaded value) loaded,
|
||||
required TResult Function(ConsultantsStateError value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ConsultantsState value)? $default, {
|
||||
TResult? Function(ConsultantsStateLoading value)? loading,
|
||||
TResult? Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult? Function(ConsultantsStateError value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value)? $default, {
|
||||
TResult Function(ConsultantsStateLoading value)? loading,
|
||||
TResult Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult Function(ConsultantsStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ConsultantsStateLoaded implements ConsultantsState {
|
||||
const factory ConsultantsStateLoaded(
|
||||
{required final List<FeedConsultantModel> consultantsList,
|
||||
required final bool isLoading}) = _$ConsultantsStateLoadedImpl;
|
||||
|
||||
List<FeedConsultantModel> get consultantsList;
|
||||
bool get isLoading;
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ConsultantsStateLoadedImplCopyWith<_$ConsultantsStateLoadedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConsultantsStateErrorImplCopyWith<$Res> {
|
||||
factory _$$ConsultantsStateErrorImplCopyWith(
|
||||
_$ConsultantsStateErrorImpl value,
|
||||
$Res Function(_$ConsultantsStateErrorImpl) then) =
|
||||
__$$ConsultantsStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConsultantsStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateErrorImpl>
|
||||
implements _$$ConsultantsStateErrorImplCopyWith<$Res> {
|
||||
__$$ConsultantsStateErrorImplCopyWithImpl(_$ConsultantsStateErrorImpl _value,
|
||||
$Res Function(_$ConsultantsStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? errorMessage = null,
|
||||
}) {
|
||||
return _then(_$ConsultantsStateErrorImpl(
|
||||
errorMessage: null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConsultantsStateErrorImpl implements ConsultantsStateError {
|
||||
const _$ConsultantsStateErrorImpl({required this.errorMessage});
|
||||
|
||||
@override
|
||||
final String errorMessage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ConsultantsState.error(errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConsultantsStateErrorImpl &&
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, errorMessage);
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ConsultantsStateErrorImplCopyWith<_$ConsultantsStateErrorImpl>
|
||||
get copyWith => __$$ConsultantsStateErrorImplCopyWithImpl<
|
||||
_$ConsultantsStateErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(
|
||||
List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<FeedConsultantModel> consultantsList, bool isLoading)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value) $default, {
|
||||
required TResult Function(ConsultantsStateLoading value) loading,
|
||||
required TResult Function(ConsultantsStateLoaded value) loaded,
|
||||
required TResult Function(ConsultantsStateError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ConsultantsState value)? $default, {
|
||||
TResult? Function(ConsultantsStateLoading value)? loading,
|
||||
TResult? Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult? Function(ConsultantsStateError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ConsultantsState value)? $default, {
|
||||
TResult Function(ConsultantsStateLoading value)? loading,
|
||||
TResult Function(ConsultantsStateLoaded value)? loaded,
|
||||
TResult Function(ConsultantsStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ConsultantsStateError implements ConsultantsState {
|
||||
const factory ConsultantsStateError({required final String errorMessage}) =
|
||||
_$ConsultantsStateErrorImpl;
|
||||
|
||||
String get errorMessage;
|
||||
|
||||
/// Create a copy of ConsultantsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ConsultantsStateErrorImplCopyWith<_$ConsultantsStateErrorImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import 'package:eatvio_app/core/widgets/custom_search_bar.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart';
|
||||
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/create_plan_screen.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/consultants_cubit/consultants_state.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_state.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
||||
@@ -14,6 +16,7 @@ import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/consultant_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/diets_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/filter_badge.dart';
|
||||
@@ -43,6 +46,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
final RecipesCubit recipesCubit = sl<RecipesCubit>()..loadRecipesList();
|
||||
final DietsCubit dietsCubit = sl<DietsCubit>()..loadDiets();
|
||||
final PlansCubit plansCubit = sl<PlansCubit>()..loadPlans();
|
||||
final ConsultantsCubit consultantsCubit = sl<ConsultantsCubit>()..getConsultants();
|
||||
|
||||
final searchController = TextEditingController();
|
||||
final List<String> chipsLabelList = ['Все', 'Рецепты', 'Диеты', 'Планы питания', 'Консультанты'];
|
||||
@@ -51,6 +55,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
final recipesScrollController = ScrollController();
|
||||
final dietsScrollController = ScrollController();
|
||||
final plansScrollController = ScrollController();
|
||||
final consultantsScrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -59,6 +64,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
recipesScrollController.addListener(_onScrollRecipes);
|
||||
dietsScrollController.addListener(_onScrollDiets);
|
||||
plansScrollController.addListener(_onScrollPlans);
|
||||
consultantsScrollController.addListener(_onScrollConsultants);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -86,6 +92,10 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
_onScrollConsultants() {
|
||||
if (consultantsScrollController.offset >= consultantsScrollController.position.maxScrollExtent && !consultantsScrollController.position.outOfRange) {}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
blogPostsScrollController.dispose();
|
||||
@@ -111,6 +121,9 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
BlocProvider<PlansCubit>(
|
||||
create: (context) => sl<PlansCubit>()..loadPlans(),
|
||||
),
|
||||
BlocProvider<ConsultantsCubit>(
|
||||
create: (context) => sl<ConsultantsCubit>()..getConsultants(),
|
||||
),
|
||||
],
|
||||
child: Scaffold(
|
||||
floatingActionButton: _selectedChipIndex == 1
|
||||
@@ -145,6 +158,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
1 => recipesScrollController,
|
||||
2 => dietsScrollController,
|
||||
3 => plansScrollController,
|
||||
4 => consultantsScrollController,
|
||||
_ => blogPostsScrollController
|
||||
},
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
@@ -186,6 +200,9 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
case 3:
|
||||
plansCubit.loadPlans(query: query);
|
||||
break;
|
||||
case 4:
|
||||
consultantsCubit.getConsultants();
|
||||
break;
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -207,6 +224,9 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
case 3:
|
||||
plansCubit.loadPlans();
|
||||
break;
|
||||
case 4:
|
||||
consultantsCubit.getConsultants();
|
||||
break;
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -238,6 +258,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
1 => _buildAllRecipes(),
|
||||
2 => _buildDiets(),
|
||||
3 => _buildPlans(),
|
||||
4 => _buildConsultants(),
|
||||
_ => Center(child: Text(chipsLabelList[_selectedChipIndex])),
|
||||
},
|
||||
),
|
||||
@@ -287,6 +308,56 @@ class _FeedScreenState extends State<FeedScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_buildConsultants() {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => consultantsCubit.getConsultants(),
|
||||
child: BlocBuilder<ConsultantsCubit, ConsultantsState>(
|
||||
bloc: consultantsCubit,
|
||||
builder: (BuildContext context, ConsultantsState state) {
|
||||
if (state is ConsultantsStateLoaded) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return ConsultantWidget(consultant: state.consultantsList[index]);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return SizedBox(height: 12);
|
||||
},
|
||||
itemCount: state.consultantsList.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (state is ConsultantsStateError) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Text(state.errorMessage),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
body: const Loader(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildAllRecipes() {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => recipesCubit.loadRecipesList(),
|
||||
|
||||
@@ -207,11 +207,15 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
|
||||
'assets/icons/share.svg',
|
||||
colorFilter: ColorFilter.mode(appTheme.gray600, BlendMode.srcIn),
|
||||
),
|
||||
onTap: () => Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + state.feedBlogPostList[widget.index].id.toString(),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + state.feedBlogPostList[widget.index].id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
|
||||
138
lib/features/feed/presentation/widgets/consultant_widget.dart
Normal file
138
lib/features/feed/presentation/widgets/consultant_widget.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/badge_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class ConsultantWidget extends StatelessWidget {
|
||||
final FeedConsultantModel consultant;
|
||||
|
||||
const ConsultantWidget({
|
||||
super.key,
|
||||
required this.consultant,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
GoRouter.of(context).pushNamed(
|
||||
'profileScreen',
|
||||
extra: Author(
|
||||
authorSlug: consultant.slug,
|
||||
authorName: consultant.name,
|
||||
authorProfileIcon: consultant.photo,
|
||||
authorIsMe: false,
|
||||
),
|
||||
);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Ink(
|
||||
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${consultant.ratingPlace}',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: appTheme.blueA400,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
CircleAvatar(
|
||||
foregroundImage: NetworkImage(consultant.photo),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
consultant.name,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: Color(0xFF323F4B),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Рейтинг: RATING',
|
||||
style: TextStyle(
|
||||
color: appTheme.blueA400,
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Ink(
|
||||
padding: EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
'assets/icons/go_to_arrow.svg',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text('description'),
|
||||
if (consultant.badges.isNotEmpty) const SizedBox(height: 8),
|
||||
_badges(consultant.badges, context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_badges(List<BadgeModel> badges, BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
for (int i = 0; i < badges.length; i++) ...[
|
||||
badges[i].image.contains('svg')
|
||||
? SvgPicture.network(
|
||||
baseUrl + '/storage/' + badges[i].image,
|
||||
width: 28,
|
||||
height: 28,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: baseUrl + '/storage/' + badges[i].image,
|
||||
),
|
||||
i < badges.length - 1 ? const SizedBox(width: 8) : const SizedBox.shrink(),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -144,10 +144,12 @@ class _DietsWidgetState extends State<DietsWidget> {
|
||||
FeedIconButton(
|
||||
svgIcon: SvgPicture.asset('assets/icons/repost.svg'),
|
||||
onTap: () async {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
final result = await Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/diet/' + widget.diet.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
switch (result.status) {
|
||||
case ShareResultStatus.success:
|
||||
|
||||
@@ -201,10 +201,12 @@ class _PlanWidgetState extends State<PlanWidget> {
|
||||
FeedIconButton(
|
||||
svgIcon: SvgPicture.asset('assets/icons/repost.svg'),
|
||||
onTap: () async {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
final result = await Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/diet/' + widget.plan.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
switch (result.status) {
|
||||
case ShareResultStatus.success:
|
||||
|
||||
@@ -21,6 +21,14 @@ class RecipesWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RecipesWidgetState extends State<RecipesWidget> {
|
||||
late bool isLiked;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
isLiked = false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
@@ -143,11 +151,15 @@ class _RecipesWidgetState extends State<RecipesWidget> {
|
||||
'assets/icons/share.svg',
|
||||
colorFilter: ColorFilter.mode(appTheme.gray600, BlendMode.srcIn),
|
||||
),
|
||||
onTap: () => Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + widget.recipes.id.toString(),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + widget.recipes.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:eatvio_app/features/feed/models/comment_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/features/feed/services/feed_service.dart';
|
||||
@@ -208,4 +209,12 @@ class FeedRepository {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<FeedConsultantModel>> getConsultants() async {
|
||||
try {
|
||||
return (await feedService.getConsultants()).data;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/feed/models/comment_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_pagination_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
@@ -101,4 +102,7 @@ abstract class FeedService {
|
||||
Future<void> unlikedBlogPost({
|
||||
@Path() required int id,
|
||||
});
|
||||
|
||||
@GET('/api/consultants/index')
|
||||
Future<FeedConsultantPaginationModel> getConsultants();
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'feed_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _FeedService implements FeedService {
|
||||
_FeedService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_FeedService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -34,22 +30,16 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<FeedBlogPostSettingsModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<FeedBlogPostSettingsModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late FeedBlogPostSettingsModel _value;
|
||||
try {
|
||||
@@ -76,22 +66,16 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<RecipesPagination>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<RecipesPagination>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late RecipesPagination _value;
|
||||
try {
|
||||
@@ -122,22 +106,16 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DietsPagination>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<DietsPagination>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DietsPagination _value;
|
||||
try {
|
||||
@@ -170,22 +148,16 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<PlanPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<PlanPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late PlanPaginationModel _value;
|
||||
try {
|
||||
@@ -203,22 +175,16 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<CommentModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<CommentModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CommentModel _value;
|
||||
try {
|
||||
@@ -241,32 +207,20 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'body',
|
||||
body,
|
||||
));
|
||||
_data.fields.add(MapEntry('body', body));
|
||||
if (parentCommentId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'parentCommentId',
|
||||
parentCommentId.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('parentCommentId', parentCommentId.toString()));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -276,22 +230,16 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<CommentModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<CommentModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CommentModel _value;
|
||||
try {
|
||||
@@ -314,32 +262,20 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'body',
|
||||
body,
|
||||
));
|
||||
_data.fields.add(MapEntry('body', body));
|
||||
if (parentCommentId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'parentCommentId',
|
||||
parentCommentId.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('parentCommentId', parentCommentId.toString()));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -349,22 +285,16 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<CommentModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<CommentModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CommentModel _value;
|
||||
try {
|
||||
@@ -387,32 +317,20 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'body',
|
||||
body,
|
||||
));
|
||||
_data.fields.add(MapEntry('body', body));
|
||||
if (parentCommentId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'parentCommentId',
|
||||
parentCommentId.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('parentCommentId', parentCommentId.toString()));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -422,22 +340,16 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<CommentModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<CommentModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/${id}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CommentModel _value;
|
||||
try {
|
||||
@@ -460,32 +372,20 @@ class _FeedService implements FeedService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'body',
|
||||
body,
|
||||
));
|
||||
_data.fields.add(MapEntry('body', body));
|
||||
if (parentCommentId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'parentCommentId',
|
||||
parentCommentId.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('parentCommentId', parentCommentId.toString()));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/${id}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -495,22 +395,16 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -520,25 +414,46 @@ class _FeedService implements FeedService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/unliked',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/${id}/unliked',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FeedConsultantPaginationModel> getConsultants() async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<FeedConsultantPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultants/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late FeedConsultantPaginationModel _value;
|
||||
try {
|
||||
_value = FeedConsultantPaginationModel.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 ||
|
||||
@@ -552,10 +467,7 @@ class _FeedService implements FeedService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'glossary_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _GlossaryService implements GlossaryService {
|
||||
_GlossaryService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_GlossaryService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -22,28 +18,23 @@ class _GlossaryService implements GlossaryService {
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<GlossaryPaginationModel> getGlossaryByQuery(
|
||||
{required String query}) async {
|
||||
Future<GlossaryPaginationModel> getGlossaryByQuery({
|
||||
required String query,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{r'search': query};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<GlossaryPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/glossaries/search',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<GlossaryPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/glossaries/search',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late GlossaryPaginationModel _value;
|
||||
try {
|
||||
@@ -68,10 +59,7 @@ class _GlossaryService implements GlossaryService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -128,10 +128,12 @@ class _MyDietWidgetState extends State<MyDietWidget> {
|
||||
SizedBox(width: 6),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () async {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
await Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/diet/' + widget.diet.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
height: 52,
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'my_diets_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _MyDietsService implements MyDietsService {
|
||||
_MyDietsService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_MyDietsService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -40,22 +36,16 @@ class _MyDietsService implements MyDietsService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DietsPagination>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<DietsPagination>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DietsPagination _value;
|
||||
try {
|
||||
@@ -73,22 +63,16 @@ class _MyDietsService implements MyDietsService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/delete/${dietId}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/delete/${dietId}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -105,10 +89,7 @@ class _MyDietsService implements MyDietsService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -135,10 +135,12 @@ class _MyPlanWidgetState extends State<MyPlanWidget> {
|
||||
SizedBox(width: 6),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () async {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
await Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/plan/' + widget.plan.id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
height: 52,
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'my_plans_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _MyPlansService implements MyPlansService {
|
||||
_MyPlansService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_MyPlansService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -42,22 +38,16 @@ class _MyPlansService implements MyPlansService {
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<PlanPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<PlanPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late PlanPaginationModel _value;
|
||||
try {
|
||||
@@ -75,22 +65,16 @@ class _MyPlansService implements MyPlansService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/delete/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/delete/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -107,10 +91,7 @@ class _MyPlansService implements MyPlansService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'plan_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _PlanService implements PlanService {
|
||||
_PlanService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_PlanService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _PlanService implements PlanService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<PlanModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/show/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<PlanModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/show/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late PlanModel _value;
|
||||
try {
|
||||
@@ -60,22 +50,16 @@ class _PlanService implements PlanService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -85,22 +69,16 @@ class _PlanService implements PlanService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/add_to_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/add_to_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -110,22 +88,16 @@ class _PlanService implements PlanService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/remove_from_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/remove_from_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -142,10 +114,7 @@ class _PlanService implements PlanService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'plans_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _PlansService implements PlansService {
|
||||
_PlansService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_PlansService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _PlansService implements PlansService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<PlanPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/get_by_author/${author}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<PlanPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/get_by_author/${author}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late PlanPaginationModel _value;
|
||||
try {
|
||||
@@ -67,10 +57,7 @@ class _PlansService implements PlansService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -1006,10 +1006,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
const Spacer(),
|
||||
PopupMenuButton(
|
||||
onSelected: (value) {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/profile/' + state.profile.slug,
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
|
||||
@@ -208,11 +208,15 @@ class _ProfileBlogPostWidgetState extends State<ProfileBlogPostWidget> {
|
||||
'assets/icons/share.svg',
|
||||
colorFilter: ColorFilter.mode(appTheme.gray600, BlendMode.srcIn),
|
||||
),
|
||||
onTap: () => Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + state.blogPosts[widget.index].id.toString(),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + state.blogPosts[widget.index].id.toString(),
|
||||
),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'profile_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _ProfileService implements ProfileService {
|
||||
_ProfileService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_ProfileService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ProfileModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/show/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/show/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileModel _value;
|
||||
try {
|
||||
@@ -60,22 +50,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ProfileModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/index',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileModel _value;
|
||||
try {
|
||||
@@ -93,22 +77,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ProfileDetailsModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/detailz',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileDetailsModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/detailz',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileDetailsModel _value;
|
||||
try {
|
||||
@@ -121,28 +99,23 @@ class _ProfileService implements ProfileService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ProfileDetailsModel> getProfileDetailsBySlug(
|
||||
{required String slug}) async {
|
||||
Future<ProfileDetailsModel> getProfileDetailsBySlug({
|
||||
required String slug,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ProfileDetailsModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/detailz/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileDetailsModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/detailz/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileDetailsModel _value;
|
||||
try {
|
||||
@@ -164,34 +137,25 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'chest_circumference',
|
||||
chestCircumference.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry(
|
||||
'waist_circumference',
|
||||
waistCircumference.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry(
|
||||
'hip_circumference',
|
||||
hipCircumference.toString(),
|
||||
));
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/addCircumference',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
_data.fields.add(
|
||||
MapEntry('chest_circumference', chestCircumference.toString()),
|
||||
);
|
||||
_data.fields.add(
|
||||
MapEntry('waist_circumference', waistCircumference.toString()),
|
||||
);
|
||||
_data.fields.add(
|
||||
MapEntry('hip_circumference', hipCircumference.toString()),
|
||||
);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/addCircumference',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -201,58 +165,46 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'weight',
|
||||
weight.toString(),
|
||||
));
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/addWeight',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
_data.fields.add(MapEntry('weight', weight.toString()));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/addWeight',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<FeedBlogPostModel>> getBlogPostByAuthorSlug(
|
||||
{required String slug}) async {
|
||||
Future<List<FeedBlogPostModel>> getBlogPostByAuthorSlug({
|
||||
required String slug,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<FeedBlogPostModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/search_by_author/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<FeedBlogPostModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/blogPosts/search_by_author/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<FeedBlogPostModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
FeedBlogPostModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) =>
|
||||
FeedBlogPostModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -267,27 +219,23 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<WeightModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<WeightModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<WeightModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -305,27 +253,23 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<WeightModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<WeightModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<WeightModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -335,34 +279,31 @@ class _ProfileService implements ProfileService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<CircumferenceModel>> getCircumferences(
|
||||
{required String period}) async {
|
||||
Future<List<CircumferenceModel>> getCircumferences({
|
||||
required String period,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<CircumferenceModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -380,28 +321,24 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}/{user}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}/{user}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<CircumferenceModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>))
|
||||
.map(
|
||||
(dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
@@ -417,27 +354,21 @@ class _ProfileService implements ProfileService {
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{
|
||||
r'filters[name][$startsWith]': query
|
||||
r'filters[name][$startsWith]': query,
|
||||
};
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<SubPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/${slug}/subscribers',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<SubPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/${slug}/subscribers',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late SubPaginationModel _value;
|
||||
try {
|
||||
@@ -456,27 +387,21 @@ class _ProfileService implements ProfileService {
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{
|
||||
r'filters[name][$startsWith]': query
|
||||
r'filters[name][$startsWith]': query,
|
||||
};
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<SubPaginationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/${slug}/subscriptions',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<SubPaginationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/${slug}/subscriptions',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late SubPaginationModel _value;
|
||||
try {
|
||||
@@ -494,22 +419,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/subscribe/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/subscribe/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -519,22 +438,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/unsubscribe/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/unsubscribe/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -544,30 +457,30 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.files.add(MapEntry(
|
||||
'photo',
|
||||
MultipartFile.fromFileSync(
|
||||
photo.path,
|
||||
filename: photo.path.split(Platform.pathSeparator).last,
|
||||
_data.files.add(
|
||||
MapEntry(
|
||||
'photo',
|
||||
MultipartFile.fromFileSync(
|
||||
photo.path,
|
||||
filename: photo.path.split(Platform.pathSeparator).last,
|
||||
),
|
||||
),
|
||||
));
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/photo/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/photo/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -577,22 +490,16 @@ class _ProfileService implements ProfileService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'DELETE',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/photo/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'DELETE', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/photo/delete',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@@ -609,10 +516,7 @@ class _ProfileService implements ProfileService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'recipe_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _RecipeService implements RecipeService {
|
||||
_RecipeService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_RecipeService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _RecipeService implements RecipeService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<RecipeModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<RecipeModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late RecipeModel _value;
|
||||
try {
|
||||
@@ -60,30 +50,27 @@ class _RecipeService implements RecipeService {
|
||||
final queryParameters = <String, dynamic>{r'name': name};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Map<String, List<Product>>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/product_nutritional_values/filter',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Map<String, List<Product>>>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diary/product_nutritional_values/filter',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Map<String, List<Product>> _value;
|
||||
try {
|
||||
_value = _result.data!.map((k, dynamic v) => MapEntry(
|
||||
_value = _result.data!.map(
|
||||
(k, dynamic v) => MapEntry(
|
||||
k,
|
||||
(v as List)
|
||||
.map((i) => Product.fromJson(i as Map<String, dynamic>))
|
||||
.toList()));
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
@@ -109,34 +96,19 @@ class _RecipeService implements RecipeService {
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
if (type != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'type',
|
||||
type,
|
||||
));
|
||||
_data.fields.add(MapEntry('type', type));
|
||||
}
|
||||
if (state != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'state',
|
||||
state,
|
||||
));
|
||||
_data.fields.add(MapEntry('state', state));
|
||||
}
|
||||
if (title != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'title',
|
||||
title,
|
||||
));
|
||||
_data.fields.add(MapEntry('title', title));
|
||||
}
|
||||
if (description != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'description',
|
||||
description,
|
||||
));
|
||||
_data.fields.add(MapEntry('description', description));
|
||||
}
|
||||
if (video_url != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'video_url',
|
||||
video_url,
|
||||
));
|
||||
_data.fields.add(MapEntry('video_url', video_url));
|
||||
}
|
||||
ingredients.forEach((i) {
|
||||
_data.fields.add(MapEntry('ingredients', jsonEncode(i)));
|
||||
@@ -145,34 +117,27 @@ class _RecipeService implements RecipeService {
|
||||
_data.fields.add(MapEntry('steps', jsonEncode(i)));
|
||||
});
|
||||
if (cooking_time != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'cooking_time',
|
||||
cooking_time.toString(),
|
||||
));
|
||||
_data.fields.add(MapEntry('cooking_time', cooking_time.toString()));
|
||||
}
|
||||
_data.files.add(MapEntry(
|
||||
'image',
|
||||
MultipartFile.fromFileSync(
|
||||
image.path,
|
||||
filename: image.path.split(Platform.pathSeparator).last,
|
||||
_data.files.add(
|
||||
MapEntry(
|
||||
'image',
|
||||
MultipartFile.fromFileSync(
|
||||
image.path,
|
||||
filename: image.path.split(Platform.pathSeparator).last,
|
||||
),
|
||||
),
|
||||
));
|
||||
final _options = _setStreamType<RecipeModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
);
|
||||
final _options = _setStreamType<RecipeModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late RecipeModel _value;
|
||||
try {
|
||||
@@ -185,30 +150,21 @@ class _RecipeService implements RecipeService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<RecipeModel> editRecipe(
|
||||
Map<String, Object?> recipe,
|
||||
String id,
|
||||
) async {
|
||||
Future<RecipeModel> editRecipe(Map<String, Object?> recipe, String id) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData.fromMap(recipe);
|
||||
final _options = _setStreamType<RecipeModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/update/{id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<RecipeModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/update/{id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late RecipeModel _value;
|
||||
try {
|
||||
@@ -226,22 +182,16 @@ class _RecipeService implements RecipeService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<RecipeTagModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/tags',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<RecipeTagModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/recipes/tags',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late RecipeTagModel _value;
|
||||
try {
|
||||
@@ -266,10 +216,7 @@ class _RecipeService implements RecipeService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'registration_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _RegistrationService implements RegistrationService {
|
||||
_RegistrationService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_RegistrationService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -22,29 +18,24 @@ class _RegistrationService implements RegistrationService {
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<Map<String, String>> register(
|
||||
{required Map<String, dynamic> sheet}) async {
|
||||
Future<Map<String, String>> register({
|
||||
required Map<String, dynamic> sheet,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(sheet);
|
||||
final _options = _setStreamType<Map<String, String>>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/register',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<Map<String, String>>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/register',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Map<String, String> _value;
|
||||
try {
|
||||
@@ -62,22 +53,16 @@ class _RegistrationService implements RegistrationService {
|
||||
final queryParameters = <String, dynamic>{r'user_address': query};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<LocationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_address',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<LocationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_address',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late LocationModel _value;
|
||||
try {
|
||||
@@ -101,22 +86,16 @@ class _RegistrationService implements RegistrationService {
|
||||
};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<LocationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_coordinate',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<LocationModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/location_by_coordinate',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late LocationModel _value;
|
||||
try {
|
||||
@@ -141,10 +120,7 @@ class _RegistrationService implements RegistrationService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ part of 'settings_service.dart';
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _SettingsService implements SettingsService {
|
||||
_SettingsService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
_SettingsService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
@@ -27,22 +23,16 @@ class _SettingsService implements SettingsService {
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<ProfileSettingsModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/settings',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileSettingsModel>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/settings',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileSettingsModel _value;
|
||||
try {
|
||||
@@ -55,29 +45,24 @@ class _SettingsService implements SettingsService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ProfileSettingsModel> updateProfileSettings(
|
||||
{required Map<String, dynamic> data}) async {
|
||||
Future<ProfileSettingsModel> updateProfileSettings({
|
||||
required Map<String, dynamic> data,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(data);
|
||||
final _options = _setStreamType<ProfileSettingsModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/settings/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileSettingsModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/settings/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileSettingsModel _value;
|
||||
try {
|
||||
@@ -90,29 +75,24 @@ class _SettingsService implements SettingsService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ProfileDetailsModel> updateProfileDetails(
|
||||
{required Map<String, dynamic> data}) async {
|
||||
Future<ProfileDetailsModel> updateProfileDetails({
|
||||
required Map<String, dynamic> data,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(data);
|
||||
final _options = _setStreamType<ProfileDetailsModel>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _options = _setStreamType<ProfileDetailsModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/update',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late ProfileDetailsModel _value;
|
||||
try {
|
||||
@@ -137,10 +117,7 @@ class _SettingsService implements SettingsService {
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(
|
||||
String dioBaseUrl,
|
||||
String? baseUrl,
|
||||
) {
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ Future<void> main() async {
|
||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||
await di.init();
|
||||
runApp(MyApp());
|
||||
FlutterNativeSplash.remove();
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
||||
@@ -42,7 +42,7 @@ dependencies:
|
||||
syncfusion_flutter_gauges: ^28.1.38
|
||||
table_calendar: ^3.1.3
|
||||
flutter_keyboard_visibility: ^6.0.0
|
||||
share_plus: ^10.1.3
|
||||
share_plus: ^10.1.4
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
file_picker: ^8.1.7
|
||||
audioplayers: ^6.1.0
|
||||
|
||||
@@ -32,35 +32,20 @@ import 'package:mockito/mockito.dart' as _i1;
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeProfileModel_0 extends _i1.SmartFake implements _i2.ProfileModel {
|
||||
_FakeProfileModel_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
_FakeProfileModel_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeProfileDetailsModel_1 extends _i1.SmartFake
|
||||
implements _i2.ProfileDetailsModel {
|
||||
_FakeProfileDetailsModel_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
_FakeProfileDetailsModel_1(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSubPaginationModel_2 extends _i1.SmartFake
|
||||
implements _i3.SubPaginationModel {
|
||||
_FakeSubPaginationModel_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
_FakeSubPaginationModel_2(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [ProfileService].
|
||||
@@ -70,106 +55,78 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
@override
|
||||
_i5.Future<_i2.ProfileModel> getProfileBySlug({required String? slug}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getProfileBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.ProfileModel>.value(_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getProfileBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.ProfileModel>.value(_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getProfileBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i2.ProfileModel>);
|
||||
Invocation.method(#getProfileBySlug, [], {#slug: slug}),
|
||||
returnValue: _i5.Future<_i2.ProfileModel>.value(
|
||||
_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(#getProfileBySlug, [], {#slug: slug}),
|
||||
),
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<_i2.ProfileModel>.value(
|
||||
_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(#getProfileBySlug, [], {#slug: slug}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.ProfileModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.ProfileModel> getMyProfile() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getMyProfile,
|
||||
[],
|
||||
),
|
||||
returnValue: _i5.Future<_i2.ProfileModel>.value(_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getMyProfile,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.ProfileModel>.value(_FakeProfileModel_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getMyProfile,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i2.ProfileModel>);
|
||||
_i5.Future<_i2.ProfileModel> getMyProfile() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getMyProfile, []),
|
||||
returnValue: _i5.Future<_i2.ProfileModel>.value(
|
||||
_FakeProfileModel_0(this, Invocation.method(#getMyProfile, [])),
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<_i2.ProfileModel>.value(
|
||||
_FakeProfileModel_0(this, Invocation.method(#getMyProfile, [])),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.ProfileModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.ProfileDetailsModel> getMyProfileDetails() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getMyProfileDetails,
|
||||
[],
|
||||
),
|
||||
returnValue: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getMyProfileDetails,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getMyProfileDetails,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i2.ProfileDetailsModel>);
|
||||
Invocation.method(#getMyProfileDetails, []),
|
||||
returnValue: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(#getMyProfileDetails, []),
|
||||
),
|
||||
),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(#getMyProfileDetails, []),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.ProfileDetailsModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.ProfileDetailsModel> getProfileDetailsBySlug(
|
||||
{required String? slug}) =>
|
||||
_i5.Future<_i2.ProfileDetailsModel> getProfileDetailsBySlug({
|
||||
required String? slug,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getProfileDetailsBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getProfileDetailsBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getProfileDetailsBySlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i2.ProfileDetailsModel>);
|
||||
Invocation.method(#getProfileDetailsBySlug, [], {#slug: slug}),
|
||||
returnValue: _i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(#getProfileDetailsBySlug, [], {#slug: slug}),
|
||||
),
|
||||
),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.ProfileDetailsModel>.value(
|
||||
_FakeProfileDetailsModel_1(
|
||||
this,
|
||||
Invocation.method(#getProfileDetailsBySlug, [], {
|
||||
#slug: slug,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.ProfileDetailsModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addCircumference({
|
||||
@@ -178,59 +135,53 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
required int? hipCircumference,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addCircumference,
|
||||
[],
|
||||
{
|
||||
#chestCircumference: chestCircumference,
|
||||
#waistCircumference: waistCircumference,
|
||||
#hipCircumference: hipCircumference,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
Invocation.method(#addCircumference, [], {
|
||||
#chestCircumference: chestCircumference,
|
||||
#waistCircumference: waistCircumference,
|
||||
#hipCircumference: hipCircumference,
|
||||
}),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addWeight({required double? weight}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWeight,
|
||||
[],
|
||||
{#weight: weight},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i6.FeedBlogPostModel>> getBlogPostByAuthorSlug(
|
||||
{required String? slug}) =>
|
||||
_i5.Future<void> addWeight({required double? weight}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getBlogPostByAuthorSlug,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
returnValue: _i5.Future<List<_i6.FeedBlogPostModel>>.value(
|
||||
<_i6.FeedBlogPostModel>[]),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i6.FeedBlogPostModel>>.value(
|
||||
<_i6.FeedBlogPostModel>[]),
|
||||
) as _i5.Future<List<_i6.FeedBlogPostModel>>);
|
||||
Invocation.method(#addWeight, [], {#weight: weight}),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i6.FeedBlogPostModel>> getBlogPostByAuthorSlug({
|
||||
required String? slug,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBlogPostByAuthorSlug, [], {#slug: slug}),
|
||||
returnValue: _i5.Future<List<_i6.FeedBlogPostModel>>.value(
|
||||
<_i6.FeedBlogPostModel>[],
|
||||
),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i6.FeedBlogPostModel>>.value(
|
||||
<_i6.FeedBlogPostModel>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i6.FeedBlogPostModel>>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i7.WeightModel>> getWeight({required String? period}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWeight,
|
||||
[],
|
||||
{#period: period},
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<List<_i7.WeightModel>>.value(<_i7.WeightModel>[]),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i7.WeightModel>>.value(<_i7.WeightModel>[]),
|
||||
) as _i5.Future<List<_i7.WeightModel>>);
|
||||
Invocation.method(#getWeight, [], {#period: period}),
|
||||
returnValue: _i5.Future<List<_i7.WeightModel>>.value(
|
||||
<_i7.WeightModel>[],
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<List<_i7.WeightModel>>.value(
|
||||
<_i7.WeightModel>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i7.WeightModel>>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i7.WeightModel>> getWeightBySlug({
|
||||
@@ -238,35 +189,34 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
required String? slug,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWeightBySlug,
|
||||
[],
|
||||
{
|
||||
#period: period,
|
||||
#slug: slug,
|
||||
},
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<List<_i7.WeightModel>>.value(<_i7.WeightModel>[]),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i7.WeightModel>>.value(<_i7.WeightModel>[]),
|
||||
) as _i5.Future<List<_i7.WeightModel>>);
|
||||
Invocation.method(#getWeightBySlug, [], {
|
||||
#period: period,
|
||||
#slug: slug,
|
||||
}),
|
||||
returnValue: _i5.Future<List<_i7.WeightModel>>.value(
|
||||
<_i7.WeightModel>[],
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<List<_i7.WeightModel>>.value(
|
||||
<_i7.WeightModel>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i7.WeightModel>>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i8.CircumferenceModel>> getCircumferences(
|
||||
{required String? period}) =>
|
||||
_i5.Future<List<_i8.CircumferenceModel>> getCircumferences({
|
||||
required String? period,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getCircumferences,
|
||||
[],
|
||||
{#period: period},
|
||||
),
|
||||
returnValue: _i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[]),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[]),
|
||||
) as _i5.Future<List<_i8.CircumferenceModel>>);
|
||||
Invocation.method(#getCircumferences, [], {#period: period}),
|
||||
returnValue: _i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[],
|
||||
),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i8.CircumferenceModel>>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i8.CircumferenceModel>> getCircumferencesBySlug({
|
||||
@@ -274,20 +224,19 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
required String? slug,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getCircumferencesBySlug,
|
||||
[],
|
||||
{
|
||||
#period: period,
|
||||
#slug: slug,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[]),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[]),
|
||||
) as _i5.Future<List<_i8.CircumferenceModel>>);
|
||||
Invocation.method(#getCircumferencesBySlug, [], {
|
||||
#period: period,
|
||||
#slug: slug,
|
||||
}),
|
||||
returnValue: _i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[],
|
||||
),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<List<_i8.CircumferenceModel>>.value(
|
||||
<_i8.CircumferenceModel>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i8.CircumferenceModel>>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.SubPaginationModel> getSubscribers({
|
||||
@@ -295,39 +244,30 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
String? query,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getSubscribers,
|
||||
[],
|
||||
{
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getSubscribers,
|
||||
[],
|
||||
{
|
||||
Invocation.method(#getSubscribers, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getSubscribers,
|
||||
[],
|
||||
{
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i3.SubPaginationModel>);
|
||||
}),
|
||||
returnValue: _i5.Future<_i3.SubPaginationModel>.value(
|
||||
_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(#getSubscribers, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
}),
|
||||
),
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<_i3.SubPaginationModel>.value(
|
||||
_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(#getSubscribers, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i3.SubPaginationModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.SubPaginationModel> getSubscriptions({
|
||||
@@ -335,81 +275,64 @@ class MockProfileService extends _i1.Mock implements _i4.ProfileService {
|
||||
String? query,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getSubscriptions,
|
||||
[],
|
||||
{
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getSubscriptions,
|
||||
[],
|
||||
{
|
||||
Invocation.method(#getSubscriptions, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
)),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getSubscriptions,
|
||||
[],
|
||||
{
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i5.Future<_i3.SubPaginationModel>);
|
||||
}),
|
||||
returnValue: _i5.Future<_i3.SubPaginationModel>.value(
|
||||
_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(#getSubscriptions, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
}),
|
||||
),
|
||||
),
|
||||
returnValueForMissingStub: _i5.Future<_i3.SubPaginationModel>.value(
|
||||
_FakeSubPaginationModel_2(
|
||||
this,
|
||||
Invocation.method(#getSubscriptions, [], {
|
||||
#slug: slug,
|
||||
#query: query,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i3.SubPaginationModel>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> subscribe({required String? slug}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#subscribe,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
_i5.Future<void> subscribe({required String? slug}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#subscribe, [], {#slug: slug}),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> unsubscribe({required String? slug}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#unsubscribe,
|
||||
[],
|
||||
{#slug: slug},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
_i5.Future<void> unsubscribe({required String? slug}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#unsubscribe, [], {#slug: slug}),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> uploadPhoto({required _i9.File? photo}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#uploadPhoto,
|
||||
[],
|
||||
{#photo: photo},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
Invocation.method(#uploadPhoto, [], {#photo: photo}),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deletePhoto() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deletePhoto,
|
||||
[],
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
_i5.Future<void> deletePhoto() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deletePhoto, []),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user