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
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:fladder/screens/shared/default_titlebar.dart';
|
||||
import 'package:fladder/screens/shared/default_title_bar.dart';
|
||||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import 'package:fladder/screens/video_player/video_player.dart';
|
|||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:fladder/util/duration_extensions.dart';
|
||||
import 'package:fladder/util/list_padding.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:fladder/util/refresh_state.dart';
|
||||
|
||||
const videoPlayerHeroTag = "HeroPlayer";
|
||||
|
|
@ -178,16 +179,16 @@ class _CurrentlyPlayingBarState extends ConsumerState<FloatingPlayerBar> {
|
|||
: IconsaxBold.volume_high,
|
||||
),
|
||||
),
|
||||
Tooltip(
|
||||
message: "Stop playback",
|
||||
waitDuration: const Duration(milliseconds: 500),
|
||||
child: IconButton(
|
||||
onPressed: () async => stopPlayer(),
|
||||
icon: const Icon(IconsaxBold.stop),
|
||||
),
|
||||
),
|
||||
},
|
||||
].addInBetween(const SizedBox(width: 8)),
|
||||
Tooltip(
|
||||
message: context.localized.stop,
|
||||
waitDuration: const Duration(milliseconds: 500),
|
||||
child: IconButton(
|
||||
onPressed: () async => stopPlayer(),
|
||||
icon: const Icon(IconsaxBold.stop),
|
||||
),
|
||||
),
|
||||
].addInBetween(const SizedBox(width: 6)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -196,7 +197,7 @@ class _CurrentlyPlayingBarState extends ConsumerState<FloatingPlayerBar> {
|
|||
backgroundColor: Colors.black.withOpacity(0.25),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
value: progress.clamp(0, 1),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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