Jonny Borges
Committed by GitHub

Merge pull request #581 from justkawal/master

Minor Code Reduction without affecting functionality
part of 'app_pages.dart';
abstract class Routes{
abstract class Routes {
static const HOME = '/home';
static const COUNTRY = '/country';
static const DETAILS = '/details';
... ...
... ... @@ -261,4 +261,3 @@ class GetMaterialApp extends StatelessWidget {
abstract class Translations {
Map<String, Map<String, String>> get keys;
}
... ...
... ... @@ -85,21 +85,14 @@ class GetPageRoute<T> extends PageRoute<T> {
}
static bool _isPopGestureEnabled<T>(PageRoute<T> route) {
if (route.isFirst) return false;
if (route.willHandlePopInternally) return false;
if (route.hasScopedWillPopCallback) return false;
if (route.fullscreenDialog) return false;
if (route.animation.status != AnimationStatus.completed) return false;
if (route.secondaryAnimation.status != AnimationStatus.dismissed) {
return false;
}
if (isPopGestureInProgress(route)) return false;
// ignore: lines_longer_than_80_chars
if (route.isFirst ||
route.willHandlePopInternally ||
route.hasScopedWillPopCallback ||
route.fullscreenDialog ||
route.animation.status != AnimationStatus.completed ||
route.secondaryAnimation.status != AnimationStatus.dismissed ||
isPopGestureInProgress(route)) return false;
return true;
}
... ... @@ -120,9 +113,7 @@ class GetPageRoute<T> extends PageRoute<T> {
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
if (binding != null) {
binding.dependencies();
}
binding?.dependencies();
if (bindings != null) {
for (final binding in bindings) {
binding.dependencies();
... ...
... ... @@ -55,7 +55,7 @@ class GetObserver extends NavigatorObserver {
String name(Route<dynamic> route) {
if (route?.settings?.name != null) {
return route?.settings?.name;
return route.settings.name;
} else if (route is GetPageRoute) {
return route.routeName;
} else if (route is GetDialogRoute) {
... ... @@ -77,9 +77,7 @@ class GetObserver extends NavigatorObserver {
if (isSnackbar) {
GetConfig.log("OPEN SNACKBAR $routeName");
} else if (isBottomSheet) {
GetConfig.log("OPEN $routeName");
} else if (isDialog) {
} else if (isBottomSheet || isDialog) {
GetConfig.log("OPEN $routeName");
} else if (isGetPageRoute) {
GetConfig.log("GOING TO ROUTE $routeName");
... ... @@ -112,9 +110,7 @@ class GetObserver extends NavigatorObserver {
if (isSnackbar) {
GetConfig.log("CLOSE SNACKBAR $routeName");
} else if (isBottomSheet) {
GetConfig.log("CLOSE $routeName");
} else if (isDialog) {
} else if (isBottomSheet || isDialog) {
GetConfig.log("CLOSE $routeName");
} else if (isGetPageRoute) {
GetConfig.log("CLOSE TO ROUTE $routeName");
... ...
... ... @@ -686,14 +686,11 @@ class _GetBarState<K extends Object> extends State<GetBar>
}
Widget _getTitleText() {
return widget.titleText != null
? widget.titleText
: Text(
return widget.titleText ??
Text(
widget.title ?? "",
style: TextStyle(
fontSize: 16.0,
color: Colors.white,
fontWeight: FontWeight.bold),
fontSize: 16.0, color: Colors.white, fontWeight: FontWeight.bold),
);
}
... ... @@ -705,11 +702,7 @@ class _GetBarState<K extends Object> extends State<GetBar>
}
FlatButton _getMainActionButton() {
if (widget.mainButton != null) {
return widget.mainButton;
} else {
return null;
}
}
}
... ...
... ... @@ -154,9 +154,8 @@ class SnackRoute<T> extends OverlayRoute<T> {
} else {
if (snack.snackPosition == SnackPosition.TOP) {
return DismissDirection.up;
} else {
return DismissDirection.down;
}
return DismissDirection.down;
}
}
... ...
... ... @@ -3,7 +3,6 @@ import 'dart:collection';
import '../rx_core/rx_interface.dart';
/// global object that registers against `GetX` and `Obx`, and allows the
/// reactivity
/// of those `Widgets` and Rx values.
... ... @@ -115,7 +114,7 @@ class _RxImpl<T> implements RxInterface<T> {
/// print('${inputError.runtimeType}: $inputError'); // outputs > RxString: null
/// ```
void nil() {
subject.add(_value=null);
subject.add(_value = null);
}
/// Same as `toString()` but using a getter.
... ... @@ -162,7 +161,6 @@ class _RxImpl<T> implements RxInterface<T> {
bool firstRebuild = true;
/// Updates the [value] and adds it to the stream, updating the observer
/// Widget, only if it's different from the previous value.
set value(T val) {
... ... @@ -186,14 +184,12 @@ class _RxImpl<T> implements RxInterface<T> {
{Function onError, void Function() onDone, bool cancelOnError}) =>
stream.listen(onData, onError: onError, onDone: onDone);
/// Binds an existing stream to this Rx to keep the values in sync.
void bindStream(Stream<T> stream) => stream.listen((va) => value = va);
Stream<R> map<R>(R mapper(T data)) => stream.map(mapper);
}
/// Rx class for `bool` Type.
class RxBool extends _RxImpl<bool> {
RxBool([bool initial]) {
... ... @@ -298,7 +294,6 @@ class RxInt extends _BaseRxNum<int> {
}
}
/// Foundation class used for custom `Types` outside the common native Dart
/// types.
/// For example, any custom "Model" class, like User().obs will use `Rx` as
... ...