:drunk: Add call overlay
This commit is contained in:
@ -160,7 +160,12 @@ class AppScaffold extends StatelessWidget {
|
||||
? content
|
||||
: AppBackground(isRoot: true, child: content),
|
||||
),
|
||||
const _GlobalCallOverlay(),
|
||||
Positioned(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
child: const _GlobalCallOverlay(),
|
||||
),
|
||||
],
|
||||
),
|
||||
appBar: appBar,
|
||||
@ -211,13 +216,8 @@ class _GlobalCallOverlay extends HookConsumerWidget {
|
||||
final modalRoute = ModalRoute.of(context);
|
||||
final isOnCallScreen = modalRoute?.settings.name?.contains('call') ?? false;
|
||||
// You may want to store roomId in callState for more robust navigation
|
||||
final roomId =
|
||||
(modalRoute?.settings.arguments is Map &&
|
||||
(modalRoute!.settings.arguments as Map).containsKey('roomId'))
|
||||
? (modalRoute.settings.arguments as Map)['roomId'] as String
|
||||
: null;
|
||||
if (callState.isConnected && !isOnCallScreen && roomId != null) {
|
||||
return CallOverlayBar(roomId: roomId);
|
||||
if (callState.isConnected && !isOnCallScreen) {
|
||||
return CallOverlayBar();
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ import 'package:island/route.gr.dart';
|
||||
|
||||
/// A floating bar that appears when user is in a call but not on the call screen.
|
||||
class CallOverlayBar extends HookConsumerWidget {
|
||||
final String roomId;
|
||||
const CallOverlayBar({super.key, required this.roomId});
|
||||
const CallOverlayBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final callState = ref.watch(callNotifierProvider);
|
||||
final callNotifier = ref.read(callNotifierProvider.notifier);
|
||||
// Only show if connected and not on the call screen
|
||||
if (!callState.isConnected) return const SizedBox.shrink();
|
||||
|
||||
@ -21,7 +21,8 @@ class CallOverlayBar extends HookConsumerWidget {
|
||||
bottom: 32,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
context.router.push(CallRoute(roomId: roomId));
|
||||
if (callNotifier.roomId == null) return;
|
||||
context.router.push(CallRoute(roomId: callNotifier.roomId!));
|
||||
},
|
||||
child: Material(
|
||||
elevation: 8,
|
||||
@ -38,11 +39,19 @@ class CallOverlayBar extends HookConsumerWidget {
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
'In call',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 18),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.white,
|
||||
size: 18,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user