Closed
Description
Initial Information
Suppose I have a full-height container with only SelectableText
widget inside which will fill the height of container. Inside the widget is a long text (for example 6 paragraphs of Lorem Ipsum) so naturally the widget will be scrollable and some text will be obscured.
Sample code:
class Sample extends StatefulWidget {
Sample ({Key key}) : super(key: key);
@override
_Sample State createState() => _Sample State();
}
class _Sample State extends State<Sample> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
child: SelectableText(
...long text here...
),
),
),
);
}
}
Steps to Reproduce
CASE 1
- After page finishes building, select a word at the beginning of the text by long pressing it.
- Cancel selection by tapping anywhere on the text.
- Scroll down until the previously selected word gets obscured (In this case, to max scroll offset).
- Select a word by again long pressing it.
CASE 2
- After page finishes building, scroll down to max scroll offset.
- Select a word by long pressing it.
- Cancel selection by tapping anywhere on the text.
- Scroll up until previously selected word is obscured (In this case, to min scroll offset).
- Select a word by again long pressing it.
Expected results:
The word is highlighted.
Actual results:
CASE 1 and CASE 2
The word is highlighted, but;
Widget gets jumpy and scrolls in the direction of where the initially selected word is located on screen.
Additional Info
Issue only happens when I select a word by long-pressing it. This doesn't happen if I double tap on it.
Issue also happens on SelectableText.rich
widget.
Logs
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, 2.5.0, on Microsoft Windows [Version 10.0.18363.1256], locale en-ID)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.60.2)
[√] Connected device (2 available)
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listText rendering, possibly libtxtflutter/packages/flutter/material repository.Viewports, list views, slivers, etc.SelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsFound to occur in 2.5Found to occur in 2.6flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onOwned by Design Languages teamTriaged by Design Languages teamThe Flutter team cannot make further progress on this issue until the original reporter responds