show static method
Implementation
static void show(
BuildContext context,
VideoEditorController controller,
int targetIndex,
) {
if (controller.clips.length < 2) {
EditorFeedback.showMessage(
context,
'Add a second clip to use transitions',
);
return;
}
// The first clip has nothing before it: edit the cut into the second.
final index = targetIndex < 1 ? 1 : targetIndex;
EditorSheetScaffold.show<void>(
context,
(sheetContext) => StatefulBuilder(
builder: (sheetContext, setState) {
final current = controller.clips[index].transitionIn;
return EditorSheetScaffold(
title: 'Transition',
trailing: TextButton(
onPressed: () {
controller.setTransitionForAll(current);
Navigator.of(sheetContext).pop();
EditorFeedback.showMessage(
context,
'${current.label} used between all clips',
);
},
child: const Text('Apply to all'),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Animation into clip ${index + 1}. The preview updates in a moment.',
style: VideoEditorTextStyles.caption,
),
const SizedBox(height: VideoEditorSpacing.sm),
Wrap(
spacing: VideoEditorSpacing.sm,
runSpacing: VideoEditorSpacing.sm,
children: [
for (final transition in ClipTransition.values)
ChoiceChip(
avatar: Icon(
icon(transition),
size: 18,
color: transition == current
? VideoEditorColors.playerInk
: VideoEditorColors.textPrimary,
),
label: Text(transition.label),
selected: transition == current,
showCheckmark: false,
onSelected: (_) {
controller.setClipTransition(index, transition);
setState(() {});
},
),
],
),
const SizedBox(height: VideoEditorSpacing.md),
OutlinedButton.icon(
onPressed: () {
controller.setTransitionMix(vibeMix);
Navigator.of(sheetContext).pop();
EditorFeedback.showMessage(
context,
'A different transition on every cut. The preview updates in a moment.',
);
},
icon: const Icon(
Icons.auto_awesome,
color: VideoEditorColors.ai,
),
label: const Text('Mix: a different one on every cut'),
),
],
),
),
);
},
),
);
}