back method
Implementation
Future<bool> back() async {
var lastPage =
pageHistory.length >= 2 ? pageHistory[pageHistory.length - 1] : 0;
if (pages.length > initialPages.length && lastPage > 0) {
if (pages.length > lastPage) {
pages.removeAt(_currentPageIndex);
_currentPageIndex--;
}
}
/*var pageOnBack =
pageHistory.length >= 2 ? pageHistory[pageHistory.length - 2] : 0;
_pageViewController!.animateToPage(
pageOnBack,
duration: Duration(milliseconds: 250),
curve: Curves.easeInToLinear,
);
if (pages.length > initialPages.length && lastPage > 0) {
await Future.delayed(Duration(milliseconds: 250), () {
pages.removeAt(lastPage);
});
_currentPageIndex--;
}*/
if (_pageViewController!.page! > 0) {
if (pageHistory.length >= 2) {
lastPage = pageHistory[pageHistory.length - 2];
pageHistory.removeAt(pageHistory.length - 1);
if (pageHistoryTabSelected.length > 0) {
pageHistoryTabSelected.removeAt(pageHistoryTabSelected.length - 1);
}
}
if (pageHistoryTabSelected.length >= 1) {
currentBottomIndex =
pageHistoryTabSelected[pageHistoryTabSelected.length - 1];
}
if (pageHistoryTabSelected.length == 0) {
currentBottomIndex = 0;
}
_currentPageIndex = lastPage;
_pageViewController!.jumpToPage(
lastPage,
);
this._onBackPageListeners.forEach((func) => func());
this._onListener.forEach((func) => func());
return false;
}
return true;
}