Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

ScrollablePositionedList inside ScrollView with initialScrollIndex > 0 removes widgets entirely from the view #545

@thedeukalion

Description

@thedeukalion

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

Example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions