alibaba / fish-redux

An assembled flutter application framework.
https://github.com/alibaba/fish-redux
Apache License 2.0
7.33k stars 843 forks source link

Action dispatch from subpage #685

Open Time2HackJS opened 4 years ago

Time2HackJS commented 4 years ago

My greetings.

I have an actions in my main app page:

import 'package:fish_redux/fish_redux.dart';

enum Actions{ changeIndex, changeAppBarState, toggleDrawerPermission }

class ActionsCreate{
  static Action changeIndex(int value) => Action(Actions.changeIndex, payload: value);
  static Action changeAppBarState() => Action(Actions.changeAppBarState);
  static Action toggleDrawerPermission() => Action(Actions.toggleDrawerPermission);
}

In my subpage i need to dispatch toggleDrawerPermission of my main page, but can't do it because my subpage has its own actions:

import 'package:fish_redux/fish_redux.dart';

enum Actions{ getCategories, loadCategories }

class ActionsCreate{
  static Action getCategories() => Action(Actions.getCategories);
  static Action loadCategories(List<CategoryResultResponse> results) => Action(Actions.loadCategories, payload: results);
}

How can i dispatch action of my main page from my subpage? Thank you.