Baseflow / screenrecorder

Flutter package which can be used to record flutter widgets
https://pub.dev/packages/screen_recorder
MIT License
64 stars 29 forks source link
flutter flutter-widgets gifs hacktoberfest screen-capture screen-recorder screenrecorder

pub.dev Sponsoring likes popularity pub points


šŸš§ This is highly experimental! šŸš§

šŸš§ API is subject to change! šŸš§

This is a package to create recordings of Flutter widgets. The recordings can be exported as GIFs.

This is pure Flutter/Dart implementation without any dependencies on native or platform code. Thus it runs on all supported platforms.

Please note, that the encoding of the GIF takes a lot of time. On web it is basically useless because it takes so much time.

šŸš€ Getting Started

Setup

First, you will need to add screen_recorder to your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  screen_recorder: x.y.z # use the latest version found on pub.dev

Then, run flutter packages get in your terminal.

Example

Wrap your widget which should be recorded in a ScreenRecorder:

ScreenRecorder(
  height: 200,
  width: 200,
  background: Colors.white,
  controller: ScreenRecorderController(
    pixelRatio: 0.5,
    skipFramesBetweenCaptures: 2,
  ),
  child: // child which should be recorded
);

Then use ScreenRecorderController.start() to start recording and ScreenRecorderController.stop() to stop the recording. final gif = await ScreenRecorderController.export() gives you the result which can be written to disk.

A complete example can be found here.

āš ļø Known issues and limitations

Convert gif to video

In order to convert the gif to a video, you can try one of the following libraries. Please note, that compatibility was not tested.

Library Stats
ffmpeg_kit_flutter likes popularity pub points
flutter_video_compress likes popularity pub pointsĀ 
video_editor likes popularity pub points
video_trimmer likes popularity pub points
video_compress likes popularity pub points

šŸ“£ About the author

GitHub followers Twitter Follow

Contributors