Files
tatuchat/lib/widgets/layouts/call_overlay.dart
Welton Moura 0037b0b9cf
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Initial commit
2026-09-11 15:59:56 -03:00

71 lines
2.5 KiB
Dart

// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:tatchat/config/app_config.dart';
import 'package:tatchat/config/themes.dart';
import 'package:tatchat/pages/call/call_page.dart';
import 'package:tatchat/widgets/matrix.dart';
import 'package:material_ui/material_ui.dart';
class CallOverlay extends StatelessWidget {
final Widget child;
const CallOverlay({required this.child, super.key});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder(
valueListenable: Matrix.of(context).activeCallRoomId,
builder: (context, value, _) {
final roomId = value;
if (roomId == null) return child;
return ValueListenableBuilder(
valueListenable: Matrix.of(context).callPosition,
builder: (context, value, _) {
final callPosition = value;
final callFullScreen = callPosition == .fullScreen;
return Stack(
children: [
child,
AnimatedPositioned(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
top: callFullScreen
? 0
: callPosition == .top
? 86
: null,
left: callFullScreen ? 0 : null,
right: callFullScreen ? 0 : 8,
bottom: callFullScreen ? 0 : null,
height: callFullScreen ? null : 256,
width: callFullScreen ? null : 256,
child: Material(
elevation: callFullScreen ? 0 : 4,
clipBehavior: .hardEdge,
shape: callFullScreen
? null
: RoundedRectangleBorder(
side: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
),
child: Navigator(
onDidRemovePage: (_) {
Matrix.of(context).activeCallRoomId.value = null;
},
pages: [MaterialPage(child: CallPage(roomId: roomId))],
),
),
),
],
);
},
);
},
);
}
}