使用EditableText颤振 [英] Flutter using EditableText

查看:142
本文介绍了使用EditableText颤振的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何在Flutter中使用TextEditor.

I'm trying to figure out how to use the TextEditor in Flutter.

我有卡片编辑器"(基本上我希望能够处理一段文本)

I have "Card Editor" (basically I want to be able to work on the equivalent of a paragraph of text)

new EditableText(
                    autofocus: true,
                    maxLines: null,
                    backgroundCursorColor: Colors.amber,
                    cursorColor: Colors.green,
                    style: TextStyle(),
                    focusNode:  FocusNode(),
                    controller: controller,
                    onSubmitted: (val) {
                      _addCard(val);
                      Navigator.pop(context);
                    },
                  )

我是从TextField的示例中改编而成的.

I adapted this from an example of a TextField.

但是我有几个问题.

首先,当我键入内容时,它似乎什么也没显示.光标移动,但是看不到任何文本.没有显式样式时,这是默认值吗?

Firstly, it doesn't seem to show anything when I type. The cursor moves, but no text is visible. Is that the default when there's no explicit style?

第二,如何触发提交?使用TextField,CR/Enter按钮可以执行此操作.显然,我明白了为什么您不一定要使用EditableText,但是我应该怎么做呢?

Secondly, how do I trigger the submit? With a TextField, the CR / Enter button does this. Obviously I see why you don't necessarily want that with EditableText But what should I do instead?

第三,我需要能够将默认文本放入此小部件.我尝试向EditableText添加值"属性,但这似乎不正确.这是怎么做的?

Third, I need to be able to put default text into this widget. I tried adding a "value" attribute to the EditableText, but that doesn't seem to be right. What's the way to do this?

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆