-
Notifications
You must be signed in to change notification settings - Fork 0
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
[SCRUM-6] Implement profile page ui #2
base: main
Are you sure you want to change the base?
Conversation
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.
Overall, really well done. The major comment would be on code style but you seemed to have a made a lot of progress with understanding and using Flutter, particularly with the variety of widgets you were able to find and use.
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( |
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.
Generally, it is always preferable to use SafeArea
widget. For our purposes, we will use it for all our pages so that we don't get unexpected parts of our page being blocked by notches and whatnot.
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SafeArea( |
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.
One fine detail is that SafeArea
is typically placed inside the Scaffold
. See Flutter docs on this
final String firstName = firstNameController.text.trim(); | ||
final String lastName = lastNameController.text.trim(); | ||
|
||
if (firstName.isEmpty || lastName.isEmpty) { |
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.
Hmm, not sure if this is the best way to show the error -- especially b/c the SnackBar appears behind the dialog (greyed out).
You should look into error messages built into Form
. You might want to talk to Ziad about this -- I think he used it in his implementation.
context.go('/home'); | ||
}, | ||
), | ||
title: Text('Profile'), |
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.
Flutter code by default is deeply nested and is often hard to read. We mitigate this by using widget builder functions (like you with your _buildXXX functions). For simpler sub-widgets, we typically just have a final XXX = ...
where XXX
is a variable name describing a sub-widget and ...
is the widget definition. You should apply this pattern the sub-widgets you marked with comments such as // Profile Picture
, or // User Name
.
My general rule-of-thumb is to decompose a single page into sub-widgets and to define either _buildXXX
or final XXX
sub-widgets. After this, in the build
method return statement, I compose all the sub-widgets using layout widgets like Scaffold/Column/Row/Container/Stack/ListView and many more. The idea is to separate sub-widget definition from the code that lays out all the sub-widgets into the final page.
); | ||
} | ||
|
||
void _showEditProfileDialog(BuildContext 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.
Same comment to the effect of code nesting.
You should identify the sub-widgets and use helper build functions or final
variables to help reduce nesting in the code.
made a boilerplate profile page, few buttons, edit profile, possible settings button.
made an empty home page for debugging/navigation between pages