feat(consultant): add chat getting room by user slug, fix stepper animation delay in registration

This commit is contained in:
mso7nueh
2024-10-07 14:05:12 +03:00
parent f125e0dbed
commit fcb08e5d4d
4 changed files with 40 additions and 2 deletions

View File

@@ -37,4 +37,9 @@ abstract class ChatService {
@GET('/api/profile/ws/params')
Future<WebsocketInfoModel> getWebsocket();
@GET('/api/chat/get_by_user/{user}')
Future<ChatRoomModel> getChatRoomIdByUserSlug({
@Path() required String user,
});
}

View File

@@ -198,6 +198,39 @@ class _ChatService implements ChatService {
return _value;
}
@override
Future<ChatRoomModel> getChatRoomIdByUserSlug({required String user}) async {
final _extra = <String, dynamic>{};
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 _result = await _dio.fetch<Map<String, dynamic>>(_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<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

View File

@@ -108,7 +108,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
tween: Tween<double>(
begin: 0,
begin: 1 / 6,
end: progressValue,
),
builder: (context, value, _) => LinearProgressIndicator(

View File

@@ -131,7 +131,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
tween: Tween<double>(
begin: 0,
begin: 1 / 15,
end: progressValue,
),
builder: (context, value, _) => LinearProgressIndicator(