Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller.success()/failure() not working #1

Closed
divan opened this issue Jul 5, 2022 · 5 comments
Closed

controller.success()/failure() not working #1

divan opened this issue Jul 5, 2022 · 5 comments

Comments

@divan
Copy link

divan commented Jul 5, 2022

Hi, thank you for the beautiful plugin.

I'm trying to use it in the app now, and observing strange behaviour – controller.success() and controller.failure() do not trigger rebuild when controller is in loading mode.

I.e. if in onSlide() I have controller.loading() and then try to do .success() or .failure(), nothing happens. Refreshing (hot refresh) updates the widget to the correct state. controller.reset() works as intended.

Is it something wrong with my code or I'm hitting a bug?

Code example (bascially, a copy-paste from examples):

class SubmitSlider extends StatelessWidget {
  const SubmitSlider({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ActionSlider.standard(
      onSlide: (controller) async {
        controller.loading(); 
        await Future.delayed(const Duration(seconds: 1));
        print('success');
        controller.success(); 
      },
      child: const Text('Submit'),
    );
  }
}

(screencast is cut, as it just spins endlessly)
Jul-05-2022 14-01-28

Some details:

OS: MacOS 12.4
Build: Flutter MacOS

Flutter 3.0.2 • channel stable
Framework • revision cd41fdd495 (4 weeks ago) • 2022-06-08 09:52:13 -0700
Engine • revision f15f824b57
Tools • Dart 2.17.3 • DevTools 2.12.2

action_slider's version: 0.5.0

@maeddin
Copy link
Member

maeddin commented Jul 5, 2022

I'll take a quick look at the error. I'm just wondering because this should happen in all examples.
Thanks for the example provided. 😁

@maeddin maeddin closed this as completed in b6a3c77 Jul 5, 2022
@maeddin maeddin reopened this Jul 5, 2022
@maeddin
Copy link
Member

maeddin commented Jul 5, 2022

@divan When you verify that the bug is gone with the latest commit, I will upload the new version directly to pub.dev :)
You can use the following code in your pubspec.yaml for this purpose:

action_slider:
    git: https://github.com/SplashByte/action_slider.git

@divan
Copy link
Author

divan commented Jul 5, 2022

@MaddinMade thanks for super quick response. I checked it with master and it seems to work perfectly now.

@divan divan closed this as completed Jul 5, 2022
@maeddin
Copy link
Member

maeddin commented Jul 5, 2022

@divan Thanks for opening the issue and reviewing the fix. It always makes me happy to see that my packages are actually used :)
The new release is now published on pub.dev.

@divan
Copy link
Author

divan commented Jul 5, 2022

@MaddinMade yeah, I know what you mean. And I'm planning to check out animated_switch_toggle plugin of yours too, as it looks insanely cool as well.

From the top of my head, couple of thoughts on these plugin:

  • I love that they take away the pain and hassle of figuring out states, best durations and animation curves, while leaving the room for customizability. I value "good default presets" vs "ability to change everything" as 70%/30%. I believe most users would be happy to just copy-paste good battle tested examples, that has the optimal parameters/colors/values.
  • I would absolutely love the promise of compatibility. Very few people do this, but that's one of the biggest pain points for me in development. I know that while plugins are in 0.0.x range, it's kinda expected, but unless it's a really-realy important refactoring or security fix, I'd love to know that dependencies I bring to the project are stable. Meaning the code is not broken just because month or two ha passed.

Thanks again for great plugin. Keep doing great stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants