Skip to content

Commit

Permalink
Created a better video player
Browse files Browse the repository at this point in the history
  • Loading branch information
xxparthparekhxx committed Jan 28, 2024
1 parent 087c98d commit 7d8e001
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 88 deletions.
Binary file modified app-release.apk
Binary file not shown.
162 changes: 74 additions & 88 deletions lib/pages/player/widgets/video/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,97 +27,83 @@ class _VideoPlayerPageState extends State<VideoPlayerPage> {
player.addListener(() {
if (mounted) setState(() {});
});
return Column(
children: [
SizedBox(
height: 250,
width: MediaQuery.of(context).size.width,
child: Stack(
clipBehavior: Clip.none,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
return OverflowBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height - 200,
width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.center,
clipBehavior: Clip.none,
children: [
AspectRatio(
aspectRatio: player.value.aspectRatio,
child: Container(
decoration: const BoxDecoration(color: Colors.black),
child: AspectRatio(
aspectRatio: p.player.value.aspectRatio,
child: VideoPlayer(p.player)),
child: VideoPlayer(p.player),
)),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () {
widget.setMiniPlayer(true);
},
icon:
const Icon(Icons.keyboard_arrow_down_sharp)),
IconButton(
onPressed: () {},
icon: const Icon(Icons.more_vert)),
],
)
],
),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
constraints: const BoxConstraints(minWidth: 200),
onPressed: () {
if (p.playerState == PlayerStates.paused) {
p.resumePlaying();
} else {
p.pausePlaying();
}
},
icon: Icon(
p.playerState == PlayerStates.paused
? Icons.play_arrow
: Icons.pause,
size: 50.0)),
],
),
),
],
),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () {
widget.setMiniPlayer(true);
},
icon: const Icon(Icons.keyboard_arrow_down_sharp)),
IconButton(
onPressed: () {},
icon: const Icon(Icons.more_vert)),
],
)
],
),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () => p.skipToPrevious(),
icon: const Icon(
Icons.chevron_left_rounded,
size: 50,
)),
IconButton(
constraints: const BoxConstraints(minWidth: 200),
onPressed: () {
if (p.playerState == PlayerStates.paused) {
p.resumePlaying();
} else {
p.pausePlaying();
}
},
icon: Icon(
p.playerState == PlayerStates.paused
? Icons.play_arrow
: Icons.pause,
size: 50.0)),
IconButton(
onPressed: () => p.skipToNext(),
icon: const Icon(
Icons.chevron_right_rounded,
size: 50,
))
],
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Slider(
min: 0.0,
max: player.value.duration.inSeconds.toDouble(),
value: player.value.position.inSeconds.toDouble(),
onChanged: (value) {
player.seekTo(Duration(seconds: value.toInt()));
},
)
],
)
],
))
],
],
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Slider(
min: 0.0,
max: player.value.duration.inSeconds.toDouble(),
value: player.value.position.inSeconds.toDouble(),
onChanged: (value) {
player.seekTo(Duration(seconds: value.toInt()));
},
)
],
)
],
))
],
),
);
}
}

0 comments on commit 7d8e001

Please sign in to comment.