-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[Tour of Beam] [Frontend] Delete account, GitHub auth, solution warning #25347
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
Conversation
| onContinue: () { | ||
| authNotifier.deleteAccount().then( | ||
| (_) { | ||
| Navigator.pop(context); | ||
| }, | ||
| ); | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- async / await.
- Show progress?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Linter is against using context in async functions.
- Do you mean showing an overlaying loading animation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Oh, by the way this is just the same problem, but the linter cannot spot it. One solution is to let the dialog close itself by passing a callback to
onContinue, but this is ugly. Try to think of better ideas. Also this is exactly why in app_state we have states pushing themselves out without a context. - Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplest solution is to first pop the dialog and then to delete the account.
| showDialog( | ||
| context: context, | ||
| builder: (context) => Dialog( | ||
| backgroundColor: Colors.transparent, | ||
| child: BeamAlertDialog( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code.
BeamAlertDialog.show(context, ...); ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved Dialog into BeamAlertDialog, because future users of the widget might not know about the
Future<void> show(BuildContext context) async {
await showDialog(
context: context,
builder: build,
);
}
function and use showDialog.
| this.body, | ||
| required this.continueLabel, | ||
| required this.onContinue, | ||
| required this.title, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put required parameters first.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| final String? body; | |
| final String? text; |
?
| onPressed: () { | ||
| Navigator.pop(context); | ||
| }, | ||
| // TODO(nausharipov): review: translate in PGC? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have easy_localization there already and slowly migrating strings there.
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of these two files is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted /popups.
| required BuildContext context, | ||
| required PublicNotifier closeNotifier, | ||
| required Positioned positioned, | ||
| bool isDismissible = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current users of overlay (LoginButton and Avatar) expect it to be dismissible. Also, it is consistent with showDialog's bool barrierDismissible = true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename it to barrierDismissible then?
I would prefer this to be required though because there is actually no good reason to prefer one over another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the function to showOverlay and the parameter to barrierDismissible for consistency, still assuming that true is the preferable setting.
| required this.close, | ||
| required this.child, | ||
| required this.isDismissible, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort.
| final VoidCallback close; | ||
| final Positioned child; | ||
| final bool isDismissible; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort.
| // TODO(nausharipov) review: add label? | ||
| // TODO(nausharipov) review: add grey-ish background? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- No.
- Yes.
alexeyinkin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (internal review).
|
Switching between assignment and solution is done in #25298. |
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
|
|
||
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamAlertDialog extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you comment what this Widget does and why it exists? It's somewhat obvious that it is a general purpose dialog Widget but it would be helpful to others needing to change it in the future at least one sentence describing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the widget.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment that (I'm assuming) test lands in the body of the dialog widget? Why is it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed text to subtitle. It is optional, because some dialogs might not need body text.
|
|
||
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? text; | ||
| final String continueLabel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does continueLabel do? Can you add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the parameter.
| final String? text; | ||
| final String continueLabel; | ||
| final VoidCallback onContinue; | ||
| final String title; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a character limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapped the dialog content in SingleChildScrollView to avoid overflow.
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? text; | ||
| final String continueLabel; | ||
| final VoidCallback onContinue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment perhaps that the route is popped, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the parameter.
|
|
||
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamOverlays { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that it is plural stages future types of overlay widgets? Could you comment on the purpose of this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamOverlays { | ||
| static Future<void> showProgressOverlay( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming the purpose of this is to simply overlay a CircularProgressIndicator? Could you add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
damondouglas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olehborysevych Are you able to update the tour of beam readme backend instructions so I can review this as an actual running application?
| import 'package:flutter/material.dart'; | ||
|
|
||
| import '../../../playground_components.dart'; | ||
| class ProgressDialog extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the comment from the overlay.
Resolves #25255
Resolves #25116
Resolves #25284
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.