Closed Sadeesha-Sath closed 3 years ago
Very nice !
Hey I just noticed that I made a small mistake in this PR. Nothing breaking of course.
But some asserts are in the body of the constructor of Dialog Transition Class. Here they won't get executed. We should move them to the initializer(after the ':'). And change 'transitionType' to 'transition'. Can you change this in a future commit? It seems too minor to submit another PR tbh.
Just learned that asserts cannot be executed in constructor body. ✌ Couldn't check it as dartpad doesn't support asserts yet. Sorry. I'm still learning.
@Skyost
@Sadeesha-Sath Yeah sure. I was planning to test everything and to make a release during next week anyway :wink:
Well, the assert
s give me an error with the dart analyzer. I think they're invalid for some reason.
A fix would be to either change them or completely get rid of them. I prefer the second solution because the parameters would be silently ignored (and that's all, no need to throw an error or something).
I wrote them so people won't be able to change startoffset
or alignment
without the transition they are supported. So the same goes for trying them with transition: TransitionType.none
. So that users would not feel like the arguments are not working. Maybe you're right. It is better to silently ignore them. They have the property documentation after all.
But I don't see why they would fail though
But I don't see why they would fail though
Same but my analyzer keeps giving me errors when used in constant constructors.
Maybe it's because you are using const constructors. The constructor cannot be const because we change transitionType
to TransitionType.custom
in the initializer when the user only passes customTransitionBuilder
. Since the transitionType
defaults to none
and the function checks for transitionType
before customTransitionBuilder
, we have to change it to custom before the test. Maybe you can remove the check from initializer and it move to both showDialog functions before the check for transitionType
happens. Then we can define the constructor as const.
Declared a dedicated [DialogTransition] class for transitions as discussed in #102
@Skyost