mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-22 21:42:35 +01:00
fix: Disable shortcuts for android and iOS
This commit is contained in:
parent
b0bcdfcb51
commit
11df0076cb
@ -265,36 +265,39 @@ 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):
|
? {}
|
||||||
NewLineIntent(),
|
: {
|
||||||
LogicalKeySet(LogicalKeyboardKey.enter): SubmitLineIntent(),
|
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.enter):
|
||||||
},
|
NewLineIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.enter): SubmitLineIntent(),
|
||||||
|
},
|
||||||
child: Actions(
|
child: Actions(
|
||||||
actions: {
|
actions: !useShortCuts
|
||||||
NewLineIntent: CallbackAction(onInvoke: (i) {
|
? {}
|
||||||
final val = controller.value;
|
: {
|
||||||
final selection = val.selection.start;
|
NewLineIntent: CallbackAction(onInvoke: (i) {
|
||||||
final messageWithoutNewLine =
|
final val = controller.value;
|
||||||
controller.text.substring(0, val.selection.start) +
|
final selection = val.selection.start;
|
||||||
'\n' +
|
final messageWithoutNewLine =
|
||||||
controller.text.substring(val.selection.start);
|
controller.text.substring(0, val.selection.start) +
|
||||||
controller.value = TextEditingValue(
|
'\n' +
|
||||||
text: messageWithoutNewLine,
|
controller.text.substring(val.selection.start);
|
||||||
selection: TextSelection.fromPosition(
|
controller.value = TextEditingValue(
|
||||||
TextPosition(offset: selection + 1),
|
text: messageWithoutNewLine,
|
||||||
),
|
selection: TextSelection.fromPosition(
|
||||||
);
|
TextPosition(offset: selection + 1),
|
||||||
return null;
|
),
|
||||||
}),
|
);
|
||||||
SubmitLineIntent: CallbackAction(onInvoke: (i) {
|
return null;
|
||||||
if (PlatformInfos.isWeb || PlatformInfos.isDesktop) {
|
}),
|
||||||
onSubmitted(controller.text);
|
SubmitLineIntent: CallbackAction(onInvoke: (i) {
|
||||||
}
|
onSubmitted(controller.text);
|
||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
child: TypeAheadField<Map<String, String>>(
|
child: TypeAheadField<Map<String, String>>(
|
||||||
direction: AxisDirection.up,
|
direction: AxisDirection.up,
|
||||||
hideOnEmpty: true,
|
hideOnEmpty: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user