Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Web Selectable Text not deselecting when clicking or selecting other widget

I have this problem only when using Flutter Web version. 2.8 and 2.10 , when I tried using Flutter 2.5.3 and other previous version the problem doesn't happen.

Example Widget inside Column:

SelectableText("'Lorem Ipsum is simply dummy '",)),
SizedBox(height: 20),
Divider(),
SelectableText("'Lorem Ipsum is simply dummy text '",)),

The output:

enter image description here

When I clicked the bottom selectable or other widget beside the selectable text it doesnt deselect the previously selected text, and also when I selected a new text on another selectable text the previous selection on the top is still highlighted which is not the behaviour I expected.

Is there some change on this widget on the newest version that I didn't notice? Thanks

like image 332
Jolzal Avatar asked Jan 31 '26 01:01

Jolzal


1 Answers

You can update your SDK version of Flutter to 3.3 and use SelectionArea class:

A widget that introduces an area for user selections with adaptive selection controls.

This widget creates a SelectableRegion with platform-adaptive selection controls.

as described on this Medium Article: What’s new in Flutter 3.3.

like image 177
Nhựt Tân Avatar answered Feb 01 '26 15:02

Nhựt Tân



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!