Coder Social home page Coder Social logo

jonataslaw / getx Goto Github PK

View Code? Open in Web Editor NEW
9.8K 134.0 1.6K 33.29 MB

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.

License: MIT License

Dart 93.97% Kotlin 0.02% Swift 0.14% Objective-C 0.08% HTML 0.45% CMake 2.06% C++ 2.95% C 0.17% Java 0.06% Shell 0.10%
getx dependency-injection flutter state-management routes internationalization framework mobile web dart

getx's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getx's Issues

Issue with cupertino route

Flutter version v 1.15.22

Get lib version 1.16.1-dev

Hi!

Running Xcode build...

Compiler message:
../../../.pub-cache/hosted/pub.dartlang.org/get-1.16.1-dev/lib/src/routes/default_route.dart:240:9: Error: No named parameter with the name 'primaryRouteAnimation'.
        primaryRouteAnimation: animation,
        ^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/cupertino/route.dart:425:3: Context: Found this candidate, but the arguments don't match.
  CupertinoFullscreenDialogTransition({
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Xcode build done.                                           40.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:2:
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:328:19: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param sharedStyle
     ~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:25: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param allowTapToDismiss
     ~~~~~~~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: warning: parameter 'allowTapToDismiss' not found in the function declaration [-Wdocumentation]
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: note: did you mean 'tapToDismissEnabled'?
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
            tapToDismissEnabled
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param queueEnabled
     ~~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:19:23: warning: unused variable 'viewController' [-Wunused-variable]
        UIViewController *viewController =
                          ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:70:21: warning: unused variable 'topPadding' [-Wunused-variable]
                CGFloat topPadding = window.safeAreaInsets.top;
                        ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:71:21: warning: unused variable 'bottomPadding' [-Wunused-variable]
                CGFloat bottomPadding = window.safeAreaInsets.bottom;
                        ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:48:19: warning: unused variable 'size' [-Wunused-variable]
            NSNumber *size = call.arguments[@"size"];
                      ^
    8 warnings generated.

    Compiler message:
    ../../../.pub-cache/hosted/pub.dartlang.org/get-1.16.1-dev/lib/src/routes/default_route.dart:240:9: Error: No named parameter with the name 'primaryRouteAnimation'.
            primaryRouteAnimation: animation,
            ^^^^^^^^^^^^^^^^^^^^^
    ../../flutter/packages/flutter/lib/src/cupertino/route.dart:425:3: Context: Found this candidate, but the arguments don't match.
      CupertinoFullscreenDialogTransition({
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    build failed.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

[✓] Flutter (Channel unknown, v1.15.22, on Mac OS X 10.14.5 18F132, locale en-RU)
    • Flutter version 1.15.22
    • Framework revision 1606d87834 (5 weeks ago), 2020-03-16 00:36:01 -0400
    • Engine revision 6801b4dae7
    • Dart version 2.8.0 (build 2.8.0-dev.14.0 7079c49b05)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
 
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.0.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

but on get lib 1.15.2

i have that issue

Compiler message:
../../../.pub-cache/hosted/pub.dartlang.org/get-1.15.2/lib/src/snackbar/snack_route.dart:279:8: Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
../../flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
  void install() {
       ^
Automatically signing iOS for device deployment using specified development team in Xcode project: LYX986LPZU
Running Xcode build...
../../../.pub-cache/hosted/pub.dartlang.org/get-1.15.2/lib/src/snackbar/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Xcode build done.                                           40.4s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-04-17 17:51:55.405 xcodebuild[47675:355165]  DTDeviceKit: deviceType from 608b39e0b917088594c74ed7c89a7d3dca9cc4dc was NULL
    2020-04-17 17:51:55.573 xcodebuild[47675:355167]  DTDeviceKit: deviceType from 608b39e0b917088594c74ed7c89a7d3dca9cc4dc was NULL
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:2:
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:328:19: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param sharedStyle
     ~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:25: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param allowTapToDismiss
     ~~~~~~~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: warning: parameter 'allowTapToDismiss' not found in the function declaration [-Wdocumentation]
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: note: did you mean 'tapToDismissEnabled'?
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
            tapToDismissEnabled
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param queueEnabled
     ~~~~~~~~~~~~~~~~~~^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:19:23: warning: unused variable 'viewController' [-Wunused-variable]
        UIViewController *viewController =
                          ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:70:21: warning: unused variable 'topPadding' [-Wunused-variable]
                CGFloat topPadding = window.safeAreaInsets.top;
                        ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:71:21: warning: unused variable 'bottomPadding' [-Wunused-variable]
                CGFloat bottomPadding = window.safeAreaInsets.bottom;
                        ^
    /Users/devel/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:48:19: warning: unused variable 'size' [-Wunused-variable]
            NSNumber *size = call.arguments[@"size"];
                      ^
    8 warnings generated.

    Compiler message:
    ../../../.pub-cache/hosted/pub.dartlang.org/get-1.15.2/lib/src/snackbar/snack_route.dart:279:8: Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
      void install(OverlayEntry insertionPoint) {
           ^
    ../../flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
      void install() {
           ^
    ../../../.pub-cache/hosted/pub.dartlang.org/get-1.15.2/lib/src/snackbar/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
    Try removing the extra positional arguments.
        super.install(insertionPoint);
                     ^
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    build failed.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning build
    note: Constructing build description


What problem it can be?

Very big thanks for any answering!

Transition bug?

When I call Get.to(..., transition.fade)

I see the off transition on the previous page rightToLeft with fade (but it will be fade OUT ONLY)

Any way to create a Transition.Nothing? (and/or transitionIn/transitionOut?)

I need to handle the in and out animations too.

Thanks

Scaffold's drawer opening is not added to navigation stack

I don't know if this is intended, but opening a Scaffold's drawer doesn't add to the navigation stack, while Flutter default navigation does.

Navigator.pop(context) // closes the drawer in Flutter navigation
Get.back() // ignores the drawer in Get navigation

on master channel even on ^1.12.0-dev version when add this package to pubspec.yaml i got below error but stable channel works well

Compiler message:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.11.1/lib/src/snack_route.dart:279:8: Error: The method
'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
void install(OverlayEntry insertionPoint) {
^
/C:/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').
void install() {
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.11.1/lib/src/snack_route.dart:289:18: Error: Too many positionalarguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
super.install(insertionPoint);
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.11.1/lib/src/getroute_cupertino.dart:232:9: Error: No named
parameter with the name 'animation'.
animation: animation,
^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments
don't match.
CupertinoFullscreenDialogTransition({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem was found with the configuration of task ':app:compileFlutterBuildDebug'.

Cannot write to file 'C:\flutter' specified for property 'outputFiles' as it is a directory.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4.5s
Exception: Gradle task assembleDebug failed with exit code 1

Compile error

using get: ^1.11.6

As soon as I include import 'package:get/get.dart'; on my main.dart file

I get this error during compile:

Compiler message:
../../../.pub-cache/hosted/pub.dartlang.org/get-1.11.6/lib/src/snackbar/snack_route.dart:279:8: Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
../../../flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
  void install() {
       ^
../../../.pub-cache/hosted/pub.dartlang.org/get-1.11.6/lib/src/snackbar/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^

This is my main.dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rpm/models/state.dart';
import 'package:provider/provider.dart';
import 'routes.dart';

void main() => runApp(ChangeNotifierProvider(
      create: (context) => StateModel(),
      child: MyApp(),
    ));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      initialRoute: '/',
      routes: routes,
    );
  }
}

how to pass params?

i need help to pass params for another page.

Get.toNamed('/view_folder', {title:'page name'} )

[HELP] Example of event listening inside the screen widget

Sorry to be bugging so much... can you tell I'm new to flutter?

I was able to implement the middleware to observer every time a screen gets pushed or popped. But I don't understand how to use that to actually perform something on the screen itself. For instance, I want to refresh data from an API every time a screen is either pushed or popped.

I have this in my Middleware

class MiddleWare {
  static observer(Routing routing) {
    print(routing.current);
  }
}

And I do get the name of the screen when I expect it to appear. But how do I call the method on that screen?

Thank you!

[PROPOSAL] middleware capabilities

I think it would be great if we could pass some kind of middleware to be executed on every page transition for example. The motivation is to be able to for examplo log to the console which route you are going to.

Is there a way to check which one is the current route?

I have a navigation bar when I call Get.toNamed(routeName) whenever I tap on a button.

But I'd like to prevent that call when the currentRoute is the same as routeName.

Couldn't find a way to get the current route name except from within the middleware. Would be nice to get an accesor to the current route from Get directly, like Get.currentRoute or something

Transition.material?

The default transition seems to be fade.

  • Are there plans to support the default material transition?
  • Or does it have a different transition name?

Duration of transition for Get.to()

Can I globally change time of fade transition? In GetRoute is parameter duration, but I don't know how used it without changes in library code. Is it possible?

Get.back() with Get or Get.snackbar

First I want to thank you for this amazing lib!

I want to know if there is a way to not dismiss the "GetBar" when we do a "Get.back()" or the user press the back button.

I'm struggling with this because I have a Firebase Messaging Service running on the background, e some times the user can receive a notification on the screen with a Snackbar. And i really want to use your implementation, my life would be much easier. But when the user presses the back button or i use "Get.back", the "GetBar" is dismissed.

Is there a way to prevent this behavior?

Will you implement showSearch?

I'm currently using your package to completely separate my UI from all the logic and I want to use the search delegate, but it needs the context to be called. Are you planning to implement this feature?

Custom transitions/animations

First I want to thank you for the effort to bring us this amazing library, it's really time saving!

I want to know if is it possible to add custom transitions/animations both to Get.to and Get.dialog. I saw some parameters in getroute.dart but I couldn't find a way to do it.

If it's not present, is it possible to add this feature? I think that this is the only thing that is preventing me to use it for all my navigations and dialogs as I have custom transitions almost everywhere.

Throwing error on Flutter build

Get was working perfectly for both Android and iOS but now my app will no compile. Getting the following error when debugging or flutter build...

I have tested with dev and master flutter branches.

UPDATE:
still have this issue after:
flutter clean
flutter pub cache repair
Tested with get: ^1.7.3 and get: ^1.7.4
Removed get and app compiles.
The issue started randomly. Not aware of any updates that could have triggered this.

Compiler message:
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/get-1.7.4/lib/src/snack_route.dart:279:8: 
Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
/C:/dev/flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
  void install() {
       ^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/get-1.7.4/lib/src/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.                                                           

FAILURE: Build failed with an exception.

* Where:
Script 'C:\dev\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 817

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'C:\dev\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      19.5s
Gradle task assembleRelease failed with exit code 1

Context: This is the overridden method ('install').

after adding get, i get this message, from macos build


Compiler message:

../../../../../.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:279:8: Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.

  void install(OverlayEntry insertionPoint) {

       ^

../../../../../development/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').

  void install() {

       ^
Running pod install...                                              1.5s
../../../../../.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/routes/default_route.dart:242:9: Error: No named parameter with the name 'animation'.
        animation: animation,
        ^^^^^^^^^
../../../../../development/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments don't match.
  CupertinoFullscreenDialogTransition({
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Building macOS application...
[INFO:persistent_cache.cc(338)] PersistentCache::UpdateAssetPath: /Users/softmarshmallow/Documents/Apps/inked/inked-flutter/inked/build/macos/Build/Products/Debug/inked.app/Contents/Frameworks/App.framework/Resources/flutter_assets
flutter: started application..

Get.bottomSheet show/hide keyboard triggers rebuild

I have a Get.bottomSheet(builder: (_) {

And some textfield in it

When the keyboard is show/hide on this fields then the widget is rebuild... How can I fix this?
I don't want to rebuild the widget in that case.

Thanks

Using Get.until while avoiding closing a Snackbar

So I have a use case which I'm having a hard time implementing correctly.

In my app, in order to create a user, I need to go through 2 screens. So after you are done, I want to get back to the first screen while also showing a Snackbar.

So currently I have this:

    Get.snackbar(
      'Patient ${patient.fullName}',
      'Successfully added',
      backgroundColor: CustomColors.statusGoodColor(),
      colorText: Colors.white,
    );
    Get.until(Routes.PatientsPatient, (Route route) {
      setState(() {
        isCreatingPatient = false;
      });
      return route.settings.name == Routes.PatientsPatient;
    });
  }

That is crashing my app with this exception RangeError (index): Invalid value: Valid value range is empty: -1

It probably has something to do with the fact that Get.back also closes the snackbar. But I can't figure out how to leave the snackbar while going to the first screen in the first place.

I tried opening the snackbar after the Get.until, but the same crash occurs.

Any help?

Thanks!

Prevent dialog from appearing on top of another dialog

I'm currently displaying a dialog when my API throws an error.

The problem I'm running into is that I'm making mulitple calls at the same time, and sometimes I get multiple errors, so I end up with getting multiple dialogs open at the same time.

Is there a way to prevent this? Or is there a way to figure out if there is currently a dialog open? So I can check for that before displaying the dialog.

Get.back() doesn't work from an async function

I have a page that will perform a HTTP Post when a button is pressed. That button will call an async function to perform the actual HTTP Post which could take a second or two. When I get a success or failure back I'm attempting to navigate back to the previous page, but it doesn't do anything.

No error was reported, it just fails silently.

I found a work around, just call the Get.back() function inside the button event:
onPressed: () {saveClicked(); Get.back();},

Flutter Version:
Flutter 1.12.13+hotfix.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f139b11009 (3 weeks ago) • 2020-03-30 13:57:30 -0700
Engine • revision af51afceb8
Tools • Dart 2.7.2

Get Version:
get: ^1.17.2

Describe on which device you found the bug:
Samsung Galaxy S8

[Proposal] Optional debugging messages

It looks like you are currently printing debug messages (at least on the RouteObserver).
Can you make it an optional setting to be able to turn it off?

Thanks!

Cupertino Routes

The built-in cupertino routes match the feel of native ios transitions, including the ability to navigate back with a gesture. Have you gotten these to work with Get? I found this in the documentation:

and if you need custom transitions, use PageRouteBuilder by adding the parameter 'opaque = false' to maintain compatibility with the library.

but this didn't work for me. I was hoping I could use CupertinoPageRoute.buildPageTransitions, but got a NPE:

This is my code:

final getRoute = GetRoute(
      settings: settings,
      page: Builder(builder: builder),
      opaque: false,
    );
    return PageRouteBuilder(
      settings: settings,
      pageBuilder: (context, animation, secondary) {
        return builder(context);
      },
      fullscreenDialog: fullscreenDialog,
      opaque: true,
      transitionsBuilder:
          (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
        return CupertinoPageRoute.buildPageTransitions(getRoute, context, animation, secondaryAnimation, child);
      },
    );

This is the error I got:

final getRoute = GetRoute(
      settings: settings,
      page: Builder(builder: builder),
      opaque: false,
    );
    return PageRouteBuilder(
      settings: settings,
      pageBuilder: (context, animation, secondary) {
        return builder(context);
      },
      fullscreenDialog: fullscreenDialog,
      opaque: false,
      transitionsBuilder:
          (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
        return CupertinoPageRoute.buildPageTransitions(getRoute, context, animation, secondaryAnimation, child);
      },
    );

Flutter 1.13.6

No support for nested Navigators?

Just curious how you see this working in apps where I have multiple views containing tab bars, or a desktop style app that has sidemenu that pushes views to the content area in the right, but still wants to show fullscreen dialogs over the entire app.

Seems like this would be more flexible if it had the ability to have the root navigator, but also a context based lookup.

NestedNavigator(key: Get.getKey(context))

Get.to(SomeNestedPage(), context)

Unhandled Exception: type 'Transition' is not a subtype of type 'bool'

When i use this version in master channel show this error and not show next page.

pubspec.yml:

get: ^1.14.0-dev

Screen:

Screenshot

Code:
Get.to(FirstLoginScreen(),transition: Transition.fade,duration: Duration(milliseconds: 100));


Flutter doctor:

[√] Flutter (Channel master, v1.18.1-pre.3, on Microsoft Windows [Version 10.0.17134.1365], locale en-US)
    • Flutter version 1.18.1-pre.3 at D:\java\flutter\flutter
    • Framework revision e3e189219b (19 hours ago), 2020-04-06 14:31:38 -0700
    • Engine revision df257e59c2
    • Dart version 2.8.0 (build 2.8.0-dev.20.0 1210d27678)


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at E:\Android\sdk
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = E:\Android\sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] IntelliJ IDEA Community Edition (version 2018.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.4
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215

[√] VS Code, 64-bit edition (version 1.28.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.21.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.0 (API 24) (emulator)

• No issues found!


Error:

ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'Transition' is not a subtype of type 'bool'
E/flutter (25785): #0      Get.to (package:get/src/get_main.dart:59:32)
E/flutter (25785): #1      _SplashScreenState.goToNextPage.<anonymous closure> (package:amack_v4_backend/ui/screens/splash_screen.dart:57:9)
E/flutter (25785): #2      _rootRun (dart:async/zone.dart:1180:38)
E/flutter (25785): #3      _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (25785): #4      _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (25785): #5      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter (25785): #6      _rootRun (dart:async/zone.dart:1184:13)
E/flutter (25785): #7      _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (25785): #8      _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1003:23)
E/flutter (25785): #9      Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
E/flutter (25785): #10     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (25785): #11     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (25785): #12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter (25785): 

Undefined name 'Transition'

Screen Shot 2020-03-04 at 16 08 42

Hi @jonataslaw. Great library!
There's this one thing. Could you help me with how to set the transition type, because the IDE (vscode) cannot find the class Transition?

dependencies:
get: ^1.11.0

Thank you!

Keyboard or focusNode

Is there any way to use nextFocus without a context? Because when my TextField in a widget that is opened via Get my keyboard is going to be crazy from this line:

onSubmitted: (_) => FocusScope.of(context).nextFocus(), // move focus to next
),

[Question] Parallel routes auto redirect

Hi, I'm quite new to flutter world and I've been trying something to implement automatic route redirect based on current authentication state. I haven't found material about that and most of them is to have manual implementation that in a authenticated route keep listening if was unauthenticated, and then navigate back.

Then I got more or less the result that I was looking applying something that I used in RN and Native projects, but I wonder if there is any suggested way to do so.

                          -> HomePage -> SettingsPage
App -> AuthenticationPage  
                          -> LoginPage -> RegisterPage

When user login on LoginPage, it would navigate automatically to HomePage
When user logout on SettingsPage, it would navigate automatically to LoginPage

class AuthenticationPage extends StatefulWidget {
  const AuthenticationPage({Key key}) : super(key: key);

  @override
  _AuthenticationPageState createState() => _AuthenticationPageState();
}

class _AuthenticationPageState extends ModularState<AuthenticationPage, AuthenticationController> {
  @override
  void initState() {
    super.initState();
    // addPostFrameCallback is documented to be triggered only once, then listener is discarded
    WidgetsBinding.instance.addPostFrameCallback((_) => autorun((_) => _onRegisterNavigation()));
  }

  void _onRegisterNavigation() {
    final AuthenticationState authenticationState = controller.authenticationState;
    if (authenticationState is AuthenticatedAuthenticationState) {
      Get.offNamedUntil("/home", ModalRoute.withName(Modular.initialRoute)).then((_) => _onHandleRouteReturn());
    } else if (authenticationState is UnauthenticatedAuthenticationState) {
      Get.offNamedUntil("/login", ModalRoute.withName(Modular.initialRoute)).then((_) => _onHandleRouteReturn());
    } else {
      throw UnimplementedError("Not supported $authenticationState");
    }
  }

  void _onHandleRouteReturn() {
    if (!Get.key.currentState.canPop()) {
      SystemNavigator.pop();
    }
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 0,
      height: 0,
      color: Theme.of(context).backgroundColor,
    );
  }
}

Are there plans to support cupertino?

Is your feature request related to a problem? Please describe.
Currently this package only supports material apps. I see ThemeData and MaterialLocalizations being used.

Describe the solution you'd like
Check the platform before using things like ThemeData.

Describe alternatives you've considered
The solution will probably find all the occurrences of material dependencies and add a platform check there.

Get Snackbar causes an exception in scheduler library

Describe the bug
A clear and concise description of what the bug is.
Hi, many thanks for your work !

Unfortunately, while trying to use your Snackbar after an API Call, it raises an exception
image
I am simply calling it like the documentation said:
Capture d’écran 2020-04-21 à 11 26 03
I've tried to add a blank ThemeData in my MaterialApp Widget but with no success.
Have I done something wrong here ?

Flutter Version:
Enter the version of the Flutter you are using
Flutter 1.12.13+hotfix.9

Get Version:
Enter the version of the Get you are using
get: ^1.17.0

Describe on which device you found the bug:
Nexus 5X

Erro ao acessar Get.arguments

Antes de tudo, parabéns pela Lib!
Precisei recentemente abrir um snackbar, mas tive dificuldade excessiva pra realizar uma "tarefa tão simples", e acabei vindo experimentar o Get, que se mostrou bem prático nesse e em todos os outros quesitos de navegação, mas agora estou tendo dificuldades com a passagem de parâmetros com rotas nomeadas em um projeto de estudo.

Acredito que o codigo que fiz esteja conforme foi exemplificado na documentação.

Describe the bug
Tento navegar com Get.toNamed passando um argumento, na tela de destino, ao acessar Get.arguments uma Exceção é lançada.

Erro:

The getter 'args' was called on null.
Receiver: null
Tried calling: args

To Reproduce
Steps to reproduce the behavior:

  1. Clique em um dos items listados na GridView.

Expected behavior
Acessar o valor enviado via arguments no widget/tela de destino.

Flutter Version:
environment:
sdk: ">=2.1.0 <3.0.0"
Flutter 1.12.13+hotfix.9

Get Version:
get: ^1.17.3

Describe on which device you found the bug:
ex: AVD com SDK 21 - Android 5.1.1.

Minimal reproduce code
`import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() => runApp(MyApp());

class Routes {
static const PRODUCT_DETAIL = '/product-detail';
}

class Router {
static Route generateRoute(RouteSettings settings) {
switch (settings.name) {
case '/':
return GetRoute(
settings: settings,
page: ProductsOverviewScreen(),
);
case Routes.PRODUCT_DETAIL:
return GetRoute(
settings: settings,
page: ProductDetailsScreen(),
);
default:
return GetRoute(
settings: settings,
page: Scaffold(
body: Center(child: Text('No route defined for ${settings.name}')),
),
);
}
}
}

class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: Get.key,
title: 'Minha Loja',
theme: ThemeData(
primarySwatch: Colors.purple,
accentColor: Colors.deepOrange,
),
initialRoute: '/',
onGenerateRoute: Router.generateRoute,
);
}
}

class ProductsOverviewScreen extends StatelessWidget {
final List items = ['item 1', 'item 2'];

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'Minha loja',
),
),
body: Padding(
padding: const EdgeInsets.all(10.0),
child: GridView.builder(
itemCount: items.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 3 / 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
),
itemBuilder: (context, i) {
return InkWell(
onTap: () {
Get.toNamed(Routes.PRODUCT_DETAIL, arguments: items[i]);
},
child: Text(
items[i],
),
);
}),
),
);
}
}

class ProductDetailsScreen extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
print('antes');
print(Get.arguments);
print('depois');

return Scaffold(
  appBar: AppBar(
    title: Text(Get.arguments),
  ),
);

}
}
`

Error in build after Flutter update on 4.2.2020

After I ran flutter update, Im unable to build my app.

Compiler message:
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/get-1.7.4/lib/src/snack_route.dart:279:8: Error: The method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
void install(OverlayEntry insertionPoint) {
^
/C:/Flutter/SDK/flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
void install() {
^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/get-1.7.4/lib/src/snack_route.dart:289:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
super.install(insertionPoint);
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\Flutter\SDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 803

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\Flutter\SDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 19s
Finished with error: Gradle task assembleDebug failed with exit code 1

[Question] Support for web?

This looks promising to me! Just wondering how this works with web navigation? The /#/ in all web URL's currently is frustrating to deal with. Also does this pair nicely with animated routes?

I'm going to check these things out shortly as well :)

bottomSheet is always rebuild

I have a

Get.bottomSheet(
isScrollControlled: true,
builder: (_) => MySheetWidget(title));

MySheetWidget is a statefulwidget

When i move the sheet top/bottom the build method always triggering

GetRoute Duration doesn't seem to work

I'm trying to use custom transitions on named routes:

class Router {
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case Routes.PriorityHome:
        return GetRoute(
          settings: settings,
          page: PriorityHomeScreen(),
          duration: Duration(milliseconds: 0),
        );
      case Routes.PriorityPatient:
        return GetRoute(
          settings: settings,
          page: PriorityPatientScreen(),
          duration: Duration(milliseconds: 0),
        );
      default:
        return GetRoute(
          settings: settings,
          transition: Transition.fade,
          page: Scaffold(
            body: Center(
              child: Text('No route defined for ${settings.name}'),
            ),
          ),
        );
    }
  }
}

My expectation is for no animation to occur (since milliseconds is 0), but it is still happening.
Changing the value to other values (higher than the default 400 for example) doesn't change anything either

[Feature request] Get dialougue with return

@jonataslaw
Can I do this same like this using any widget of get.defaultdialogue, get.snackbar or getBar

               bool shouldUpdate = await showDialog(
                  context: this.context,
                  child:new AlertDialog(
                    content: new FlatButton(
                      child: new Text("update home"),
                      onPressed: () => Navigator.pop(context, true),
                    ),
                  ),
                );
                setState(() {
                  shouldUpdate ? this._homeData = "updated" : null;
                });

Snackbar doesn't show up until touch screen

I want to show snackbar on firebase notification arrived.
I have this:

    Get.snackbar(
      "Notif",
      data['data']['notification_title'],
      shouldIconPulse: true,
      barBlur: 20,
      isDismissible: true,
      duration: Duration(seconds: 3),
      backgroundColor: ColorPalette.primary,
      snackPosition: SnackPosition.BOTTOM,
      margin: EdgeInsets.only(bottom: 10.0, left: 15.0, right: 15.0),
      colorText: Colors.white,
    );

but snackbar show up only user touch or scroll screen.

Rebuild last page

Hi,
first of all thank you very much for your great work on this package.
I'm using your package to improve the performance of my app by getting rid of the unnecessary build calls after several page switches.
Unfortunately, this also has the consequence that the page to which you switch when the back button is pressed is not reloaded.

E.g. if we got the following path: A --> B --> C. If the user goes back from C to B, B is not reloaded.
Is it possible to add a parameter in the configuration of Get() so that only the last page is reloaded if the user presses the back button?

Bottom sheet

Is it shows bottom sheet without context?
If not can you add??

Flutter Test

First at all very good job, it is a nice plugin. This is not really an issue but I am trying to test a logic service, and this calls to "Get.offNamed", but I could not find a way to mock it or get around it in order to pass my test. Sorry if this is not the best way to ask about this and thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.