Last active
March 25, 2021 10:11
-
-
Save 2shrestha22/42cf47e24c329ed24002ed1d5f6c14ed 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
//where _kAdIndex is an int and after each -kAdIndex in the listView Ad is displayed | |
ListView.builder( | |
controller: _scrollController, | |
cacheExtent: 20, | |
itemCount: data.layoutList.length + | |
(data.layoutList.length ~/ _kAdIndex), | |
itemBuilder: (BuildContext context, int index) { | |
if (index != 0 && (index + 1) % (_kAdIndex + 1) == 0) { | |
print(index); | |
print(index ~/ _kAdIndex); | |
return MyAdWidget(); | |
} else { | |
return LayoutListItem( | |
layout: data | |
.layoutList[index - (index ~/ (_kAdIndex + 1))], | |
); | |
} | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment