Jonny Borges
Committed by GitHub

Bump to new Flutter version

## [2.0.10]
- Bump new Flutter version
- Added Get.generalDialog
## [2.0.6]
- Fix typo on readme
## [2.0.5]
- Changing the bottomsheet API to comply with the documentation.
## [2.0.4]
- Fix type not found in some versions of Flutter stable
## [2.0.3]
- Update Docs
... ...
... ... @@ -24,11 +24,12 @@ This library that will change the way you work with the Framework and save your
## How to use?
- Flutter Master/Dev/Beta: version 2.0.x-dev
<!-- - Flutter Master/Dev/Beta: version 2.0.x-dev
- Flutter Stable branch: version 2.0.x
(look for latest version on pub.dev)
(look for latest version on pub.dev) -->
Add Get to your pubspec.yaml file according to the version of Flutter you are using.
Add Get to your pubspec.yaml file
<!-- according to the version of Flutter you are using. -->
Exchange your MaterialApp for GetMaterialApp and enjoy!
```dart
... ... @@ -103,7 +104,7 @@ navigator.push(
),
);
// Get syntax (It is much better, but you have the right to disagree)
// Get sintax (It is much better, but you have the right to disagree)
Get.to(HomePage());
... ... @@ -206,6 +207,11 @@ To open default dialog:
onPressed: () => Get.back(),
));
```
You can also use Get.generalDialog instead of showGeneralDialog.
For all other Flutter dialog widgets, including cupertinos, you can use Get.overlayContext instead of context, and open it anywhere in your code.
For widgets that don't use Overlay, you can use Get.context.
These two contexts will work in 99% of cases to replace the context of your UI, except for cases where inheritedWidget is used without a navigation context.
### BottomSheets
Get.bottomSheet is like showModalBottomSheet, but don't need of context.
... ... @@ -480,6 +486,10 @@ void main() {
initialRoute: '/',
namedRoutes: {
'/': GetRoute(page: MyHomePage()),
/// Important! :user is not a new route, it is just a parameter
/// specification. Do not use '/second/:user' and '/second'
/// if you need new route to user, use '/second/user/:user'
/// if '/second' is a route.
'/second/:user': GetRoute(page: Second()), // receive ID
'/third': GetRoute(page: Third(),transition: Transition.cupertino);
},
... ...
... ... @@ -194,12 +194,12 @@ class Get {
Widget child, {
bool barrierDismissible = true,
bool useRootNavigator = true,
RouteSettings routeSettings,
// RouteSettings routeSettings
}) {
return showDialog(
barrierDismissible: barrierDismissible,
useRootNavigator: useRootNavigator,
routeSettings: routeSettings,
routeSettings: RouteSettings(name: 'dialog'),
context: overlayContext,
builder: (_) {
return child;
... ... @@ -207,6 +207,31 @@ class Get {
);
}
/// Api from showGeneralDialog with no context
static Future<T> generalDialog<T>({
@required RoutePageBuilder pageBuilder,
bool barrierDismissible,
String barrierLabel,
Color barrierColor,
Duration transitionDuration,
RouteTransitionsBuilder transitionBuilder,
bool useRootNavigator = true,
RouteSettings routeSettings,
// RouteSettings routeSettings
}) {
return showGeneralDialog(
pageBuilder: pageBuilder,
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
useRootNavigator: useRootNavigator,
routeSettings: RouteSettings(name: 'dialog'),
context: overlayContext,
);
}
static Future<T> defaultDialog<T>(
{String title = "Alert dialog",
Widget content,
... ... @@ -219,8 +244,8 @@ class Get {
));
}
static Future<T> bottomSheet<T>({
@required WidgetBuilder builder,
static Future<T> bottomSheet<T>(
Widget bottomsheet, {
Color backgroundColor,
double elevation,
ShapeBorder shape,
... ... @@ -232,14 +257,14 @@ class Get {
bool isDismissible = true,
bool enableDrag = true,
}) {
assert(builder != null);
assert(bottomsheet != null);
assert(isScrollControlled != null);
assert(useRootNavigator != null);
assert(isDismissible != null);
assert(enableDrag != null);
return navigator.push<T>(GetModalBottomSheetRoute<T>(
builder: builder,
builder: (_) => bottomsheet,
theme: Theme.of(Get.key.currentContext, shadowThemeOnly: true),
isScrollControlled: isScrollControlled,
barrierLabel: MaterialLocalizations.of(Get.key.currentContext)
... ... @@ -399,10 +424,16 @@ class Get {
return _singl[T];
}
static bool reset() {
_singl.clear();
return true;
}
/// Delete a singleton instance of your class
static bool delete<T>(T singleton) {
if (!_singl.containsKey(T)) {
throw 'key id not found';
print('key id not found');
return false;
}
_singl.removeWhere((oldkey, value) => (oldkey == T));
return true;
... ...
... ... @@ -34,7 +34,7 @@ class GetMaterialApp extends StatefulWidget {
this.shortcuts,
this.routingCallback,
this.defaultTransition,
this.actions,
// this.actions,
this.opaqueRoute,
this.enableLog,
this.popGesture,
... ... @@ -79,7 +79,7 @@ class GetMaterialApp extends StatefulWidget {
final bool showSemanticsDebugger;
final bool debugShowCheckedModeBanner;
final Map<LogicalKeySet, Intent> shortcuts;
final Map<LocalKey, ActionFactory> actions;
// final Map<LocalKey, ActionFactory> actions;
final bool debugShowMaterialGrid;
final Function(Routing) routingCallback;
final Transition defaultTransition;
... ... @@ -118,7 +118,15 @@ class _GetMaterialAppState extends State<GetMaterialApp> {
Route<dynamic> namedRoutesGenerate(RouteSettings settings) {
Get.setSettings(settings);
final parsedString = parse.split(settings.name);
// final parsedString = parse.split(settings.name);
/// onGenerateRoute to FlutterWeb is Broken on Dev/Master. This is a temporary
/// workaround until they fix it, because the problem is with the 'Flutter engine',
/// which changes the initial route for an empty String, not the main Flutter,
/// so only Team can fix it.
final parsedString = parse.split(
settings.name == '' ? (widget.initialRoute ?? '/') : settings.name);
String settingsname = parsedString.route;
Map<String, GetRoute> newNamedRoutes = {};
... ... @@ -196,7 +204,7 @@ class _GetMaterialAppState extends State<GetMaterialApp> {
showSemanticsDebugger: widget.showSemanticsDebugger ?? false,
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner ?? true,
shortcuts: widget.shortcuts,
actions: widget.actions,
// actions: widget.actions,
);
}
}
... ...
... ... @@ -29,7 +29,15 @@ class Routing {
class GetObserver extends NavigatorObserver {
final Function(Routing) routing;
GetObserver([this.routing]);
Route<dynamic> route;
bool isBack;
bool isSnackbar;
bool isBottomSheet;
bool isDialog;
@override
void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
if ('${route?.settings?.name}' == 'snackbar') {
... ... @@ -42,6 +50,10 @@ class GetObserver extends NavigatorObserver {
if (Get.isLogEnable) print("[GOING TO ROUTE] ${route?.settings?.name}");
}
isSnackbar = '${route?.settings?.name}' == 'snackbar';
isDialog = '${route?.settings?.name}' == 'dialog';
isBottomSheet = '${route?.settings?.name}' == 'bottomsheet';
final routeSend = Routing(
removed: null,
isBack: false,
... ... @@ -50,9 +62,9 @@ class GetObserver extends NavigatorObserver {
previous: '${previousRoute?.settings?.name}',
args: route?.settings?.arguments,
previousArgs: previousRoute?.settings?.arguments,
isSnackbar: '${route?.settings?.name}' == 'snackbar',
isDialog: '${route?.settings?.name}' == 'dialog',
isBottomSheet: '${route?.settings?.name}' == 'bottomsheet',
isSnackbar: isSnackbar,
isDialog: isDialog,
isBottomSheet: isBottomSheet,
);
if (routing != null) {
routing(routeSend);
... ... @@ -77,6 +89,10 @@ class GetObserver extends NavigatorObserver {
if (Get.isLogEnable) print("[BACK ROUTE] ${route?.settings?.name}");
}
isSnackbar = false;
isDialog = false;
isBottomSheet = false;
final routeSend = Routing(
removed: null,
isBack: true,
... ... @@ -102,6 +118,10 @@ class GetObserver extends NavigatorObserver {
if (Get.isLogEnable) print("[REPLACE ROUTE] ${oldRoute?.settings?.name}");
if (Get.isLogEnable) print("[NEW ROUTE] ${newRoute?.settings?.name}");
isSnackbar = false;
isDialog = false;
isBottomSheet = false;
final routeSend = Routing(
removed: null, // add '${oldRoute?.settings?.name}' or remain null ???
isBack: false,
... ... @@ -109,9 +129,9 @@ class GetObserver extends NavigatorObserver {
current: '${newRoute?.settings?.name}',
previous: '${oldRoute?.settings?.name}',
args: newRoute?.settings?.arguments,
isSnackbar: null,
isBottomSheet: null,
isDialog: null,
isSnackbar: false,
isBottomSheet: false,
isDialog: false,
previousArgs: null);
if (routing != null) {
... ... @@ -130,10 +150,9 @@ class GetObserver extends NavigatorObserver {
route: previousRoute,
current: '${previousRoute?.settings?.name}',
removed: '${route?.settings?.name}',
previous: null,
isSnackbar: null,
isBottomSheet: null,
isDialog: null,
isSnackbar: isSnackbar,
isBottomSheet: isBottomSheet,
isDialog: isDialog,
args: previousRoute?.settings?.arguments,
previousArgs: route?.settings?.arguments);
... ...
... ... @@ -23,10 +23,10 @@ class GetBuilder<T extends GetController> extends StatefulWidget {
final bool autoRemove;
final void Function(State state) initState, dispose, didChangeDependencies;
final void Function(GetBuilder oldWidget, State state) didUpdateWidget;
final T controller;
final T init;
GetBuilder({
Key key,
this.controller,
this.init,
this.global = true,
this.builder,
this.autoRemove = true,
... ... @@ -34,7 +34,7 @@ class GetBuilder<T extends GetController> extends StatefulWidget {
this.dispose,
this.didChangeDependencies,
this.didUpdateWidget,
}) : assert(builder != null, controller != null),
}) : assert(builder != null),
super(key: key);
@override
_GetBuilderState<T> createState() => _GetBuilderState<T>();
... ... @@ -49,12 +49,12 @@ class _GetBuilderState<T extends GetController> extends State<GetBuilder<T>> {
if (Get.isRegistred<T>()) {
controller = Get.find<T>();
} else {
controller = widget.controller;
controller = widget.init;
controller._allStates[controller] = this;
Get.put(controller);
}
} else {
controller = widget.controller;
controller = widget.init;
controller._allStates[controller] = this;
}
if (widget.initState != null) widget.initState(this);
... ... @@ -62,15 +62,15 @@ class _GetBuilderState<T extends GetController> extends State<GetBuilder<T>> {
@override
void dispose() {
if (controller != null) {
if (widget.init != null) {
var b = controller;
if (b._allStates[controller].hashCode == this.hashCode) {
b._allStates.remove(controller);
}
}
if (widget.dispose != null) widget.dispose(this);
if (widget.autoRemove && Get.isRegistred<T>()) {
Get.delete(controller);
if (widget.autoRemove && Get.isRegistred<T>() && (widget.init != null)) {
Get.delete(widget.init);
}
super.dispose();
}
... ...
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
... ... @@ -36,27 +22,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
collection:
clock:
dependency: transitive
description:
name: collection
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
convert:
version: "1.0.1"
collection:
dependency: transitive
description:
name: convert
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.14.12"
fake_async:
dependency: transitive
description:
name: crypto
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -67,13 +53,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
matcher:
dependency: transitive
description:
... ... @@ -94,21 +73,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -170,12 +135,5 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
... ...
name: get
description: Navigate between screens, display snackbars, dialogs and bottomSheets, from anywhere in your code without context with Get.
version: 2.0.0-dev
version: 2.0.10
homepage: https://github.com/jonataslaw/get
environment:
... ...