Side-app use: copy/open links and titles everywhere, version on the Settings tab, known links preview instantly, Ctrl+V adds to Up next
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9572e8457d
commit
1ec4fc8b13
22 files changed
+1190
-236
No files matched your search
@@ -1,9 +1,24 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// True while keyboard focus sits in a text field. The focused node's
|
||||
/// context belongs to the `Focus` that `EditableText` builds, so look for
|
||||
/// an `EditableText` above it (walking FocusNode parents never meets one).
|
||||
/// True while keyboard focus sits in a text field, or anywhere under a
|
||||
/// [KeyboardClaim]. The focused node's context belongs to the `Focus` that
|
||||
/// `EditableText` builds, so look for an `EditableText` above it (walking
|
||||
/// FocusNode parents never meets one).
|
||||
bool textInputFocused([FocusNode? node]) {
|
||||
final n = node ?? FocusManager.instance.primaryFocus;
|
||||
return n?.context?.findAncestorWidgetOfExactType<EditableText>() != null;
|
||||
final c = (node ?? FocusManager.instance.primaryFocus)?.context;
|
||||
if (c == null) return false;
|
||||
return c.findAncestorWidgetOfExactType<EditableText>() != null ||
|
||||
c.findAncestorWidgetOfExactType<KeyboardClaim>() != null;
|
||||
}
|
||||
|
||||
/// Keyboard focus under it counts as typing ([textInputFocused]): a panel
|
||||
/// with keys of its own (the Up next popover's Ctrl+V) keeps the app's
|
||||
/// global keys (Space, Tab, the player's) off while it has focus, as a
|
||||
/// text field does.
|
||||
class KeyboardClaim extends StatelessWidget {
|
||||
final Widget child;
|
||||
const KeyboardClaim({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => child;
|
||||
}
|
||||
Reference in new issue
Block a user