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

Update a widget which must use stateful #95

Closed
YLoveX opened this issue Jan 10, 2019 · 1 comment
Closed

Update a widget which must use stateful #95

YLoveX opened this issue Jan 10, 2019 · 1 comment

Comments

@YLoveX
Copy link

YLoveX commented Jan 10, 2019

Hi,

I'm using a StatefulWidget CardsHorizonRoller under the storeConnector,

Widget charts() {
    return StoreConnector<AppState, ChartViewModel>(converter: (store) {
      return ChartViewModel.from(store);
    }, builder: (BuildContext context, ChartViewModel chartViewModel) {
      List<Widget> widgets = [];
      //construct widgets use chartViewModel
      return CardsHorizonRoller(
        widgets,
        cardsFraction: 0.9,
        horizonSpace: 5,
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return charts();
  }

and this will not update the CardsHorizonRoller after i update the 'chartViewModel', distinct is true.
In CardsHorizonRoller I use a TabController which must extends from a statefulWidget....

Which part do I missed?

Anyone who can help me? Thank you very much!

@vvasc
Copy link

vvasc commented Mar 15, 2019

CardsHorizonRoller will be updated when your state tree has been updated. In your code chartViewModel is the way to dispatch actions, and in your reducers this actions will affect the state tree

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

No branches or pull requests

3 participants