Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for 'dirty' error caused by scroll notifications during layout #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

PatrickWulfe
Copy link

Previously if the widget was rebuilt, (by calling a modal bottom sheet in my case), and a scroll notification happened during that rebuild, you would receive a dirty state error. By moving the setStates to a microtask, it avoids this error.

@RichiB20
Copy link

Hi @PatrickWulfe , I tried to reproduce your scenario using the modal_bottom_sheet package. I use their example and I put the ScrollShadow above the ListView in ModalInsideModal class. In the application you find it in the "Bar Modal" example.
Trying in this way I not received any error, could you tell me if you use the ScrollShadow in another way?

My simple code is the following:

        child: ScrollShadow(
          child: ListView(
            reverse: reverse,
            // shrinkWrap: true,
            controller: PrimaryScrollController.of(context),
            physics: const BouncingScrollPhysics(),
            children: ListTile.divideTiles(
                context: context,
                tiles: List<Widget>.generate(
                  100,
                  (int index) => ListTile(
                    title: Text('Item $index'),
                    onTap: () => Navigator.of(context).push(
                      CupertinoSheetRoute<void>(
                        builder: (BuildContext context) =>
                            ModalInsideModal(reverse: reverse),
                      ),
                    ),
                  ),
                )).toList(),
          ),
        ),

Thank you

@rickypid
Copy link
Owner

rickypid commented Jan 8, 2024

Hi @PatrickWulfe,

Do you have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants