I'm trying to wrap a PositionedScrollableList inside a parent ScrollView and use "shrinkWrap", but doing so makes the indexes before initialStartIndex disappear. Instead of scrolling to that position it seems to remove everything before the startIndex. It works the same inside a CustomScrollView. It only works when ScrollablePositionedList is primary scroll inside a Scaffold for me.
Problem description
scrollable_positioned_list: ^0.3.8
Steps to reproduce
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const TestApp());
}
class TestApp extends StatelessWidget
{
const TestApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: ScrollablePositionedList.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: 50,
padding: const EdgeInsets.all(16),
initialScrollIndex: 5,
itemBuilder: (context, index) {
return Container(
color: index % 2 == 0 ? Colors.red : Colors.yellow,
child: Text("Index: $index"),
);
},
separatorBuilder: (context, index) => const SizedBox(height: 16,),
),
),
),
);
}
}
Expected behavior
Setting the initialScrollIndex to 5 I also expected to see 1-4 as well in the list just "above it".
Actual behavior
It starts at Index: 5 and skips 1-4 entirely. It's not even visible in the UI.
Example
