Skip to content

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 components
  • get/get.dart - State management
  • get/get_core/src/get_main.dart - GetX core functionality
  • hvc_xr/shared/common.dart - Common utilities

Key Components

Controllers

  • realTimeController - Manages real-time communication and call state
  • digilensController - Handles DigiLens-specific features and voice commands

Properties

  • isMeCalling - Indicates if the current user initiated the call
  • nameToShow - 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 management
  • flutter/material.dart - UI components
  • hvc_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 realTimeController for call management
  • Integrates with digilensController for voice commands
  • Uses CallPage for call interface
  • Utilizes HlkUtils for layout helpers

Voice Command Support

  • "decline" - Reject incoming call
  • "accept" - Accept incoming call
  • "cancel" - Cancel outgoing call

Released under the MIT License.