Created
September 28, 2021 00:32
-
-
Save diegoveloper/64387d8be2dafa8e7d6def9fe8d81614 to your computer and use it in GitHub Desktop.
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
void init(TickerProvider ticker) { | |
tabController = | |
TabController(vsync: ticker, length: rappiCategories.length); | |
double offsetFrom = 0.0; | |
double offsetTo = 0.0; | |
for (int i = 0; i < rappiCategories.length; i++) { | |
final category = rappiCategories[i]; | |
offsetFrom = offsetTo; | |
offsetTo = offsetFrom + | |
rappiCategories[i].products.length * productHeight + | |
categoryHeight; | |
tabs.add(RappiTabCategory( | |
category: category, | |
selected: (i == 0), | |
offsetFrom: offsetFrom, | |
offsetTo: offsetTo, | |
)); | |
items.add(RappiItem(category: category)); | |
for (int j = 0; j < category.products.length; j++) { | |
final product = category.products[j]; | |
items.add(RappiItem(product: product)); | |
} | |
} | |
scrollController.addListener(_onScrollListener); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment