[Tour of Beam] [Frontend] Delete account, GitHub auth, solution warning#25347
[Tour of Beam] [Frontend] Delete account, GitHub auth, solution warning#25347nausharipov wants to merge 23 commits intoapache:masterfrom
Conversation
| onContinue: () { | ||
| authNotifier.deleteAccount().then( | ||
| (_) { | ||
| Navigator.pop(context); | ||
| }, | ||
| ); | ||
| }, |
There was a problem hiding this comment.
- async / await.
- Show progress?
There was a problem hiding this comment.
- Linter is against using context in async functions.
- Do you mean showing an overlaying loading animation?
There was a problem hiding this comment.
- 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.
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.
Duplicate code.
BeamAlertDialog.show(context, ...); ?
There was a problem hiding this comment.
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.
Put required parameters first.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? body; |
There was a problem hiding this comment.
| final String? body; | |
| final String? text; |
?
| onPressed: () { | ||
| Navigator.pop(context); | ||
| }, | ||
| // TODO(nausharipov): review: translate in PGC? |
There was a problem hiding this comment.
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.
Which of these two files is used?
There was a problem hiding this comment.
Deleted /popups.
| required BuildContext context, | ||
| required PublicNotifier closeNotifier, | ||
| required Positioned positioned, | ||
| bool isDismissible = true, |
There was a problem hiding this comment.
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.
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.
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, |
| final VoidCallback close; | ||
| final Positioned child; | ||
| final bool isDismissible; |
| // TODO(nausharipov) review: add label? | ||
| // TODO(nausharipov) review: add grey-ish background? |
alexeyinkin
left a comment
There was a problem hiding this comment.
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.
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.
Renamed the widget.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamAlertDialog extends StatelessWidget { | ||
| final String? text; |
There was a problem hiding this comment.
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.
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.
What does continueLabel do? Can you add a comment?
There was a problem hiding this comment.
Renamed the parameter.
| final String? text; | ||
| final String continueLabel; | ||
| final VoidCallback onContinue; | ||
| final String title; |
There was a problem hiding this comment.
Is there a character limit?
There was a problem hiding this comment.
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.
Comment perhaps that the route is popped, etc.
There was a problem hiding this comment.
Renamed the parameter.
|
|
||
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamOverlays { |
There was a problem hiding this comment.
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.
Added a comment.
| import '../../../playground_components.dart'; | ||
|
|
||
| class BeamOverlays { | ||
| static Future<void> showProgressOverlay( |
There was a problem hiding this comment.
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.
Added a comment.
damondouglas
left a comment
There was a problem hiding this comment.
@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.
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.