Nudges on Scrollable Widgets
To Show Nudges on Scrollable Widgets
There are list of widgets which are scrollable in flutter - List .
(CustomScrollView, DraggableScrollableSheet, GridView, ListView, NestedScrollView, NotificationListener, PageView,
RefreshIndicator, ReorderableListView, ScrollConfiguration, Scrollable, Scrollbar, SingleChildScrollView)
For Nudges to be attached on a scroll type or scrollable widgets, We have to add a Key Property in the Widget with ValueKey(“UniqueString”) or ObjectKey("UniqueString")
// Example -1
ListView.builder(
itemCount: _items.length,
itemBuilder: (context, index) {
return InkWell(
key: ValueKey((index+1).toString()),
onTap: () {},
child: Text(“abc”)
);
})
// Example - 2
GridView.count(
children: List.generate(300, (index) {
return Container(
key: ValueKey((index+1).toString()),
child: Text(
'Item ${index + 1}',
),
);
}),
),
Updated 3 months ago