navigatorPush static method
公共打开方式
Implementation
static Future navigatorPush(BuildContext context, Widget widget, String name,
{bool add = false,
bool replace = false,
bool fullscreenDialog = false,
bool match = false,
Offset? center}) {
FocusScope.of(context).unfocus();
var route = match
? CirclePageRoute(
fullscreenDialog: fullscreenDialog,
settings: RouteSettings(name: name),
center: center,
builder: (context) => widget)
: CupertinoPageRoute(
fullscreenDialog: fullscreenDialog,
settings: RouteSettings(name: name),
builder: (context) => widget);
if (add) {
if (routeMap[name]?.isActive == true) {
Navigator.removeRoute(context, routeMap[name]);
}
routeMap[name] = route;
}
if (replace) {
return Navigator.pushReplacement(context, route);
} else {
return Navigator.push(context, route);
}
}