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

@ -46,15 +46,6 @@ class _SearchBarState extends ConsumerState<SuggestionSearchBar> {
bool isEmpty = true;
final FocusNode focusNode = FocusNode();
@override
void initState() {
super.initState();
if (widget.autoFocus) {
focusNode.requestFocus();
}
super.initState();
}
@override
Widget build(BuildContext context) {
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(
focusNode: focusNode,
autoFocus: widget.autoFocus,
controller: controller,
onSubmitted: (value) {
widget.onSubmited!(value);

View file

@ -2,7 +2,6 @@ import 'package:flutter/material.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/home_settings_provider.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(
label: Text(context.localized.clientSettingsUseSystemIMETitle),
subLabel: Text(context.localized.clientSettingsUseSystemIMEDesc),

View file

@ -65,7 +65,7 @@ class _DetailedBannerState extends ConsumerState<DetailedBanner> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
Expanded(
child: ExcludeFocus(
child: Padding(
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:fladder/providers/arguments_provider.dart';
import 'package:fladder/providers/settings/client_settings_provider.dart';
import 'package:fladder/screens/shared/animated_fade_size.dart';
import 'package:fladder/theme.dart';
@ -112,8 +111,8 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
final useCustomKeyboard = ref.watch(argumentsStateProvider.select((value) => value.leanBackMode)) &&
ref.watch(clientSettingsProvider.select((value) => !value.useSystemIME));
final useCustomKeyboard = AdaptiveLayout.inputDeviceOf(context) == InputDevice.dPad &&
ref.read(clientSettingsProvider.select((value) => !value.useSystemIME));
if (widget.autoFocus) {
if (useCustomKeyboard) {
_wrapperFocus.requestFocus();
@ -127,7 +126,7 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
@override
Widget build(BuildContext context) {
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));
final textField = TextField(

View file

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