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

make friction properly slow down the drag, #54

Closed
wants to merge 3 commits into from

Conversation

micimize
Copy link
Collaborator

@micimize micimize commented Dec 24, 2019

closes #53

Additionally, adds an AnimationPadding padding argument to the controller to allow for clamping the animation values. I'm honestly not 100% sure if it's the best solution for preventing the "fling off screen" issue, but it works fairly well with a MEDIUM stiffness:

      springDescription: SpringDescription.withDampingRatio(
        mass: 1,
        stiffness: Stiffness.MEDIUM,
        ratio: DampingRatio.LOW_BOUNCY,
      ),

lib/src/bottom_sheet.dart Show resolved Hide resolved
lib/src/animation_controller.dart Outdated Show resolved Hide resolved
lib/src/animation_controller.dart Show resolved Hide resolved
@micimize
Copy link
Collaborator Author

micimize commented Feb 5, 2020

@mcrovero Ok - added a AnimationPadding.none() option and made null topandbottomarguments default to+/- double.infinity`.

AnimationPadding.none() seems to result in package:flutter/src/widgets/basic.dart': Failed assertion: line 2300 pos 15: 'heightFactor == null || heightFactor >= 0.0': is not true. when flung to the bottom, so the more useful option is AnimationPadding(bottom: 0), which only pads the bottom of the screen.

@mcrovero
Copy link
Owner

mcrovero commented Jun 4, 2020

Sorry for the late response, been overwhelmed lately. I think it's perfect!
I've just seen this error popping out in the logs when flinging the bottomsheet to the bottom

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building AnimatedBuilder(animation:
flutter: RubberAnimationController#7b608(▶ -0.029), dirty, state: _AnimatedState#939e9):
flutter: 'package:flutter/src/widgets/basic.dart': Failed assertion: line 2310 pos 15: 'heightFactor == null
flutter: || heightFactor >= 0.0': is not true.
flutter:
flutter: The relevant error-causing widget was:
flutter: AnimatedBuilder
flutter: file:///Users/mattiacrovero/Desktop/Projects/Flutter/Rubber/rubber/lib/src/bottom_sheet.dart:175:14
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 new FractionallySizedBox (package:flutter/src/widgets/basic.dart:2310:15)
flutter: #3 RubberBottomSheetState._buildAnimatedBottomsheetWidget (package:rubber/src/bottom_sheet.dart:151:12)
flutter: #4 RubberBottomSheetState._buildSlideAnimation (package:rubber/src/bottom_sheet.dart:137:16)
flutter: #5 AnimatedBuilder.build (package:flutter/src/widgets/transitions.dart:1124:19)

micimize added a commit to micimize/rubber that referenced this pull request Mar 20, 2021
@micimize
Copy link
Collaborator Author

closed in favor of #66

@micimize micimize closed this Mar 20, 2021
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

Successfully merging this pull request may close these issues.

dragFriction is reversed
2 participants