Skip to content

Instantly share code, notes, and snippets.

@juliuscanute
Created December 14, 2019 22:48
Show Gist options
  • Select an option

  • Save juliuscanute/4bec0fae802f8f5d7bbc5cecfd0fdb31 to your computer and use it in GitHub Desktop.

Select an option

Save juliuscanute/4bec0fae802f8f5d7bbc5cecfd0fdb31 to your computer and use it in GitHub Desktop.
View emotion detail
class _ViewModel {
final Store<EmotionAppState> store;
const _ViewModel({this.store});
static _ViewModel fromStore(Store<EmotionAppState> store) {
return _ViewModel(store: store);
}
String getEmotionImage() {
int index = store.state.index;
return store.state.details[index].emoji;
}
String getEmotion() {
int index = store.state.index;
return store.state.details[index].emotion;
}
String getEmotionDescription() {
int index = store.state.index;
return store.state.details[index].emotionDescription;
}
String getDate() {
int index = store.state.index;
return store.state.details[index].emotionDate;
}
String getTime() {
int index = store.state.index;
return store.state.details[index].emotionTime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment