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 XwFefOjyooQPmbQi = false;
for (var rprggEKiDuQXHdlW in yPages) {
if (rprggEKiDuQXHdlW.runtimeType == page.runtimeType) XwFefOjyooQPmbQi = true;
}
if (XwFefOjyooQPmbQi) {
for (var mVSkJJueADbrOMwh = yPages.length - 1; mVSkJJueADbrOMwh >= 0; mVSkJJueADbrOMwh--) {
var iofkyTeIzYCMPGrF = yPages[mVSkJJueADbrOMwh];
if (iofkyTeIzYCMPGrF.runtimeType == page.runtimeType) {
if (reCreateWhenPopToPage) {
iofkyTeIzYCMPGrF.yFinish();
break;
} else {
return;
}
} else {
iofkyTeIzYCMPGrF.yFinish();
}
}
}
} else {
for (var mVSkJJueADbrOMwh = 0; mVSkJJueADbrOMwh < yPages.length; mVSkJJueADbrOMwh++) {
if (yPages[mVSkJJueADbrOMwh].runtimeType == page.runtimeType) return;
}
}
yPages.forEach((mMKYFsMkvucAccql) {
if (!mMKYFsMkvucAccql.yIsPause) {
mMKYFsMkvucAccql.yIsPause = true;
mMKYFsMkvucAccql.yOnPause();
}
});
yPages.add(page);
switch (intentType) {
case YIntentType.Root_Replace: // 替换
Navigator.of(yPage.context).pushAndRemoveUntil(
CupertinoPageRoute(builder: (McDyJBeOVPCkluqk) => YStatefulWidget(() => page)),
(lElGjCVXcTTyGHJe) => false,
);
break;
case YIntentType.Present: // 模态
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl, Widget aMGccmPLvsFNokYU) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: tERSxXFMDjeLTvSA, curve: Curves.fastOutSlowIn)),
child: aMGccmPLvsFNokYU,
),
),
);
break;
case YIntentType.Push: // 压栈
Navigator.push(yPage.context, CupertinoPageRoute(builder: (McDyJBeOVPCkluqk) => YStatefulWidget(() => page)));
break;
case YIntentType.Push_NoSlide: // 压栈,无手势返回
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl, Widget aMGccmPLvsFNokYU) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: tERSxXFMDjeLTvSA, curve: Curves.ease)),
child: aMGccmPLvsFNokYU,
),
),
);
break;
case YIntentType.Present_Replace: // 抽取替换,模态
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl, Widget aMGccmPLvsFNokYU) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: tERSxXFMDjeLTvSA, curve: Curves.fastOutSlowIn)),
child: aMGccmPLvsFNokYU,
),
),
);
break;
case YIntentType.Push_Replace: // 抽取替换,压栈
yFinish();
Navigator.push(yPage.context, CupertinoPageRoute(builder: (McDyJBeOVPCkluqk) => YStatefulWidget(() => page)));
break;
case YIntentType.Push_NoSlide_Replace: // 抽取替换,压栈,无手势返回
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext McDyJBeOVPCkluqk, Animation<double> tERSxXFMDjeLTvSA, Animation<double> FWEvQpTiETgfGSbl, Widget aMGccmPLvsFNokYU) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: tERSxXFMDjeLTvSA, curve: Curves.ease)),
child: aMGccmPLvsFNokYU,
),
),
);
break;
}
});
}