feature: Improved video player stop controls (#146)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-11-16 12:55:12 +01:00 committed by GitHub
parent 9f141a826b
commit f20aab2118
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 89 additions and 46 deletions

View file

@ -6,6 +6,13 @@ import 'package:window_manager/window_manager.dart';
import 'package:fladder/providers/video_player_provider.dart';
Future<void> closeFullScreen() async {
final isFullScreen = await windowManager.isFullScreen();
if (isFullScreen) {
await windowManager.setFullScreen(false);
}
}
Future<void> toggleFullScreen(WidgetRef ref) async {
final isFullScreen = await windowManager.isFullScreen();
await windowManager.setFullScreen(!isFullScreen);
@ -21,7 +28,7 @@ class FullScreenButton extends ConsumerWidget {
return IconButton(
onPressed: () => toggleFullScreen(ref),
icon: Icon(
fullScreen ? IconsaxOutline.close_square : IconsaxOutline.maximize_4,
fullScreen ? IconsaxOutline.screenmirroring : IconsaxOutline.maximize_4,
),
);
}

View file

@ -6,6 +6,13 @@ import 'package:universal_html/html.dart' as html;
import 'package:fladder/providers/video_player_provider.dart';
Future<void> closeFullScreen() async {
if (html.document.fullscreenElement != null) {
html.document.exitFullscreen();
await Future.delayed(const Duration(milliseconds: 500));
}
}
Future<void> toggleFullScreen(WidgetRef ref) async {
final isFullScreen = html.document.fullscreenElement != null;
@ -30,7 +37,7 @@ class FullScreenButton extends ConsumerWidget {
return IconButton(
onPressed: () => toggleFullScreen(ref),
icon: Icon(
fullScreen ? IconsaxOutline.close_square : IconsaxOutline.maximize_4,
fullScreen ? IconsaxOutline.screenmirroring : IconsaxOutline.maximize_4,
),
);
}