Show the Introduction Screen
The SDK displays the introduction screen during the very first app launch, considering this the trigger. This feature enables you to add extra triggers and also allows you to disable the default app launch trigger.
For instance, you may choose to present the introduction screen at the end of your onboarding screens or provide an option to show it again from a help menu.
Select a Trigger and Show the Introduction Screen
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(), ); } }
Update the widget to add a reference to Flight Recorder:
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(), ); } }
Call
showIntroductionScreen
at the moment you want to capture the video inside the trigger.flightRecorderPlugin.showIntroductionScreen()
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.showIntroductionScreen(); }, child: const Icon(Icons.upload_file), ) ], ), body: PlaceHolder(), ); } }
Last updated