Link dialogue TextInputType.multiline

pull/602/head
X Code 3 years ago
parent e1edc8dfe3
commit 77609b4a9e
  1. 4
      lib/src/widgets/toolbar/image_video_utils.dart
  2. 8
      lib/src/widgets/toolbar/link_style_button.dart

@ -37,6 +37,8 @@ class LinkDialogState extends State<LinkDialog> {
return AlertDialog( return AlertDialog(
backgroundColor: widget.dialogTheme?.dialogBackgroundColor, backgroundColor: widget.dialogTheme?.dialogBackgroundColor,
content: TextField( content: TextField(
keyboardType: TextInputType.multiline,
maxLines: null,
style: widget.dialogTheme?.inputTextStyle, style: widget.dialogTheme?.inputTextStyle,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Paste a link'.i18n, labelText: 'Paste a link'.i18n,
@ -65,7 +67,7 @@ class LinkDialogState extends State<LinkDialog> {
} }
void _applyLink() { void _applyLink() {
Navigator.pop(context, _link); Navigator.pop(context, _link.trim());
} }
} }

@ -133,7 +133,7 @@ class _LinkStyleButtonState extends State<LinkStyleButton> {
void _linkSubmitted(dynamic value) { void _linkSubmitted(dynamic value) {
// text.isNotEmpty && link.isNotEmpty // text.isNotEmpty && link.isNotEmpty
final String text = (value as Tuple2).item1; final String text = (value as Tuple2).item1;
final String link = value.item2; final String link = value.item2.trim();
var index = widget.controller.selection.baseOffset; var index = widget.controller.selection.baseOffset;
var length = widget.controller.selection.extentOffset - index; var length = widget.controller.selection.extentOffset - index;
@ -185,6 +185,8 @@ class _LinkDialogState extends State<_LinkDialog> {
content: Column( content: Column(
children: [ children: [
TextField( TextField(
keyboardType: TextInputType.multiline,
maxLines: null,
style: widget.dialogTheme?.inputTextStyle, style: widget.dialogTheme?.inputTextStyle,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Text'.i18n, labelText: 'Text'.i18n,
@ -195,6 +197,8 @@ class _LinkDialogState extends State<_LinkDialog> {
controller: _textController, controller: _textController,
), ),
TextField( TextField(
keyboardType: TextInputType.multiline,
maxLines: null,
style: widget.dialogTheme?.inputTextStyle, style: widget.dialogTheme?.inputTextStyle,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Link'.i18n, labelText: 'Link'.i18n,
@ -243,6 +247,6 @@ class _LinkDialogState extends State<_LinkDialog> {
} }
void _applyLink() { void _applyLink() {
Navigator.pop(context, Tuple2(_text, _link)); Navigator.pop(context, Tuple2(_text.trim(), _link.trim()));
} }
} }

Loading…
Cancel
Save