-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Confusion regarding a line of code #1089
Comments
The piece of code written over is perfect. If you see the custom alert dialog there are two buttons one for the positive response and the other for a negative so on a negative response the dialog should pop definitely whereas when there is some more logic to be added like after the negative response if something has to be done in the caller state than the secondaryButtonTap function is needed to be called with the logic to close the dialog. |
Let me know if your doubt is cleared if so please close the issue or we can discuss more on slack |
Yeah I get that, and that's why I asked where in the file is secondaryButtonTap called ? Nowhere I guess. So I thought this was it's place (for obvious reasons). And about syntax, I wrote just a pseudo-code, like if secondaryButtonTap is defined, call it, otherwise pop. That's not dart, I know. :) So the question remains, where is secondaryButtonTap supposed to be called ? |
If someone can help in this, I have to write tests for this file. |
using this would be a more prone method since this will require not to write the dialog closing logic making it less robust. If there needs to be a logic or a negative response and the method is passed for the same then closing logic should also be handled explicitly. |
So what's the solution ? The method needs to be called somewhere (which isn't being done). Or it doesn't ? |
if the function is passed than dialog closing logic should be handled explicitly in the method passed else is the method isn't passed then nothing needs to be done. |
there is no change needed. |
Okay. Fine. |
* test: testing for all cls-hooked functions * tests for requestContext done
While writing test for custom_alert_dialog.dart, I came across a piece of code which I think might me wrong.
widgets/custom_alert_dialog.dart -> line 31
![code](https://user-images.githubusercontent.com/62198564/147636877-ce157ea0-83cb-4b30-8c5a-38ba0aab047a.png)
I think it should execute secondaryButtonTap.
So the code should be onTap: () => secondaryButtonTap(): navigationService.pop()
Or am I missing something ? Please clarify.
The text was updated successfully, but these errors were encountered: