From fcb08e5d4d899807e58846299aa6b3244761bfcb Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 7 Oct 2024 14:05:12 +0300 Subject: [PATCH] feat(consultant): add chat getting room by user slug, fix stepper animation delay in registration --- lib/features/chat/services/chat_service.dart | 5 +++ .../chat/services/chat_service.g.dart | 33 +++++++++++++++++++ .../stepper_become_consultant_screen.dart | 2 +- .../pages/registration_screen.dart | 2 +- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index 3bbb74ff..f572b117 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -37,4 +37,9 @@ abstract class ChatService { @GET('/api/profile/ws/params') Future getWebsocket(); + + @GET('/api/chat/get_by_user/{user}') + Future getChatRoomIdByUserSlug({ + @Path() required String user, + }); } diff --git a/lib/features/chat/services/chat_service.g.dart b/lib/features/chat/services/chat_service.g.dart index 4e84a7b3..77366053 100644 --- a/lib/features/chat/services/chat_service.g.dart +++ b/lib/features/chat/services/chat_service.g.dart @@ -198,6 +198,39 @@ class _ChatService implements ChatService { return _value; } + @override + Future getChatRoomIdByUserSlug({required String user}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType(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>(_options); + late ChatRoomModel _value; + try { + _value = ChatRoomModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + return _value; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart index c4c65e84..401de41d 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart @@ -108,7 +108,7 @@ class _StepperBecomeConsultantScreenState extends State( - begin: 0, + begin: 1 / 6, end: progressValue, ), builder: (context, value, _) => LinearProgressIndicator( diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 7694582c..b47212ba 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -131,7 +131,7 @@ class _RegistrationScreenState extends State { duration: const Duration(milliseconds: 350), curve: Curves.easeInOut, tween: Tween( - begin: 0, + begin: 1 / 15, end: progressValue, ), builder: (context, value, _) => LinearProgressIndicator(