Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

flutter allow user to select text

//Give your scaffold a key defined like so
GlobalKey<ScaffoldState> _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.'),
    ));
  }
 
PREVIOUS NEXT
Tagged: #flutter #user #select #text
ADD COMMENT
Topic
Name
3+4 =