Appearance
Overview
- File:
lib/views/ringing_page.dart
The ringing_page.dart file implements the call ringing interface for the HVC XR application. This page provides the UI and functionality for handling incoming and outgoing calls, including accept/decline actions and voice command support.
Class Structure
dart
class RingingPage extends StatelessWidget {
static const String routeName = '/RingingPage';
final bool isMeCalling;
final String nameToShow;
RingingPage({Key? key, required this.isMeCalling, required this.nameToShow})
: super(key: key);
}Dependencies
flutter/material.dart- Flutter UI componentsget/get.dart- State managementget/get_core/src/get_main.dart- GetX core functionalityhvc_xr/shared/common.dart- Common utilities
Key Components
Controllers
realTimeController- Manages real-time communication and call statedigilensController- Handles DigiLens-specific features and voice commands
Properties
isMeCalling- Indicates if the current user initiated the callnameToShow- Name of the caller/callee to display
Core Functionality
Call Handling
dart
void handleDecline() async {
realTimeController.cancelRingingTimer();
await realTimeController.cancelCall();
await realTimeController.resetCalling();
Get.back();
}
void handleAccept() async {
realTimeController.cancelRingingTimer();
final callDetails = await realTimeController.acceptCall();
await realTimeController.resetCalling();
if (callDetails != null) {
// Navigate to call page
}
}
void handleCancel() async {
realTimeController.cancelRingingTimer();
await realTimeController.endCall();
await realTimeController.resetCalling();
Get.back();
}Voice Command Registration
dart
voiceCommandMap['decline'] = () => hvcDebounce(handleDecline, 'decline');
voiceCommandMap['accept'] = () => hvcDebounce(handleAccept, 'accept');
voiceCommandMap['cancel'] = () => hvcDebounce(handleCancel, 'cancel');UI Components
Main Layout
- SafeArea with black background
- Centered content with logo and name
- Call status display
- Action buttons based on call type
Dynamic Elements
- Caller/callee name display
- Call status text
- Accept/Decline buttons for incoming calls
- Cancel button for outgoing calls
State Management
- Uses GetX for reactive state management
- Manages call state through
realTimeController - Handles voice command state through
digilensController
Timer Management
dart
realTimeController.initRingingTimer(isMeCalling, nameToShow);Dependencies
get- State managementflutter/material.dart- UI componentshvc_xr/shared/common.dart- Common utilities
Styling
- Follow application theme
- Use consistent text styles
- Implement responsive layouts
- Handle different screen sizes
- Support dark mode
Integration Points
- Connects with
realTimeControllerfor call management - Integrates with
digilensControllerfor voice commands - Uses
CallPagefor call interface - Utilizes
HlkUtilsfor layout helpers
Voice Command Support
- "decline" - Reject incoming call
- "accept" - Accept incoming call
- "cancel" - Cancel outgoing call