Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
feat: 添加视频缩放旋转
Browse files Browse the repository at this point in the history
  • Loading branch information
lucinhu committed Mar 24, 2023
1 parent 0163890 commit 0a3ff50
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
31 changes: 19 additions & 12 deletions lib/pages/bili_video/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ class BiliVideoPage extends StatefulWidget {

class _BiliVideoPageState extends State<BiliVideoPage> {
int currentTabIndex = 0;
late BiliVideoController biliVideoController;

@override
void initState() {
biliVideoController = Get.put(
BiliVideoController(
bvid: widget.bvid,
cid: widget.cid,
isBangumi: widget.isBangumi,
ssid: widget.ssid),
tag: widget.tag,
);
super.initState();
}

// 主视图
Widget _player(BiliVideoController controller) {
Expand Down Expand Up @@ -105,20 +119,13 @@ class _BiliVideoPageState extends State<BiliVideoPage> {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light),
child: GetBuilder(
init: BiliVideoController(
bvid: widget.bvid,
cid: widget.cid,
ssid: widget.ssid,
isBangumi: widget.isBangumi),
tag: widget.tag,
builder: (controller) => Scaffold(
body: Column(
child: Scaffold(
body: Column(
children: [
_player(controller),
Expanded(child: _buildView(context, controller)),
_player(biliVideoController),
Expanded(child: _buildView(context, biliVideoController)),
],
)),
),
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:bili_you/common/utils/fullscreen.dart';
import 'package:bili_you/common/widget/video_audio_player.dart';
import 'package:bili_you/pages/bili_video/widgets/bili_video_player/bili_danmaku.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';

class BiliVideoPlayer extends StatefulWidget {
const BiliVideoPlayer(this.controller,
Expand Down Expand Up @@ -124,15 +125,18 @@ class _BiliVideoPlayerState extends State<BiliVideoPlayer> {
ConnectionState.done) {
if (snapshot.data == true) {
return Stack(children: [
Center(
child: AspectRatio(
aspectRatio: widget
.controller
._videoAudioController!
.value
.aspectRatio,
child: VideoAudioPlayer(widget
.controller._videoAudioController!),
PhotoView.customChild(
enableRotation: true,
child: Center(
child: AspectRatio(
aspectRatio: widget
.controller
._videoAudioController!
.value
.aspectRatio,
child: VideoAudioPlayer(widget
.controller._videoAudioController!),
),
),
),
Center(
Expand Down

0 comments on commit 0a3ff50

Please sign in to comment.