ajomuch92/flutter-scrolling-fab-animated

allow custom scroll behaviour

Closed this issue · 0 comments

for example in the gmail app if i recall correctly when you scroll up some distance the fab expands, example code:

_scrollController.addListener(() {
  var position = _scrollController.position.pixels;
  old_position = old_position ?? position;
  var diff =  position - old_position;
  if ( diff > widget.limitIndicator! &&
          _scrollController.position.userScrollDirection ==
              ScrollDirection.reverse) {
        setState(() {
          _endTween = widget.inverted! ? 100 : 0;
          old_position = position;
        });
      } else if (diff <= widget.limitIndicator! &&
          _scrollController.position.userScrollDirection ==
              ScrollDirection.forward) {
        setState(() {
          _endTween = widget.inverted! ? 0 : 100;
          old_position = position;
        });
      }
    });

not sure of the code to be honest, just an idea