skip to Main Content
 SnackBar snackBar = SnackBar(
          showCloseIcon: true,
          duration: 100,
          content: Text('Hello World'),
        );

Text in SnackBar: not selectable for copy/paste by mouse or tap. Is there a way to enable text selection?

2

Answers


  1. Try using SelectableText:

    SnackBar snackBar = SnackBar(
      duration: Duration(seconds: 100),
      content: SelectableText('Hello World'),
    );
    
    Login or Signup to reply.
  2. Text is not selectable by default.

    If you want to make your Text selectable, you need to use SelectableText for that.

     SnackBar snackBar = SnackBar(
              showCloseIcon: true,
              duration: 100,
              content: SelectableText('Hello World'),
            );
    

    If you want to make an area selectable you can wrap your Widget with SelectionArea.

     SnackBar snackBar = SnackBar(
              showCloseIcon: true,
              duration: 100,
              content: SelectionArea (
                  child: Text('Hello World'),
            );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search