0

Since scoped model has its own scope, it seems it breaks the usage of OpenContainer with the default provided code. It gets a cannot find scope error when this is there:

OpenContainer(
                  transitionType: ContainerTransitionType.fadeThrough,
                  closedBuilder:
                      (BuildContext _, VoidCallback openContainer) {
                    //_SelectedProductState.productName = "St. IvesĀ® Scrubs";
                    return Card();
                  },
                  openBuilder: (BuildContext _, VoidCallback __) {
                    return ScopedModel<DownloadImages>(
                      model: downloadImages,
                      child: WidgetHere(),
                    );
                  },
                  onClosed: (_) => print('Closed'),
                ),

Perhaps there should be a modification in the BuildContext variables, but I have no idea what to do, maybe even a descendant. What should I do to fix it?

The transition and widget opening works, but during the animation the error occurs and the image in my Card gets the red error.

Note: I have a ScopedModelDescendant in this Card widget, and the console shows that's where the error is, it seems it gets the wrong model when the animation occurs.

Jiehfeng
  • 753
  • 7
  • 16

1 Answers1

0

I fixed it, but not this. I simply moved on to the Provider package, it did the job without any errors, seems way more powerful and convenient. My luck that I stumbled upon Scoped Models first.

Jiehfeng
  • 753
  • 7
  • 16