The screenshot below consists of two product listings, one which is too short to be scrollable, the other which is long enough to be scrollable.
Below is the screenshot with more visible colours for better clarity for the sake of this question:
To indicate to the user that the list is scrollable, I have stacked the list with a gradient which is at the end of the list.
I would like this gradient to only appear when the list is long enough to be scrollable, but I am not able to find a way to differentiate between the scrollable and non-scrollable lists.
Below is the code for the stack which has the underlying list and the gradient:
Stack(
children: <Widget>[
ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
//children go here
],
),
Align(
alignment: Alignment.centerRight,
child: Container(
width: 24,
height: 24,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: FractionalOffset.centerRight,
end: FractionalOffset.centerLeft,
colors: [
Colors.green,
Colors.yellow
],
stops: [
0.0,
1.0
]))),
),
],
),

