yIntent method
void
yIntent(
- YPage page, {
- YIntentType intentType = YIntentType.Push,
- bool popToPage = false,
- bool reCreateWhenPopToPage = true,
Implementation
void yIntent(
YPage page, {
YIntentType intentType = YIntentType.Push,
bool popToPage = false,
bool reCreateWhenPopToPage = true,
}) {
yRun(() {
if (popToPage) {
var sIGkyQPXhQkhaTFq = false;
for (var mXQdOSVqFAsKptLb in yPages) {
if (mXQdOSVqFAsKptLb.runtimeType == page.runtimeType) sIGkyQPXhQkhaTFq = true;
}
if (sIGkyQPXhQkhaTFq) {
for (var XrcXdyTgdtjhbeAt = yPages.length - 1; XrcXdyTgdtjhbeAt >= 0; XrcXdyTgdtjhbeAt--) {
var cFucdnAVQmigNRid = yPages[XrcXdyTgdtjhbeAt];
if (cFucdnAVQmigNRid.runtimeType == page.runtimeType) {
if (reCreateWhenPopToPage) {
cFucdnAVQmigNRid.yFinish();
break;
} else {
return;
}
} else {
cFucdnAVQmigNRid.yFinish();
}
}
}
} else {
for (var XrcXdyTgdtjhbeAt = 0; XrcXdyTgdtjhbeAt < yPages.length; XrcXdyTgdtjhbeAt++) {
if (yPages[XrcXdyTgdtjhbeAt].runtimeType == page.runtimeType) return;
}
}
yPages.forEach((MVdOmicYTZByclpD) {
if (!MVdOmicYTZByclpD.yIsPause) {
MVdOmicYTZByclpD.yIsPause = true;
MVdOmicYTZByclpD.yOnPause();
}
});
yPages.add(page);
switch (intentType) {
case YIntentType.Root_Replace: // 替换
Navigator.of(yPage.context).pushAndRemoveUntil(
CupertinoPageRoute(builder: (CPOyqjjKqxKuBVtj) => YStatefulWidget(() => page)),
(BCECVhQPKJEmamUs) => false,
);
break;
case YIntentType.Present: // 模态
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE, Widget qxEMUIdYCLjcdeKG) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: gVkiMChkLyVlALkp, curve: Curves.fastOutSlowIn)),
child: qxEMUIdYCLjcdeKG,
),
),
);
break;
case YIntentType.Push: // 压栈
Navigator.push(yPage.context, CupertinoPageRoute(builder: (CPOyqjjKqxKuBVtj) => YStatefulWidget(() => page)));
break;
case YIntentType.Push_NoSlide: // 压栈,无手势返回
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE, Widget qxEMUIdYCLjcdeKG) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: gVkiMChkLyVlALkp, curve: Curves.ease)),
child: qxEMUIdYCLjcdeKG,
),
),
);
break;
case YIntentType.Present_Replace: // 抽取替换,模态
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE, Widget qxEMUIdYCLjcdeKG) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: gVkiMChkLyVlALkp, curve: Curves.fastOutSlowIn)),
child: qxEMUIdYCLjcdeKG,
),
),
);
break;
case YIntentType.Push_Replace: // 抽取替换,压栈
yFinish();
Navigator.push(yPage.context, CupertinoPageRoute(builder: (CPOyqjjKqxKuBVtj) => YStatefulWidget(() => page)));
break;
case YIntentType.Push_NoSlide_Replace: // 抽取替换,压栈,无手势返回
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext CPOyqjjKqxKuBVtj, Animation<double> gVkiMChkLyVlALkp, Animation<double> XunLcXxLPoqtZRcE, Widget qxEMUIdYCLjcdeKG) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: gVkiMChkLyVlALkp, curve: Curves.ease)),
child: qxEMUIdYCLjcdeKG,
),
),
);
break;
}
});
}