0

I'm encountering an issue with SelectionArea on flutter/dart. I'm building a website for my professional activity and everything works fine except this. I have a Text widget that I wraped into a SelectionArea widget. It works on Chrome (when simulating from VS code and on my PC browser when the website is online), it works on virtual device and on my physical mobile (S8 when on usb with vs code), meaning in those cases I can select a part of the text and copy it without any trouble. When it doesn't work is when I open the online website on my phone's browser (chrome on my S8) : I can select part of the text but I can't copy it, meaning I'm not given the option to do it (there is not even the magnifying glass thing when selecting the text).

I can provide some code if needed, but I think it's all here. You can also check prof.ziak.free.fr for the website, and click on 'contact', you'll see the text that is selectable and what it does (not). Any idea on what's going on ? In the same subject, how can I simulate the website on mobile (virtual or on usb) through chrome via vs code ? Currently when I run it, it's just as a mobile app, not as web app. Thanks !

Crapul
  • 15
  • 3

1 Answers1

0

I have checked your website on mobile and yes the issue you mentioned is there. I want to ask what Flutter version are you using.

I am currently using the Flutter SDK version from the master channel of the Git repository, specifically version 3.9.0-17.0.pre.21 and I can copy text wrapped in SelectionArea on mobile view, here's the code sample :

import 'package:flutter/material.dart';

void main() {
  runApp(const MySelectableText());
}

class MySelectableText extends StatelessWidget {
  const MySelectableText({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: SelectionArea(child: Text("Hello world")),
        ),
      ),
    );
  }
}

Output :

image preview

I have noticed you only have the contact's section text as selectable and not the other sections, I don't know if that's done on purpose, if not you can just wrap your Scaffold with a SelectionArea widget and all text should be selectable without having to wrap each text widget. Otherwise, I would say check your Flutter version and upgrade to the latest version. Tell me if that solves it.

sahar
  • 3
  • 2
  • Hey, thanks for taking time to check and reply ! My flutter version is 3.7.9 (upgraded it a few days ago), and when I run flutter upgrade, it says it's the latest one : C:\Users\benja>flutter upgrade Flutter is already up to date on channel stable Flutter 3.7.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision 62bd79521d (4 days ago) • 2023-03-30 10:59:36 -0700 Engine • revision ec975089ac Tools • Dart 2.19.6 • DevTools 2.20.1 I tried to re-build the web version and re-send it, but the issue is still here. – Crapul Apr 03 '23 at 13:24
  • And yes it's on purpose, it's just for people to copy and paste my mail adress. About my second question : being on vs code, how can I see my web app through the browser of the virtual mobile device ? – Crapul Apr 03 '23 at 13:29