Jonatas

added hideUrl function

... ... @@ -16,6 +16,7 @@ import '../../utils.dart';
abstract class GetInterface {
bool defaultPopGesture = GetPlatform.isIOS;
bool defaultOpaqueRoute = true;
bool forceRouteName = true;
Transition defaultTransition;
Duration defaultDurationTransition = Duration(milliseconds: 400);
bool defaultGlobalState = true;
... ...
... ... @@ -43,10 +43,12 @@ extension GetNavigation on GetInterface {
bool fullscreenDialog = false,
Object arguments,
Bindings binding,
preventDuplicates = true,
bool preventDuplicates = true,
bool popGesture,
}) {
if (preventDuplicates && '/${page.runtimeType}' == currentRoute) {
if (preventDuplicates &&
'/${page.runtimeType}' == currentRoute &&
forceRouteName) {
return null;
}
return global(id).currentState.push(
... ... @@ -54,7 +56,7 @@ extension GetNavigation on GetInterface {
opaque: opaque ?? true,
page: () => page,
settings: RouteSettings(
name: '/${page.runtimeType}',
name: forceRouteName ? '/${page.runtimeType}' : '',
arguments: arguments,
),
popGesture: popGesture ?? defaultPopGesture,
... ... @@ -318,15 +320,18 @@ extension GetNavigation on GetInterface {
preventDuplicates = true,
Duration duration,
}) {
if (preventDuplicates && '/${page.runtimeType}' == currentRoute) {
if (preventDuplicates &&
'/${page.runtimeType}' == currentRoute &&
forceRouteName) {
return null;
}
return global(id).currentState.pushReplacement(GetPageRoute(
opaque: opaque ?? true,
page: () => page,
binding: binding,
settings:
RouteSettings(name: '/${page.runtimeType}', arguments: arguments),
settings: RouteSettings(
name: forceRouteName ? '/${page.runtimeType}' : '',
arguments: arguments),
fullscreenDialog: fullscreenDialog,
popGesture: popGesture ?? defaultPopGesture,
transition: transition ?? defaultTransition,
... ... @@ -381,8 +386,9 @@ extension GetNavigation on GetInterface {
popGesture: popGesture ?? defaultPopGesture,
page: () => page,
binding: binding,
settings:
RouteSettings(name: '/${page.runtimeType}', arguments: arguments),
settings: RouteSettings(
name: forceRouteName ? '/${page.runtimeType}' : '',
arguments: arguments),
fullscreenDialog: fullscreenDialog,
transition: transition ?? defaultTransition,
transitionDuration: duration ?? defaultDurationTransition,
... ...
... ... @@ -50,6 +50,7 @@ class GetMaterialApp extends StatelessWidget {
this.defaultTransition,
// this.actions,
this.getPages,
this.forceRouteName = true,
this.opaqueRoute,
this.enableLog,
this.logWriterCallback,
... ... @@ -102,6 +103,7 @@ class GetMaterialApp extends StatelessWidget {
final Function(Routing) routingCallback;
final Transition defaultTransition;
final bool opaqueRoute;
final bool forceRouteName;
final VoidCallback onInit;
final VoidCallback onDispose;
final bool enableLog;
... ... @@ -189,6 +191,8 @@ class GetMaterialApp extends StatelessWidget {
if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
Get.forceRouteName = forceRouteName;
if (translations != null) {
Get.translations = translations.keys;
} else if (translationsKeys != null) {
... ... @@ -261,7 +265,6 @@ abstract class Translations {
Map<String, Map<String, String>> get keys;
}
extension Trans on String {
String get tr {
// Returns the key if locale is null.
... ...