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(() {
try {
if (!YConfig.onPageOpen(page)) return;
} catch (e) {
yLog(e.toString());
return;
}
if (popToPage) {
var tyTGCIgrdsxSsYaw = false;
for (var cAXNumzqeckWwxdd in yPages) {
if (cAXNumzqeckWwxdd.runtimeType == page.runtimeType) tyTGCIgrdsxSsYaw = true;
}
if (tyTGCIgrdsxSsYaw) {
for (var ngWDwwbVzZoilclU = yPages.length - 1; ngWDwwbVzZoilclU >= 0; ngWDwwbVzZoilclU--) {
var FlvwYlJgzFaFVRXf = yPages[ngWDwwbVzZoilclU];
if (FlvwYlJgzFaFVRXf.runtimeType == page.runtimeType) {
if (reCreateWhenPopToPage) {
FlvwYlJgzFaFVRXf.yFinish();
break;
} else {
return;
}
} else {
FlvwYlJgzFaFVRXf.yFinish();
}
}
}
} else {
for (var ngWDwwbVzZoilclU = 0; ngWDwwbVzZoilclU < yPages.length; ngWDwwbVzZoilclU++) {
if (yPages[ngWDwwbVzZoilclU].runtimeType == page.runtimeType) return;
}
}
yPages.forEach((moJREUHtZwCKlnqM) {
if (!moJREUHtZwCKlnqM.yIsPause) {
moJREUHtZwCKlnqM.yIsPause = true;
moJREUHtZwCKlnqM.yOnPause();
}
});
yPages.add(page);
switch (intentType) {
case YIntentType.Root_Replace: // 替换
Navigator.of(yPage.context).pushAndRemoveUntil(
CupertinoPageRoute(
settings: RouteSettings(name: page.runtimeType.toString()),
builder: (SsJTfRMEZgWhhSYs) => YStatefulWidget(() => page),
),
(YeAzclILFUHlSctX) => false,
);
break;
case YIntentType.Present: // 模态
Navigator.push(
yPage.context,
PageRouteBuilder(
settings: RouteSettings(name: page.runtimeType.toString()),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg, Widget NlHZfAHaDjCyvwUn) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: iqAnnUGpIRasKqxw, curve: Curves.fastOutSlowIn)),
child: NlHZfAHaDjCyvwUn,
),
),
);
break;
case YIntentType.Push: // 压栈
Navigator.push(
yPage.context,
CupertinoPageRoute(
settings: RouteSettings(name: page.runtimeType.toString()),
builder: (SsJTfRMEZgWhhSYs) => YStatefulWidget(() => page),
),
);
break;
case YIntentType.Push_NoSlide: // 压栈,无手势返回
Navigator.push(
yPage.context,
PageRouteBuilder(
settings: RouteSettings(name: page.runtimeType.toString()),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg, Widget NlHZfAHaDjCyvwUn) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: iqAnnUGpIRasKqxw, curve: Curves.ease)),
child: NlHZfAHaDjCyvwUn,
),
),
);
break;
case YIntentType.Present_Replace: // 抽取替换,模态
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
settings: RouteSettings(name: page.runtimeType.toString()),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg, Widget NlHZfAHaDjCyvwUn) => SlideTransition(
position: Tween<Offset>(begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: iqAnnUGpIRasKqxw, curve: Curves.fastOutSlowIn)),
child: NlHZfAHaDjCyvwUn,
),
),
);
break;
case YIntentType.Push_Replace: // 抽取替换,压栈
yFinish();
Navigator.push(
yPage.context,
CupertinoPageRoute(
settings: RouteSettings(name: page.runtimeType.toString()),
builder: (SsJTfRMEZgWhhSYs) => YStatefulWidget(() => page),
),
);
break;
case YIntentType.Push_NoSlide_Replace: // 抽取替换,压栈,无手势返回
yFinish();
Navigator.push(
yPage.context,
PageRouteBuilder(
settings: RouteSettings(name: page.runtimeType.toString()),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg) => YStatefulWidget(() => page),
transitionsBuilder: (BuildContext SsJTfRMEZgWhhSYs, Animation<double> iqAnnUGpIRasKqxw, Animation<double> GIBCnhCWfMsvCzsg, Widget NlHZfAHaDjCyvwUn) => SlideTransition(
position: Tween<Offset>(begin: const Offset(1.0, 0.0), end: const Offset(0.0, 0.0)).animate(CurvedAnimation(parent: iqAnnUGpIRasKqxw, curve: Curves.ease)),
child: NlHZfAHaDjCyvwUn,
),
),
);
break;
}
});
}