fix: Disable shortcuts for android and iOS

This commit is contained in:
Christian Pauly 2021-05-31 10:59:52 +02:00
parent b0bcdfcb51
commit 11df0076cb

View File

@ -265,14 +265,19 @@ class InputBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final useShortCuts = (PlatformInfos.isWeb || PlatformInfos.isDesktop);
return Shortcuts( return Shortcuts(
shortcuts: { shortcuts: !useShortCuts
? {}
: {
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.enter): LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.enter):
NewLineIntent(), NewLineIntent(),
LogicalKeySet(LogicalKeyboardKey.enter): SubmitLineIntent(), LogicalKeySet(LogicalKeyboardKey.enter): SubmitLineIntent(),
}, },
child: Actions( child: Actions(
actions: { actions: !useShortCuts
? {}
: {
NewLineIntent: CallbackAction(onInvoke: (i) { NewLineIntent: CallbackAction(onInvoke: (i) {
final val = controller.value; final val = controller.value;
final selection = val.selection.start; final selection = val.selection.start;
@ -289,9 +294,7 @@ class InputBar extends StatelessWidget {
return null; return null;
}), }),
SubmitLineIntent: CallbackAction(onInvoke: (i) { SubmitLineIntent: CallbackAction(onInvoke: (i) {
if (PlatformInfos.isWeb || PlatformInfos.isDesktop) {
onSubmitted(controller.text); onSubmitted(controller.text);
}
return null; return null;
}), }),
}, },