Protocol 10 presence gate, drop/paste anywhere, quick UI fixes
Ready gate: whoever is in the server while it is not playing counts (joining while playing does not pause anyone); a swap counts everyone present and keeps ready flags; the quorum rule is gone. Optional 'Unready when the video changes'. No 'Skip 1:30' guess when the media has chapters. Drag & drop and Ctrl+V anywhere (fox_utils): files, folders and links get a small card asking how to open them. Files series start collapsed. UI: Tab never moves focus and Space is always ready outside text fields; chat focuses its field; unread badge on uosc and a chip in fullscreen; people-only chat with an Activity toggle; skip pills show 5 s then with the controls; volume up to 150%; own avatar same size as the party. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f22be6c20
commit
8effa573a0
38 files changed
+1529
-303
No files matched your search
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../state/session_state.dart';
|
||||
import 'text_focus.dart';
|
||||
|
||||
/// Tab and Shift+Tab never move focus (the app's [Shortcuts] override):
|
||||
/// a button that got focus that way would be pressed by Space, the ready
|
||||
/// key.
|
||||
Map<ShortcutActivator, Intent> get appShortcuts => {
|
||||
...WidgetsApp.defaultShortcuts,
|
||||
const SingleActivator(LogicalKeyboardKey.tab): const DoNothingIntent(),
|
||||
const SingleActivator(LogicalKeyboardKey.tab, shift: true): const DoNothingIntent(),
|
||||
};
|
||||
|
||||
/// The window's two app-wide keys, ahead of whatever has focus: while in a
|
||||
/// server, Space is ready / not ready and Tab opens or closes the chat,
|
||||
/// on every tab and in every player mode. Not while a text field has
|
||||
/// focus (the chat field handles Tab and Esc itself) nor while a dialog or
|
||||
/// menu is in front of [child].
|
||||
class AppKeys extends StatefulWidget {
|
||||
/// Who toggles the chat, latest first: the strip while it is shown, the
|
||||
/// full player in fullscreen (both hold the shell's toggle).
|
||||
static final _chatToggles = <VoidCallback>[];
|
||||
|
||||
static void addChatToggle(VoidCallback f) => _chatToggles.add(f);
|
||||
static void removeChatToggle(VoidCallback f) => _chatToggles.remove(f);
|
||||
|
||||
/// Space; tests count presses instead of sending them.
|
||||
final VoidCallback? onToggleReady;
|
||||
final Widget child;
|
||||
const AppKeys({super.key, this.onToggleReady, required this.child});
|
||||
|
||||
@override
|
||||
State<AppKeys> createState() => _AppKeysState();
|
||||
}
|
||||
|
||||
class _AppKeysState extends State<AppKeys> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
HardwareKeyboard.instance.addHandler(_key);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
HardwareKeyboard.instance.removeHandler(_key);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool _key(KeyEvent event) {
|
||||
if (event is! KeyDownEvent || !mounted) return false;
|
||||
final key = event.logicalKey;
|
||||
if (key != LogicalKeyboardKey.space && key != LogicalKeyboardKey.tab) return false;
|
||||
if (SessionState.instance.route.peek() != AppRoute.session) return false;
|
||||
if (ModalRoute.of(context)?.isCurrent == false) return false;
|
||||
if (textInputFocused()) return false;
|
||||
final keys = HardwareKeyboard.instance;
|
||||
if (keys.isControlPressed || keys.isAltPressed || keys.isMetaPressed) return false;
|
||||
if (key == LogicalKeyboardKey.space) {
|
||||
(widget.onToggleReady ?? SessionState.instance.coordinator.toggleReady)();
|
||||
return true;
|
||||
}
|
||||
final toggles = AppKeys._chatToggles;
|
||||
if (toggles.isEmpty) return false;
|
||||
toggles.last();
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => widget.child;
|
||||
}
|
||||
|
||||
/// Registers [onToggle] with [AppKeys] while mounted.
|
||||
class ChatKey extends StatefulWidget {
|
||||
final VoidCallback onToggle;
|
||||
final Widget child;
|
||||
const ChatKey({super.key, required this.onToggle, required this.child});
|
||||
|
||||
@override
|
||||
State<ChatKey> createState() => _ChatKeyState();
|
||||
}
|
||||
|
||||
class _ChatKeyState extends State<ChatKey> {
|
||||
void _toggle() => widget.onToggle();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
AppKeys.addChatToggle(_toggle);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
AppKeys.removeChatToggle(_toggle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => widget.child;
|
||||
}
|
||||
Reference in new issue
Block a user