Created
December 14, 2019 22:33
-
-
Save juliuscanute/24cda11768a2dee35664bc3fbc8b024b to your computer and use it in GitHub Desktop.
Display retrieved emotions view model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _ViewModelSavedEmotion { | |
| final Store<EmotionAppState> store; | |
| const _ViewModelSavedEmotion({this.store}); | |
| static _ViewModelSavedEmotion fromStore(Store<EmotionAppState> store) { | |
| return _ViewModelSavedEmotion(store: store); | |
| } | |
| String getEmotionImage(int index) { | |
| return store.state.details[index].emoji; | |
| } | |
| String getEmotion(int index) { | |
| return store.state.details[index].emotion; | |
| } | |
| String getEmotionDescription(int index) { | |
| return store.state.details[index].emotionDescription; | |
| } | |
| String getDate(int index) { | |
| return store.state.details[index].emotionDate; | |
| } | |
| String getTime(int index) { | |
| return store.state.details[index].emotionTime; | |
| } | |
| int getEmotionCount() { | |
| List<SavedDetail> details = store.state.details ?? []; | |
| return details.length; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment