kawal7415

some code reduction

@@ -85,21 +85,14 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -85,21 +85,14 @@ class GetPageRoute<T> extends PageRoute<T> {
85 } 85 }
86 86
87 static bool _isPopGestureEnabled<T>(PageRoute<T> route) { 87 static bool _isPopGestureEnabled<T>(PageRoute<T> route) {
88 - if (route.isFirst) return false;  
89 -  
90 - if (route.willHandlePopInternally) return false;  
91 -  
92 - if (route.hasScopedWillPopCallback) return false;  
93 -  
94 - if (route.fullscreenDialog) return false;  
95 -  
96 - if (route.animation.status != AnimationStatus.completed) return false;  
97 -  
98 - if (route.secondaryAnimation.status != AnimationStatus.dismissed) {  
99 - return false;  
100 - }  
101 -  
102 - if (isPopGestureInProgress(route)) return false; 88 + // ignore: lines_longer_than_80_chars
  89 + if (route.isFirst ||
  90 + route.willHandlePopInternally ||
  91 + route.hasScopedWillPopCallback ||
  92 + route.fullscreenDialog ||
  93 + route.animation.status != AnimationStatus.completed ||
  94 + route.secondaryAnimation.status != AnimationStatus.dismissed ||
  95 + isPopGestureInProgress(route)) return false;
103 96
104 return true; 97 return true;
105 } 98 }
@@ -120,9 +113,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -120,9 +113,7 @@ class GetPageRoute<T> extends PageRoute<T> {
120 Animation<double> animation, 113 Animation<double> animation,
121 Animation<double> secondaryAnimation, 114 Animation<double> secondaryAnimation,
122 ) { 115 ) {
123 - if (binding != null) {  
124 - binding.dependencies();  
125 - } 116 + binding?.dependencies();
126 if (bindings != null) { 117 if (bindings != null) {
127 for (final binding in bindings) { 118 for (final binding in bindings) {
128 binding.dependencies(); 119 binding.dependencies();
@@ -55,7 +55,7 @@ class GetObserver extends NavigatorObserver { @@ -55,7 +55,7 @@ class GetObserver extends NavigatorObserver {
55 55
56 String name(Route<dynamic> route) { 56 String name(Route<dynamic> route) {
57 if (route?.settings?.name != null) { 57 if (route?.settings?.name != null) {
58 - return route?.settings?.name; 58 + return route.settings.name;
59 } else if (route is GetPageRoute) { 59 } else if (route is GetPageRoute) {
60 return route.routeName; 60 return route.routeName;
61 } else if (route is GetDialogRoute) { 61 } else if (route is GetDialogRoute) {
@@ -77,9 +77,7 @@ class GetObserver extends NavigatorObserver { @@ -77,9 +77,7 @@ class GetObserver extends NavigatorObserver {
77 77
78 if (isSnackbar) { 78 if (isSnackbar) {
79 GetConfig.log("OPEN SNACKBAR $routeName"); 79 GetConfig.log("OPEN SNACKBAR $routeName");
80 - } else if (isBottomSheet) {  
81 - GetConfig.log("OPEN $routeName");  
82 - } else if (isDialog) { 80 + } else if (isBottomSheet || isDialog) {
83 GetConfig.log("OPEN $routeName"); 81 GetConfig.log("OPEN $routeName");
84 } else if (isGetPageRoute) { 82 } else if (isGetPageRoute) {
85 GetConfig.log("GOING TO ROUTE $routeName"); 83 GetConfig.log("GOING TO ROUTE $routeName");
@@ -112,9 +110,7 @@ class GetObserver extends NavigatorObserver { @@ -112,9 +110,7 @@ class GetObserver extends NavigatorObserver {
112 110
113 if (isSnackbar) { 111 if (isSnackbar) {
114 GetConfig.log("CLOSE SNACKBAR $routeName"); 112 GetConfig.log("CLOSE SNACKBAR $routeName");
115 - } else if (isBottomSheet) {  
116 - GetConfig.log("CLOSE $routeName");  
117 - } else if (isDialog) { 113 + } else if (isBottomSheet || isDialog) {
118 GetConfig.log("CLOSE $routeName"); 114 GetConfig.log("CLOSE $routeName");
119 } else if (isGetPageRoute) { 115 } else if (isGetPageRoute) {
120 GetConfig.log("CLOSE TO ROUTE $routeName"); 116 GetConfig.log("CLOSE TO ROUTE $routeName");
@@ -154,9 +154,8 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -154,9 +154,8 @@ class SnackRoute<T> extends OverlayRoute<T> {
154 } else { 154 } else {
155 if (snack.snackPosition == SnackPosition.TOP) { 155 if (snack.snackPosition == SnackPosition.TOP) {
156 return DismissDirection.up; 156 return DismissDirection.up;
157 - } else {  
158 - return DismissDirection.down;  
159 } 157 }
  158 + return DismissDirection.down;
160 } 159 }
161 } 160 }
162 161