fix: issue-1141

This commit is contained in:
misha
2026-11-18 14:38:15 +03:00
parent 87d383152d
commit b05d3b891b
14 changed files with 3983 additions and 2592 deletions

View File

@@ -30,6 +30,7 @@ import 'package:eatvio_app/features/chat/utils/chat_counterpart_utils.dart';
import 'package:eatvio_app/features/consultations/utils/consultation_progress_mapper.dart';
import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart';
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart';
import 'package:eatvio_app/features/video_calls/managers/video_call_manager.dart';
import 'package:eatvio_app/features/video_calls/presentation/pages/video_call_screen.dart';
@@ -72,6 +73,10 @@ class _ChatScreenState extends State<ChatScreen> {
String? get conversationUuid => _effectiveUuid ?? widget.uuid;
bool _canStartVideoCall(ChosenPlanModel? chosenPlan) {
return chosenPlan?.chosenPlanState.allowsVideoCall ?? false;
}
void _onHide() {
chatRoomCubit.cancelTimer();
}
@@ -205,6 +210,7 @@ class _ChatScreenState extends State<ChatScreen> {
chosenPlan != null &&
chosenPlan.chosenPlanState !=
ChosenPlanStateEnum.stateCanceledByTheInitiator;
final showVideoCallButton = _canStartVideoCall(chosenPlan);
return Scaffold(
resizeToAvoidBottomInset: true,
@@ -300,12 +306,14 @@ class _ChatScreenState extends State<ChatScreen> {
),
),
actions: [
Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
child: _ChatHeaderVideoCallButton(
onPressed: () => _openVideoCall(context, state, chatCounterpart),
if (showVideoCallButton)
Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
child: _ChatHeaderVideoCallButton(
onPressed: () =>
_openVideoCall(context, state, chatCounterpart),
),
),
),
],
),
body: SafeArea(
@@ -324,8 +332,7 @@ class _ChatScreenState extends State<ChatScreen> {
InfoByOrderScreen.path,
extra: {
'planId': chosenPlan?.id,
'customerSlug':
state.chatRoom.users.receiver.slug,
'customerSlug': state.chatRoom.users.receiver.slug,
},
);
return;
@@ -1018,7 +1025,8 @@ class _ChatScreenState extends State<ChatScreen> {
required bool? amIConsultant,
}) {
if (message.type == ChatMessageType.videoCallStarted &&
!isCurrentUserAuthor) {
!isCurrentUserAuthor &&
_canStartVideoCall(state.chatRoom.chosenPlan)) {
return VideoCallChatMessageWidget(
text: message.data.trim(),
sendTime: message.updatedAt,