mcrovero / rubber

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

Getting current state of rubber #36

Closed pishguy closed 5 years ago

pishguy commented 5 years ago

how can i get state of this library when trigger collapsed, expanded?

pishguy commented 5 years ago

@guillaumeprevost did you have this issue?

yasfdany commented 5 years ago

@MahdiPishguy you can get state from RubberAnimationController that is animationState.value, it will return AnimationState.expanded or AnimationState.collapsed

pishguy commented 5 years ago

@yasfdany thanks, i have

_controller = RubberAnimationController(
    vsync: this,
    lowerBoundValue: AnimationControllerValue(pixel: 0.0),
    springDescription: SpringDescription.withDampingRatio(
        mass: 1.5, stiffness: Stiffness.MEDIUM, 
        ratio: DampingRatio.HIGH_BOUNCY),
    duration: Duration(milliseconds: 100));

now how can i use your code?

i get warning for this below code

if (_controller.status == AnimationState.expanded) {
  print('aaa');
}
yasfdany commented 5 years ago

@MahdiPishguy you can use

if (_controller.animationState.value == AnimationState.expanded) { print('aaa'); }

pishguy commented 5 years ago

@yasfdany thanks a lot, problem solved

pishguy commented 5 years ago

@yasfdany do you know how can i change height of rubber?

pishguy commented 5 years ago

@yasfdany do you know how can i change height of rubber?

@MahdiPishguy you can use

if (_controller.animationState.value == AnimationState.expanded) { print('aaa'); }

when i try to collapse rubber, it doesn't have any animation, do you know how can i resolve that?

guillaumeprevost commented 5 years ago

Hey, sorry I've missed out on this thread! I haven't experienced this. Hope you problem has been solved @MahdiPishguy !

pishguy commented 5 years ago

@guillaumeprevost thank you very much, yes, problem resolved :)