wrap textfield in selection area to make typing work on Safari and Firefox (#1251)

pull/1544/head
ggurdin 11 months ago committed by GitHub
parent bf9e0aeba2
commit 3e017d733f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -472,74 +472,76 @@ class InputBar extends StatelessWidget {
// show suggestions after 50ms idle time (default is 300) // show suggestions after 50ms idle time (default is 300)
// #Pangea // #Pangea
// builder: (context, controller, focusNode) => TextField( // builder: (context, controller, focusNode) => TextField(
builder: (context, _, focusNode) => TextField( builder: (context, _, focusNode) => SelectionArea(
enableSuggestions: false, child: TextField(
readOnly: enableSuggestions: false,
controller != null && controller!.choreographer.isRunningIT, readOnly:
autocorrect: false, controller != null && controller!.choreographer.isRunningIT,
// Pangea# autocorrect: false,
controller: controller,
focusNode: focusNode,
contextMenuBuilder: (c, e) => markdownContextBuilder(
c,
e,
// #Pangea
// controller,
_,
// Pangea# // Pangea#
), controller: controller,
contentInsertionConfiguration: ContentInsertionConfiguration( focusNode: focusNode,
onContentInserted: (KeyboardInsertedContent content) { contextMenuBuilder: (c, e) => markdownContextBuilder(
final data = content.data; c,
if (data == null) return; e,
// #Pangea
// controller,
_,
// Pangea#
),
contentInsertionConfiguration: ContentInsertionConfiguration(
onContentInserted: (KeyboardInsertedContent content) {
final data = content.data;
if (data == null) return;
final file = MatrixFile( final file = MatrixFile(
mimeType: content.mimeType, mimeType: content.mimeType,
bytes: data, bytes: data,
name: content.uri.split('/').last, name: content.uri.split('/').last,
); );
room.sendFileEvent( room.sendFileEvent(
file, file,
shrinkImageMaxDimension: 1600, shrinkImageMaxDimension: 1600,
);
},
),
minLines: minLines,
maxLines: maxLines,
keyboardType: keyboardType!,
textInputAction: textInputAction,
autofocus: autofocus!,
inputFormatters: [
//#Pangea
//LengthLimitingTextInputFormatter((maxPDUSize / 3).floor()),
//setting max character count to 1000
//after max, nothing else can be typed
LengthLimitingTextInputFormatter(1000),
//Pangea#
],
onSubmitted: (text) {
// fix for library for now
// it sets the types for the callback incorrectly
onSubmitted!(text);
},
// #Pangea
style: controller?.exceededMaxLength ?? false
? const TextStyle(color: Colors.red)
: null,
onTap: () {
controller?.onInputTap(
context,
fNode: focusNode,
); );
}, },
// Pangea#
decoration: decoration!,
onChanged: (text) {
// fix for the library for now
// it sets the types for the callback incorrectly
onChanged!(text);
},
textCapitalization: TextCapitalization.sentences,
), ),
minLines: minLines,
maxLines: maxLines,
keyboardType: keyboardType!,
textInputAction: textInputAction,
autofocus: autofocus!,
inputFormatters: [
//#Pangea
//LengthLimitingTextInputFormatter((maxPDUSize / 3).floor()),
//setting max character count to 1000
//after max, nothing else can be typed
LengthLimitingTextInputFormatter(1000),
//Pangea#
],
onSubmitted: (text) {
// fix for library for now
// it sets the types for the callback incorrectly
onSubmitted!(text);
},
// #Pangea
style: controller?.exceededMaxLength ?? false
? const TextStyle(color: Colors.red)
: null,
onTap: () {
controller?.onInputTap(
context,
fNode: focusNode,
);
},
// Pangea#
decoration: decoration!,
onChanged: (text) {
// fix for the library for now
// it sets the types for the callback incorrectly
onChanged!(text);
},
textCapitalization: TextCapitalization.sentences,
), ),
suggestionsCallback: getSuggestions, suggestionsCallback: getSuggestions,
itemBuilder: (c, s) => itemBuilder: (c, s) =>

Loading…
Cancel
Save