Skip to content

Instantly share code, notes, and snippets.

@khoasvn
Created July 10, 2020 02:40
Show Gist options
  • Select an option

  • Save khoasvn/6b573803afbde5f5602f32f20db7a29f to your computer and use it in GitHub Desktop.

Select an option

Save khoasvn/6b573803afbde5f5602f32f20db7a29f to your computer and use it in GitHub Desktop.
class MenuBloc extends Bloc<MenuEvent, MenuState> {
MenuBloc() : super(MenuContacts());
//static var bottomNav = GlobalKey<ConvexAppBarState>();
final bottomNav = CBKey.bottomNav;
@override
Stream<MenuState> mapEventToState(MenuEvent event) async* {
if (event is GoToContacts) {
yield* _mapMenuGoToContacts();
} else if (event is GoToReview) {
yield* _mapMenuGoToReview();
}
}
Stream<MenuState> _mapMenuGoToContacts() async* {
bottomNav.currentState.animateTo(0);
yield MenuContacts();
}
Stream<MenuState> _mapMenuGoToReview() async* {
bottomNav.currentState.animateTo(1);
yield MenuReview();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment