Last active
February 18, 2019 16:35
-
-
Save GIfatahTH/de360e4caf3fd7d4bab1be8fb6107ed1 to your computer and use it in GitHub Desktop.
main.dart file of scoped_model
This file contains 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 MainModel extends Model { | |
final itemProvider = ItemProvider(); | |
List<Item> items; | |
Color detailedColor; // The color of the tapped card from the ListView | |
int detailedIndex; // The index of the tapped card from the ListView | |
getItems() async { | |
items = await itemProvider.fetchItems(); | |
notifyListeners(); | |
} | |
showDetailed(Color color, int index) { | |
detailedColor = color; | |
detailedIndex = index; | |
notifyListeners(); | |
} | |
increment() { | |
items[detailedIndex].count++; | |
notifyListeners(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment