📜  颤振允许用户选择文本 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:21.360000             🧑  作者: Mango

代码示例1
//Give your scaffold a key defined like so
GlobalKey _scaffoldKey = GlobalKey();

/// Pastes given String to the clipboard and shows Popup-Snackbar
  void copyToClipboard(String toClipboard) {
    ClipboardData data = new ClipboardData(text: toClipboard);
    Clipboard.setData(data);
    _scaffoldKey.currentState.showSnackBar(new SnackBar(
      content: new Text(toClipboard + ' copied to clipboard.'),
    ));
  }