mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
feature: Improved video player stop controls (#146)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
9f141a826b
commit
f20aab2118
10 changed files with 89 additions and 46 deletions
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue