036d0db4ce
(cherry picked from commit 8e8beccc25e7a6bd3199363cebc36efb74854740)
39 lines
980 B
Dart
39 lines
980 B
Dart
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
Future<dynamic> push(String routeName, {dynamic arguments}) async {
|
|
return Get.toNamed(routeName, arguments: arguments);
|
|
}
|
|
|
|
Future<dynamic> pushAndPop(String routeName, {dynamic arguments}) async {
|
|
return Get.offNamed(routeName, arguments: arguments);
|
|
}
|
|
|
|
Future<dynamic> popAndPush(String routeName, {dynamic arguments}) async {
|
|
return Get.offAndToNamed(routeName, arguments: arguments);
|
|
}
|
|
|
|
Future<dynamic> pushAndPopAll(String routeName, {dynamic arguments}) async {
|
|
return Get.offAllNamed(routeName, arguments: arguments);
|
|
}
|
|
|
|
void popBack({dynamic result}) {
|
|
Get.back(result: result);
|
|
}
|
|
|
|
bool canBack(BuildContext context) {
|
|
return Navigator.of(context).canPop();
|
|
}
|
|
|
|
BuildContext? get currentContext => Get.context;
|
|
|
|
BuildContext? get currentOverlayContext => Get.overlayContext;
|
|
|
|
T? getBinding<T>() {
|
|
if (Get.isRegistered<T>()) {
|
|
return Get.find<T>();
|
|
} else {
|
|
return null;
|
|
}
|
|
} |