Pulse FlightRecorder Docs
  • SDK Documentation
    • Pulse Labs FlightRecorder Documentation
      • iOS
        • Overview
        • Install the SDK
        • Get your API Key
        • SDK Configuration
          • Swift + SwiftUI
          • Swift + UIKit with Scenes
          • Swift + UIKit without Scenes
          • Objective-C with Scenes
          • Objective-C without Scenes
        • Create Custom Triggers
          • Capture Recording
          • Show the Introduction Screen
        • Update the SDK
        • Troubleshooting
      • Android
        • Overview
        • Install the SDK
        • Get your API Key
        • SDK Configuration
          • Kotlin
          • Java
        • Create Custom Triggers
          • Capture Recording
          • Show the Introduction Screen
        • Update the SDK
        • Troubleshooting
      • ReactNative
        • Install SDK for ReactNative iOS
        • Install SDK for ReactNative Android
        • Update the SDK
      • Flutter
        • Overview
        • Install the SDK
        • Get your API Key
        • SDK Configuration
        • Create Custom Triggers
          • Capture Recording
          • Show the Introduction Screen
      • In-app Surveys
        • Create Survey
        • Edit Survey
        • Launch Survey
        • Pause Survey
        • Survey Responses
        • Survey Styling
    • ⬅️FlightRecorder Home
Powered by GitBook
On this page
  1. SDK Documentation
  2. Pulse Labs FlightRecorder Documentation
  3. Flutter
  4. Create Custom Triggers

Capture Recording

The SDK captures a recording when your user shakes the device or takes a screenshot - actions considered as triggers. You can extend this capability by incorporating your own additional triggers.

For instance, you might want to capture a recording when your user presses a button in your app or completes a specific sequence.

However you capture the recording, the SDK user interface will always appear to let your users review the footage, edit and submit.

Select a Trigger and Capture Recording

  1. Decide from what event you want to capture the video, for example a button press. We will call this the trigger. This very simple example shows a possible trigger - when a floating action button is pressed

    class HomeScreen extends StatelessWidget {
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          floatingActionButton: Row(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              FloatingActionButton(
                heroTag: const Key('1'),
                onPressed: () {
                  
                },
                child: const Icon(Icons.upload_file),
              )
            ],
          ),
          body: PlaceHolder(),
        );
      }
    }
  2. Update the widget to add a reference to Flight Recorder:

    Kotlin
    class HomeScreen extends StatelessWidget {
      final FlightRecorder flightRecorderPlugin;
      const HomeScreen({super.key, required this.flightRecorderPlugin});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          floatingActionButton: Row(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              FloatingActionButton(
                heroTag: const Key('1'),
                onPressed: () {
                  
                },
                child: const Icon(Icons.upload_file),
              )
            ],
          ),
          body: PlaceHolder(),
        );
      }
    }

  3. Call triggerCaptureRecording at the moment you want to capture the video inside the trigger.

    flightRecorderPlugin.triggerCaptureRecording()

    In our example, we call the method from the FloatingActionButton onPressed function:

    class HomeScreen extends StatelessWidget {
      final FlightRecorder flightRecorderPlugin;
      const HomeScreen({super.key, required this.flightRecorderPlugin});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          floatingActionButton: Row(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              FloatingActionButton(
                heroTag: const Key('1'),
                onPressed: () {
                  flightRecorderPlugin.triggerCaptureRecording();
                },
                child: const Icon(Icons.upload_file),
              )
            ],
          ),
          body: PlaceHolder(),
        );
      }
    }
PreviousCreate Custom TriggersNextShow the Introduction Screen

Last updated 1 year ago