我想在手势检测器中实现文本溢出换行



我正在制作条形码扫描仪应用程序,为此,扫描后我希望我的文本出现在子项中:手势检测器中的文本。
有时我的文本可能会更长,所以我希望它被包裹在子文本中:像TextOverflow.ellipsis这样的文本。以下是代码。

          new Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    new GestureDetector(
                      child: new Flexible(
                        child: new Container(
                        child: new Text(
                          result,
                          overflow: TextOverflow.ellipsis,
                          style: new TextStyle(
                            fontSize: 13.0,
                            fontFamily: 'Roboto',
                            color: new Color(0xFF212121),
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                      ),
                      ),
                      onLongPress: () {
                        Clipboard.setData(new ClipboardData(text: result));
                        key.currentState.showSnackBar(new SnackBar(
                          content: new Text("Copied to Clipboard"),
                        ));
                        Scaffold.of(context).showSnackBar(new SnackBar(
                          content: new Text("Sending Message"),
                        ));
                      },
                    ),
                  ],
                ),
<br>
Here i had used GestureDetector because i want to copy the text of child:Text on long press.

我们必须将 GestureDetector 放入 容器子项 在 Flexible

           new Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    new Flexible(
                      child: new Container(
                        child: GestureDetector(
                          child: new Text(
                            result,
                            overflow: TextOverflow.ellipsis,
                            style: new TextStyle(
                              fontSize: 13.0,
                              fontFamily: 'Roboto',
                              color: new Color(0xFF212121),
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          onLongPress: () {
                            Clipboard.setData(new ClipboardData(text: result));
                            key.currentState.showSnackBar(new SnackBar(
                              content: new Text("Copied to Clipboard"),
                            ));
                            Scaffold.of(context).showSnackBar(new SnackBar(
                              content: new Text("Sending Message"),
                            ));
                          },
                        ),
                      ),
                    ),
                  ],
                ),