Jonny Borges
Committed by GitHub

Bump to 2.7.0

## [2.7.0]
- Added obx, a simple state interceptor.
- Improve Bindings, ListX, and fix docs typos
## [2.6.3]
- Flutter currently has a problem on some devices where using showModalBottomSheet() can cause TextFields to be hidden behind the keyboard (https://github.com/flutter/flutter/issues/18564) this issue is closed, even users reporting that the problem still occurs.
The problem happens casually, as well as the problem of the snackbar on the iPhone SE 2, and checking the code, I realized that a padding with MediaQuery.of(context).viewInsets.bottom is missing inside the bottomSheet to make it work correctly, since it does not have any constraint with the keyboard.
... ...
... ... @@ -905,13 +905,13 @@ You can create Global settings for Get. Just add Get.config to your code before
```dart
GetMaterialApp(
enableLog: true,
defaultTransition: Transitions.fade,
defaultOpaqueRoute: Get.isOpaqueRouteDefault,
defaultPopGesture: Get.isPopGestureEnable,
defaultDurationTransition: Get.defaultDurationTransition,
defaultGlobalState: Get.defaultGlobalState,
GetMaterialApp(
enableLog: true,
defaultTransition: Transition.fade,
opaqueRoute: Get.isOpaqueRouteDefault,
popGesture: Get.isPopGestureEnable,
transitionDuration: Get.defaultDurationTransition,
defaultGlobalState: Get.defaultGlobalState,
);
Get.config(
... ...

38.6 KB | W: | H:

40.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -9,6 +9,7 @@ export 'src/state/get_state.dart';
export 'src/rx/rx_interface.dart';
export 'src/rx/rx_impl.dart';
export 'src/rx/rx_event.dart';
export 'src/rx/rx_obx.dart';
export 'src/rx/rx_getbuilder.dart';
export 'src/root/root_widget.dart';
export 'src/routes/default_route.dart';
... ...
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:get/get.dart';
import 'package:get/src/routes/bindings_interface.dart';
import 'bottomsheet/bottomsheet.dart';
import 'platform/platform.dart';
... ... @@ -721,6 +722,12 @@ class Get {
static void remove<S>({String name}) {
String key = _getKey(S, name);
_FcBuilder builder = Get()._singl[key];
final i = builder.dependency;
if (i is DisposableInterface || i is GetController) {
i.onClose();
if (isLogEnable) print('[GET] onClose of $key called');
}
if (builder != null) builder.dependency = null;
if (Get()._singl.containsKey(key)) {
print('error on remove $key');
... ... @@ -739,13 +746,22 @@ class Get {
}
/// Delete class instance on [S] and clean memory
static bool delete<S>({String name}) {
static Future<bool> delete<S>({String name}) async {
String key = _getKey(S, name);
if (!Get()._singl.containsKey(key)) {
print('Instance $key not found');
return false;
}
_FcBuilder builder = Get()._singl[key];
final i = builder.dependency;
if (i is DisposableInterface || i is GetController) {
await i.onClose();
if (isLogEnable) print('[GET] onClose of $key called');
}
Get()._singl.removeWhere((oldkey, value) => (oldkey == key));
if (Get()._singl.containsKey(key)) {
print('error on remove object $key');
... ... @@ -766,7 +782,7 @@ class Get {
static RouteSettings get routeSettings => Get()._settings;
Routing _routing;
Routing _routing = Routing();
Map<String, String> _parameters = {};
... ... @@ -860,6 +876,9 @@ class Get {
/// give access to Theme.of(context).iconTheme.color
static Color get iconColor => Theme.of(context).iconTheme.color;
/// give access to Focus.of(context).iconTheme.color
static FocusScopeNode get focusScope => FocusScope.of(context);
/// give access to MediaQuery.of(context).size.height
static double get height => MediaQuery.of(context).size.height;
... ...
... ... @@ -75,11 +75,11 @@ class _GetXState<T extends RxController> extends State<GetX<T>> {
if (isCreator) {
if (widget.autoRemove && Get.isRegistred<T>()) {
controller.onClose();
// controller.onClose();
Get.delete<T>();
}
} else {
controller.onClose();
// } else {
// controller.onClose();
}
// controller.onClose();
_observer.close();
... ...
... ... @@ -245,6 +245,13 @@ class ListX<E> extends DelegatingList<E> implements List<E>, RxInterface<E> {
});
}
// @override
// int get length => list.length;
// List<E> get list => value as List<E>;
// set list(List<E> v) => assignAll(v);
@override
get value {
if (Get.obs != null) {
... ... @@ -375,12 +382,12 @@ extension MapExtension on Map {
}
}
extension ListExtension on List {
ListX get obs {
extension ListExtension<E> on List<E> {
ListX<E> get obs {
if (this != null)
return ListX()..assignAll(this);
return ListX<E>()..assignAll(this);
else
return ListX(null);
return ListX<E>(null);
}
}
... ...
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:get/src/rx/rx_interface.dart';
import '../get_main.dart';
import 'rx_impl.dart';
Widget obx(Widget Function() builder) {
final b = builder;
return Obx(
builder: b,
);
}
class Obx extends StatefulWidget {
final Widget Function() builder;
const Obx({
this.builder,
});
_ObxState createState() => _ObxState();
}
class _ObxState extends State<Obx> {
RxInterface _observer;
StreamSubscription _listenSubscription;
bool isCreator = false;
_ObxState() {
_observer = ListX();
}
@override
void initState() {
_listenSubscription = _observer.subject.stream.listen((data) {
setState(() {});
});
super.initState();
}
@override
void dispose() {
_observer.close();
_listenSubscription?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
final observer = Get.obs;
Get.obs = this._observer;
final result = widget.builder();
Get.obs = observer;
return result;
}
}
... ...
... ... @@ -34,8 +34,8 @@ class GetController extends State {
}
}
void onClose() {}
void onInit() {}
void onClose() async {}
void onInit() async {}
@override
Widget build(_) => throw ("build method can't be called");
... ... @@ -107,7 +107,7 @@ class _GetBuilderState<T extends GetController> extends State<GetBuilder<T>> {
try {
controller?.onInit();
} catch (e) {
if (Get.isLogEnable) print("Controller is not attach");
if (Get.isLogEnable) print("[GET] error: $e");
}
}
}
... ... @@ -120,7 +120,7 @@ class _GetBuilderState<T extends GetController> extends State<GetBuilder<T>> {
if (isCreator) {
if (widget.autoRemove && Get.isRegistred<T>()) {
controller.onClose();
// controller.onClose();
controller._allStates.remove(real);
Get.delete<T>();
}
... ...
name: get
description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
version: 2.6.3
version: 2.7.0
homepage: https://github.com/jonataslaw/get
environment:
... ...