Skip to content

Commit

Permalink
chore: button to rotate screen while in video fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed May 9, 2024
1 parent 6c041c0 commit f77ec3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/controller/navigator_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class NamidaNavigator {
);
}

Future<void> _setOrientations(bool lanscape) async {
Future<void> setDeviceOrientations(bool lanscape) async {
isInLanscape = lanscape;
final orientations = lanscape ? [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight] : kDefaultOrientations;
await SystemChrome.setPreferredOrientations(orientations);
Expand Down Expand Up @@ -189,7 +189,7 @@ class NamidaNavigator {

setDefaultSystemUIOverlayStyle(semiTransparent: true);
await Future.wait([
if (setOrientations) _setOrientations(true),
if (setOrientations) setDeviceOrientations(true),
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),
]);
}
Expand All @@ -200,7 +200,7 @@ class NamidaNavigator {

setDefaultSystemUIOverlayStyle();
await Future.wait([
if (isInLanscape) _setOrientations(false),
if (isInLanscape) setDeviceOrientations(false),
setDefaultSystemUI(),
]);

Expand Down
14 changes: 14 additions & 0 deletions lib/ui/widgets/video_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,20 @@ class NamidaVideoControlsState extends State<NamidaVideoControls> with TickerPro
child: Row(
children: [
const SizedBox(width: 2.0),
if (widget.isFullScreen)
// -- rotate screen button
NamidaIconButton(
horizontalPadding: 0.0,
padding: EdgeInsets.zero,
iconSize: 20.0,
icon: Broken.rotate_left_1,
iconColor: itemsColor,
onPressed: () {
_startTimer();
NamidaNavigator.inst.setDeviceOrientations(!NamidaNavigator.inst.isInLanscape);
},
),
if (widget.isFullScreen) SizedBox(width: widget.isFullScreen ? 12.0 : 10.0),
RepeatModeIconButton(
compact: true,
color: itemsColor,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: namida
description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter
publish_to: "none"
version: 2.1.5-beta+240509177
version: 2.1.6-beta+240509199

environment:
sdk: ">=3.1.4 <4.0.0"
Expand Down

0 comments on commit f77ec3f

Please sign in to comment.