chore: Change native interface size and custom keyboard fixes

This commit is contained in:
PartyDonut 2025-10-18 14:21:32 +02:00
parent 01a98f974f
commit 9954ed7db5
7 changed files with 65 additions and 55 deletions

View file

@ -52,7 +52,7 @@ fun VideoPlayerScreen(
) { ) {
val leanBackEnabled = leanBackEnabled(LocalContext.current) val leanBackEnabled = leanBackEnabled(LocalContext.current)
ExoPlayer { player -> ExoPlayer { player ->
ScaledContent(if (leanBackEnabled) 0.7f else 1f) { ScaledContent(if (leanBackEnabled) 0.75f else 1f) {
CustomVideoControls(player) CustomVideoControls(player)
} }
} }

View file

@ -46,15 +46,6 @@ class _SearchBarState extends ConsumerState<SuggestionSearchBar> {
bool isEmpty = true; bool isEmpty = true;
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
@override
void initState() {
super.initState();
if (widget.autoFocus) {
focusNode.requestFocus();
}
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ref.listen(librarySearchProvider(widget.key!).select((value) => value.searchQuery), (previous, next) { ref.listen(librarySearchProvider(widget.key!).select((value) => value.searchQuery), (previous, next) {
@ -90,6 +81,7 @@ class _SearchBarState extends ConsumerState<SuggestionSearchBar> {
), ),
builder: (context, controller, focusNode) => OutlinedTextField( builder: (context, controller, focusNode) => OutlinedTextField(
focusNode: focusNode, focusNode: focusNode,
autoFocus: widget.autoFocus,
controller: controller, controller: controller,
onSubmitted: (value) { onSubmitted: (value) {
widget.onSubmited!(value); widget.onSubmited!(value);

View file

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/providers/arguments_provider.dart';
import 'package:fladder/providers/settings/client_settings_provider.dart'; import 'package:fladder/providers/settings/client_settings_provider.dart';
import 'package:fladder/providers/settings/home_settings_provider.dart'; import 'package:fladder/providers/settings/home_settings_provider.dart';
import 'package:fladder/screens/settings/settings_list_tile.dart'; import 'package:fladder/screens/settings/settings_list_tile.dart';
@ -81,7 +80,7 @@ List<Widget> buildClientSettingsAdvanced(BuildContext context, WidgetRef ref) {
), ),
), ),
), ),
if (ref.read(argumentsStateProvider).leanBackMode) if (AdaptiveLayout.inputDeviceOf(context) == InputDevice.dPad)
SettingsListTile( SettingsListTile(
label: Text(context.localized.clientSettingsUseSystemIMETitle), label: Text(context.localized.clientSettingsUseSystemIMETitle),
subLabel: Text(context.localized.clientSettingsUseSystemIMEDesc), subLabel: Text(context.localized.clientSettingsUseSystemIMEDesc),

View file

@ -65,7 +65,7 @@ class _DetailedBannerState extends ConsumerState<DetailedBanner> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Flexible( Expanded(
child: ExcludeFocus( child: ExcludeFocus(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16).copyWith(bottom: 4), padding: const EdgeInsets.symmetric(horizontal: 16).copyWith(bottom: 4),

View file

@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/providers/arguments_provider.dart';
import 'package:fladder/providers/settings/client_settings_provider.dart'; import 'package:fladder/providers/settings/client_settings_provider.dart';
import 'package:fladder/screens/shared/animated_fade_size.dart'; import 'package:fladder/screens/shared/animated_fade_size.dart';
import 'package:fladder/theme.dart'; import 'package:fladder/theme.dart';
@ -112,8 +111,8 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
final useCustomKeyboard = ref.watch(argumentsStateProvider.select((value) => value.leanBackMode)) && final useCustomKeyboard = AdaptiveLayout.inputDeviceOf(context) == InputDevice.dPad &&
ref.watch(clientSettingsProvider.select((value) => !value.useSystemIME)); ref.read(clientSettingsProvider.select((value) => !value.useSystemIME));
if (widget.autoFocus) { if (widget.autoFocus) {
if (useCustomKeyboard) { if (useCustomKeyboard) {
_wrapperFocus.requestFocus(); _wrapperFocus.requestFocus();
@ -127,7 +126,7 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isPasswordField = widget.keyboardType == TextInputType.visiblePassword; final isPasswordField = widget.keyboardType == TextInputType.visiblePassword;
final useCustomKeyboard = ref.watch(argumentsStateProvider.select((value) => value.leanBackMode)) && final useCustomKeyboard = AdaptiveLayout.inputDeviceOf(context) == InputDevice.dPad &&
ref.watch(clientSettingsProvider.select((value) => !value.useSystemIME)); ref.watch(clientSettingsProvider.select((value) => !value.useSystemIME));
final textField = TextField( final textField = TextField(

View file

@ -2,82 +2,102 @@ class KeyboardLayouts {
static const Map<String, Map<KeyboardLayer, List<List<String>>>> layouts = { static const Map<String, Map<KeyboardLayer, List<List<String>>>> layouts = {
'en': { 'en': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['A', 'B', 'C', 'D', 'E', 'F', 'G', ''], ['A', 'B', 'C', 'D', 'E', ''],
['H', 'I', 'J', 'K', 'L', 'M', 'N', '123'], ['F', 'G', 'H', 'I', 'J', '123'],
['O', 'P', 'Q', 'R', 'S', 'T', 'U'], ['K', 'L', 'M', 'N', 'O', 'P'],
['Q', 'R', 'S', 'T', 'U'],
['V', 'W', 'X', 'Y', 'Z'], ['V', 'W', 'X', 'Y', 'Z'],
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '&', '#', '(', ')', ''], ['1', '2', '3', '&', '#', ''],
['4', '5', '6', '@', '!', '?', ':', 'ABC'], ['4', '5', '6', '(', ')', 'ABC'],
['7', '8', '9', '.', '-', '_', '"', ':'], ['7', '8', '9', '@', '!', '?'],
['0', '/', '\$', '%', '+', '[', ']'], ['0', '/', '\$', '%', '+', '[', ']'],
['.', '-', '_', '"', ':']
], ],
}, },
'es': { 'es': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['A', 'B', 'C', 'D', 'E', 'F', 'G', ''], ['A', 'B', 'C', 'D', 'E', ''],
['H', 'I', 'J', 'K', 'L', 'M', 'N', '123'], ['F', 'G', 'H', 'I', 'J', '123'],
['O', 'P', 'Q', 'R', 'S', 'T', 'U'], ['K', 'L', 'M', 'N', 'O', 'P'],
['Q', 'R', 'S', 'T', 'U'],
['V', 'W', 'X', 'Y', 'Z', 'Ñ'], ['V', 'W', 'X', 'Y', 'Z', 'Ñ'],
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '&', '#', '(', ')', ''], ['1', '2', '3', '&', '#', ''],
['4', '5', '6', '@', '!', '?', ';', 'ABC'], ['4', '5', '6', '(', ')', 'ABC'],
['7', '8', '9', '.', '-', '_', '"'], ['7', '8', '9', '@', '!', '?'],
['0', '/', '\$', '%', '+', '[', ']'], ['0', '/', '\$', '%', '+', '[', ']'],
['.', '-', '_', '"', ':']
], ],
}, },
'de': { 'de': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['A', 'B', 'C', 'D', 'E', 'F', 'G', ''], ['A', 'B', 'C', 'D', 'E', ''],
['H', 'I', 'J', 'K', 'L', 'M', 'N', '123'], ['F', 'G', 'H', 'I', 'J', '123'],
['O', 'P', 'Q', 'R', 'S', 'T', 'U'], ['K', 'L', 'M', 'N', 'O', 'P'],
['V', 'W', 'X', 'Y', 'Z', 'Ä', 'Ö', 'Ü'], ['Q', 'R', 'S', 'T', 'U'],
['V', 'W', 'X', 'Y', 'Z'],
['Ä', 'Ö', 'Ü', 'ß']
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '&', '#', '(', ')', ''], ['1', '2', '3', '&', '#', ''],
['4', '5', '6', '@', '!', '?', ';', 'ABC'], ['4', '5', '6', '(', ')', 'ABC'],
['7', '8', '9', '.', '-', '_', '"'], ['7', '8', '9', '@', '!', '?'],
['0', '/', '\$', '%', '+', '[', ']'], ['0', '/', '\$', '%', '+', '[', ']'],
['.', '-', '_', '"', ':']
], ],
}, },
'fr': { 'fr': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['A', 'B', 'C', 'D', 'E', 'F', 'G', ''], ['A', 'B', 'C', 'D', 'E', ''],
['H', 'I', 'J', 'K', 'L', 'M', 'N', '123'], ['F', 'G', 'H', 'I', 'J', '123'],
['O', 'P', 'Q', 'R', 'S', 'T', 'U'], ['K', 'L', 'M', 'N', 'O', 'P'],
['V', 'W', 'X', 'Y', 'Z', 'É', 'È', 'À'], ['Q', 'R', 'S', 'T', 'U'],
['V', 'W', 'X', 'Y', 'Z'],
['É', 'È', 'À', 'Ç'],
['Â', 'Ê', 'Î', 'Ô', 'Û'],
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '&', '#', '(', ')', ''], ['1', '2', '3', '&', '#', ''],
['4', '5', '6', '@', '!', '?', ';', 'ABC'], ['4', '5', '6', '(', ')', 'ABC'],
['7', '8', '9', '.', '-', '_', '"'], ['7', '8', '9', '@', '!', '?'],
['0', '/', '\$', '%', '+', '[', ']'], ['0', '/', '\$', '%', '+', '[', ']'],
['.', '-', '_', '"', ':']
], ],
}, },
'ja': { 'ja': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['', '', '', '', '', '', '', ''], ['', '', '', '', '', ''],
['', '', '', '', '', '', '', '123'], ['', '', '', '', '', '123'],
['', '', '', '', '', '', ''], ['', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''], ['', '', '', '', ''],
['', '', '', '', ''],
['', '', '', '', ''],
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ''], ['1', '2', '3', '4', '5', ''],
['!', '@', '#', '\$', '%', '^', '&', '*', '(', ')', 'ABC'], ['6', '7', '8', '9', '0', 'ABC'],
['!', '@', '#', '\$', '%'],
['^', '&', '*', '(', ')'],
['-', '_', '¥', '.', ',']
], ],
}, },
'zh': { 'zh': {
KeyboardLayer.alpha: [ KeyboardLayer.alpha: [
['', '', '', '', '饿', '', '', ''], ['', '', '', '', '饿', ''],
['', '', '', '', '', '', '', '123'], ['', '', '', '', '', '123'],
['', '', '', '', '', '', ''], ['', '', '', '', '', ''],
['', '', '', '', ''],
['', '西', '', '', '', ''], ['', '西', '', '', '', ''],
], ],
KeyboardLayer.numericExtra: [ KeyboardLayer.numericExtra: [
['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ''], ['1', '2', '3', '4', '5', ''],
['!', '@', '#', '\$', '%', '^', '&', '*', '(', ')', 'ABC'], ['6', '7', '8', '9', '0', 'ABC'],
['!', '@', '#', '\$', '%'],
['^', '&', '*', '(', ')'],
['-', '_', '¥', '·', '']
], ],
}, },
}; };

View file

@ -12,7 +12,7 @@ import 'package:fladder/widgets/keyboard/alpha_numeric_keyboard.dart';
ValueNotifier<bool> isKeyboardOpen = ValueNotifier<bool>(false); ValueNotifier<bool> isKeyboardOpen = ValueNotifier<bool>(false);
double keyboardWidthFactor = 0.2; double keyboardWidthFactor = 0.25;
class CustomKeyboardWrapper extends StatelessWidget { class CustomKeyboardWrapper extends StatelessWidget {
final Widget child; final Widget child;