Skip to content

Commit

Permalink
Merge branch 'fix-scrollSetVolume'
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 21, 2024
2 parents 59641f0 + 4dbcd2e commit 3701fde
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/plugin/pl_player/view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Expand Down Expand Up @@ -675,13 +676,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
_distance.value = dy;
} else {
// 右边区域 👈
final double level = (_.isFullScreen.value
? Get.size.height
: screenWidth * 9 / 16) *
3;
final double volume = _volumeValue.value - delta / level;
final double result = volume.clamp(0.0, 1.0);
setVolume(result);
EasyThrottle.throttle(
'setVolume', const Duration(milliseconds: 20), () {
final double level = (_.isFullScreen.value
? Get.size.height
: screenWidth * 9 / 16);
final double volume = _volumeValue.value -
double.parse(delta.toStringAsFixed(1)) / level;
final double result = volume.clamp(0.0, 1.0);
setVolume(result);
});
}
},
onVerticalDragEnd: (DragEndDetails details) {},
Expand Down

0 comments on commit 3701fde

Please sign in to comment.