feat(video_calls): fixed recinnecting logic, added consultant bage

This commit is contained in:
misha
2026-06-26 08:56:57 +03:00
parent 59f42c9b1e
commit bde4eea7d1
22 changed files with 272 additions and 57 deletions

View File

@@ -2,40 +2,74 @@ import 'dart:ui';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
class VideoCallParticipantNameLabel extends StatelessWidget {
const VideoCallParticipantNameLabel({super.key, required this.name});
const VideoCallParticipantNameLabel({
super.key,
required this.name,
this.isConsultant = false,
});
final String name;
final bool isConsultant;
@override
Widget build(BuildContext context) {
final roleLabel = isConsultant ? S.of(context).video_call_role_consultant : null;
return Positioned(
left: 12,
bottom: 12,
right: 12,
child: Align(
alignment: Alignment.bottomLeft,
child: ClipRRect(
borderRadius: BorderRadius.circular(60),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.5, sigmaY: 5.5),
child: Container(
constraints: const BoxConstraints(maxWidth: 240),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: appTheme.transparentBlack,
borderRadius: BorderRadius.circular(60),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (roleLabel != null) ...[
Container(
constraints: const BoxConstraints(maxWidth: 240),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: appTheme.whiteA700,
borderRadius: BorderRadius.circular(60),
),
child: Text(
roleLabel,
style: TextStyles.textXSSemibold.copyWith(
color: appTheme.blueA400,
height: 14 / 12,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
child: Text(
name,
style: TextStyles.textMMedium.copyWith(color: appTheme.whiteA700),
maxLines: 1,
overflow: TextOverflow.ellipsis,
const SizedBox(height: 16),
],
ClipRRect(
borderRadius: BorderRadius.circular(60),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.5, sigmaY: 5.5),
child: Container(
constraints: const BoxConstraints(maxWidth: 240),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: appTheme.transparentBlack,
borderRadius: BorderRadius.circular(60),
),
child: Text(
name,
style: TextStyles.textMMedium.copyWith(color: appTheme.whiteA700),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
),
),
],
),
),
);

View File

@@ -25,6 +25,7 @@ class VideoCallStageLayout extends StatefulWidget {
required this.connectError,
required this.localDisplayName,
required this.remoteDisplayName,
this.remoteIsConsultant = false,
required this.micEnabled,
required this.videoEnabled,
required this.splitParticipantView,
@@ -49,6 +50,7 @@ class VideoCallStageLayout extends StatefulWidget {
final String? connectError;
final String localDisplayName;
final String remoteDisplayName;
final bool remoteIsConsultant;
final bool micEnabled;
final bool videoEnabled;
final bool splitParticipantView;
@@ -149,6 +151,7 @@ class _VideoCallStageLayoutState extends State<VideoCallStageLayout> {
child: _SplitParticipantPane(
room: widget.room,
displayName: widget.remoteDisplayName,
isConsultant: widget.remoteIsConsultant,
isLocal: false,
connectError: widget.connectError,
videoEnabled: widget.videoEnabled,
@@ -236,6 +239,7 @@ class _VideoCallStageLayoutState extends State<VideoCallStageLayout> {
name: mainShowsLocal
? widget.localDisplayName
: widget.remoteDisplayName,
isConsultant: !mainShowsLocal && widget.remoteIsConsultant,
),
],
),
@@ -368,6 +372,7 @@ class _SplitParticipantPane extends StatelessWidget {
const _SplitParticipantPane({
required this.room,
required this.displayName,
this.isConsultant = false,
required this.isLocal,
required this.connectError,
required this.videoEnabled,
@@ -379,6 +384,7 @@ class _SplitParticipantPane extends StatelessWidget {
final lk.Room room;
final String displayName;
final bool isConsultant;
final bool isLocal;
final String? connectError;
final bool videoEnabled;
@@ -421,7 +427,10 @@ class _SplitParticipantPane extends StatelessWidget {
},
),
),
VideoCallParticipantNameLabel(name: displayName),
VideoCallParticipantNameLabel(
name: displayName,
isConsultant: !isLocal && isConsultant,
),
Positioned(
left: 0,
top: _VideoCallStageLayoutState._splitExpandButtonTop,

View File

@@ -22,11 +22,11 @@ class VideoCallSystemPipContent extends StatelessWidget {
a.videoEnabled != b.videoEnabled,
builder: (context, state) {
if (state.connectPhase != VideoCallConnectPhase.connected ||
state.linkIssue == VideoCallLinkIssue.lost ||
state.linkIssue.needsManualReconnect ||
!state.callStageEntered) {
if (state.conversationUuid.isNotEmpty &&
state.connectPhase != VideoCallConnectPhase.idle &&
state.linkIssue != VideoCallLinkIssue.lost) {
!state.linkIssue.needsManualReconnect) {
return ColoredBox(
color: appTheme.gray100,
child: Center(