GithubHelp home page GithubHelp logo

Comments (12)

Darren-FanDemand avatar Darren-FanDemand commented on September 26, 2024 8

Just to add to these voices, handleSlideIsOpenChanged still doesn't work. Perhaps this issue should be re-opened.

from flutter_slidable.

marcelser avatar marcelser commented on September 26, 2024 5

Actually the usage instructions don't work neither the ones you provided here nor the slightly more extensive ones in the documentation where it states

final SlidableController slidableController = SlidableController(
  onSlideAnimationChanged: handleSlideAnimationChanged,
  onSlideIsOpenChanged: handleSlideIsOpenChanged,
  );
...
  void handleSlideAnimationChanged(Animation<double> slideAnimation) {
    setState(() {
      _rotationAnimation = slideAnimation;
    });
  }

  void handleSlideIsOpenChanged(bool isOpen) {
    setState(() {
      _fabColor = isOpen ? Colors.green : Colors.blue;
    });
  }

the problem is that handleSlideAnimationChanged and handleSlideIsOpenChanged need to be static methods in the SlidableController Initializer and when you make them static of course you cannot use setState() anymore which makes it impossible to update the screen (or any widget)

Please provide working example of this. It would be greatly appreciated as I'm trying to implement it currently but I'm stuck here completely.

from flutter_slidable.

arpitjacob avatar arpitjacob commented on September 26, 2024 2

Hi I am looking for a solution to this as well tried to follow the instructions but the code doesn't seem to work.

from flutter_slidable.

letsar avatar letsar commented on September 26, 2024 1

Hi @juliovedovatto

There is nothing for this right now, but I can implement something in the controller I think.

from flutter_slidable.

MarsGoatz avatar MarsGoatz commented on September 26, 2024 1

onSlideIsOpenChanged is being triggered if I provide onSlideAnimationChanged. So for now as a workaround, I am providing a dummy onSlideAnimationChanged.

from flutter_slidable.

letsar avatar letsar commented on September 26, 2024

I can do something great with a callback that takes an animation (look at the FAB):
slide_callback
Do you think it will be good for you?

from flutter_slidable.

juliovedovatto avatar juliovedovatto commented on September 26, 2024

@letsar that would be great

Well, I just need a callback event when the slide event init and when it ends.

Something like to fire a callback when translate starts and when it finishes. Like this js lib does https://github.com/mango/slideout#events (example)

The slideout emits translatestart, translate and translateend events only when it is opening/closing via touch events.

from flutter_slidable.

letsar avatar letsar commented on September 26, 2024

Hi @juliovedovatto

I don't want to add a lot of callbacks, but I added another one to be notified when the active Slidable is open or closed.

I pushed this on this branch: https://github.com/letsar/flutter_slidable/tree/feature/35_slide_callbacks can you tell me if it's ok for you?

To use this, you need to the the onSlideIsOpenChanged callback on the SlidableController. This callback can be used like this:

  void handleSlideIsOpenChanged(bool isOpen) {
    setState(() {
      _fabColor = isOpen ? Colors.green : Colors.blue;
    });
  } 

from flutter_slidable.

letsar avatar letsar commented on September 26, 2024

Published in version 0.4.8

from flutter_slidable.

lane-faison avatar lane-faison commented on September 26, 2024

@letsar , the Slidable widget is still in an active state if you slide it open and then slide it closed without lifting your finger. Can you update the package to call .close() when isOpen (handleSlideIsOpenChanged(bool isOpen)... is changed to false?

from flutter_slidable.

letsar avatar letsar commented on September 26, 2024

@lane-faison The package has completely be rewritten, can you test it in the preview version to see if it's still occurs?

from flutter_slidable.

adnanjpg avatar adnanjpg commented on September 26, 2024

Hi, what's the status on this?

from flutter_slidable.

Related Issues (20)

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.