Repository navigation
feat: Better Players #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nnra6864
wants to merge
12
commits into
commetchat:main
Choose a base branch
from
nnra6864:better-players
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+377
−34
Open
feat: Better Players #1053
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
22e63ff
feat: Implemented persistent volume control for the audio player
nnra6864 fdb05a2
feat: Switched from SharedPreferences package to commet/lib/config/pr…
nnra6864 963aa95
add hover menu
Airyzz 3f995f1
Update audio_player.dart
Airyzz 97ec4a9
Update hover_menu.dart
Airyzz d85cc00
feat: Implemented a very rough version of the video player volume con…
nnra6864 7f11900
fix volume hover menu disabling video player ui
Airyzz 07ac9a2
few small fixes
Airyzz 75564b4
apply volume when video starts
Airyzz f35eb2c
fix handling of mute status
Airyzz 079698e
dart format
Airyzz 2b3780f
feat: Replaced preMuteVolume with appliedVolume in the AudioPlayer
nnra6864 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import 'package:commet/utils/debounce.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class HoverMenu extends StatefulWidget { | ||
| const HoverMenu( | ||
| {super.key, | ||
| this.menuAlignment = Alignment.topLeft, | ||
| this.parentAlignment = Alignment.topLeft, | ||
| this.onHoverStateChanged, | ||
| required this.builder, | ||
| required this.child}); | ||
| final Widget child; | ||
| final Widget Function(BuildContext context) builder; | ||
| final Function(bool hovered)? onHoverStateChanged; | ||
| final Alignment menuAlignment; | ||
| final Alignment parentAlignment; | ||
|
|
||
| @override | ||
| State<HoverMenu> createState() => HoverMenuState(); | ||
| } | ||
|
|
||
| class HoverMenuState extends State<HoverMenu> { | ||
| OverlayEntry? entry; | ||
| LayerLink link = LayerLink(); | ||
|
|
||
| bool overlayHovered = false; | ||
|
|
||
| Debouncer overlayRemoveDebounder = | ||
| Debouncer(delay: Duration(milliseconds: 20)); | ||
|
|
||
| void addOverlay() { | ||
| widget.onHoverStateChanged?.call(true); | ||
|
|
||
| if (entry != null) { | ||
| entry?.remove(); | ||
| entry = null; | ||
| } | ||
|
|
||
| entry = OverlayEntry( | ||
| canSizeOverlay: true, | ||
| builder: (context) { | ||
| return Row( | ||
| children: [ | ||
| CompositedTransformFollower( | ||
| link: link, | ||
| followerAnchor: widget.menuAlignment, | ||
| targetAnchor: widget.parentAlignment, | ||
| child: MouseRegion( | ||
| onEnter: (event) { | ||
| overlayRemoveDebounder.cancel(); | ||
| }, | ||
| onExit: (event) { | ||
| overlayRemoveDebounder.run(removeOverlay); | ||
| }, | ||
| child: widget.builder(context))), | ||
| ], | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| Overlay.of( | ||
| context, | ||
| ).insert(entry!); | ||
| } | ||
|
|
||
| void removeOverlay() { | ||
| widget.onHoverStateChanged?.call(false); | ||
|
|
||
| if (entry != null) { | ||
| entry?.remove(); | ||
| entry = null; | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return CompositedTransformTarget( | ||
| link: link, | ||
| child: MouseRegion( | ||
| onEnter: (event) { | ||
| overlayRemoveDebounder.cancel(); | ||
| if (entry == null) { | ||
| addOverlay(); | ||
| } | ||
| }, | ||
| onExit: (event) { | ||
| if (!overlayHovered) { | ||
| overlayRemoveDebounder.run(removeOverlay); | ||
| } | ||
| }, | ||
| child: widget.child), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.