showSpeedPanel static method

Future<void> showSpeedPanel({
  1. required BuildContext context,
  2. required AliPlayerWidgetController controller,
})

显示倍速面板(横屏底部按钮触发)

使用右侧滑入面板展示倍速选项

Implementation

static Future<void> showSpeedPanel({
  required BuildContext context,
  required AliPlayerWidgetController controller,
}) {
  final items = SettingConstants.speedOptions;
  final currentSpeed = controller.speedNotifier.value;
  final initialIndex = items.indexOf(currentSpeed).clamp(0, items.length - 1);

  return showRightSettingPanel<double>(
    context: context,
    panel: RightWheelSettingPanel(
      items,
      initialIndex: initialIndex,
      onSelected: (value) {
        Navigator.of(context).pop(value);
      },
    ),
  ).then((value) {
    if (value != null) {
      controller.setSpeed(speed: value);
    }
  });
}