mcrovero / rubber

An elastic material bottom sheet implementation for Flutter.
BSD 2-Clause "Simplified" License
562 stars 88 forks source link

Future callback is not triggered with animation controller #15

Closed shailesh-mota closed 5 years ago

shailesh-mota commented 5 years ago

Describe the bug First of all, great work with the RubberBottomSheet 👏 Now, I have a List much like in : https://github.com/mcrovero/rubber/blob/master/example/lib/scroll.dart Upon onTap on the ListTile item I want to collapse the bottom sheet and then further do some update on the lowerLayer of the RubberBottomSheet. So I went for something like :

void _listItemTapped(index) {
    print('Collapsing');
    _controller.collapse().whenComplete(() {
      print('Collapsed');
      // Do something here
    });
  }

But I don't see Collapsed being printed at all. What am I missing here ?

Gif

bug

shailesh-mota commented 5 years ago

This is what I was missing :

void _listItemTapped(index) {
      print('Collapsing');
      _controller.collapse().whenCompleteOrCancel(() {
        print('Collapsed');
        // Do something here
      });
  }

Reading through TickerFuture helped to use whenCompleteOrCancel instead of whenComplete.