addImageSticker method
Adds an image sticker (PNG/WebP with transparency works best) at the playhead. The file is copied into the app's documents so drafts keep working after the picker's cache is cleared.
Implementation
Future<void> addImageSticker(File image) async {
final dir = Directory(
'${(await getApplicationDocumentsDirectory()).path}/video_editor_stickers',
);
await dir.create(recursive: true);
final name = fileBaseName(image.path);
final dot = name.lastIndexOf('.');
final ext = dot == -1 ? '.png' : name.substring(dot);
final copy = await image.copy(
'${dir.path}/sticker_${DateTime.now().microsecondsSinceEpoch}$ext',
);
addTextOverlay(
text: 'Sticker',
fontSize: 64,
style: TextOverlayStyle.plain,
stickerPath: copy.path,
idPrefix: 'sticker',
);
}