menu
joshmrallen
Do 2 to 4 hours of coding per day Star this Commitment
Week 10 of 10

joshmrallen commits to:
Do 2 to 4 hours of coding per day. Choose a project to finish or code labs to complete. Document and share finals results. If I run out of code labs or can't think of a project, then I'll purchase another intensive/pro course and continue.
10
0
No more reports due
Details
My Commitment Journal
joshmrallen
joshmrallen
November 22, 2018, 5:20 AM
We spent most of this evening talking about baby names and also about the future. Didn’t get to this tonight.
joshmrallen
joshmrallen
November 21, 2018, 11:27 PM
I'm back. It's been difficult, but I'll stick to this as best I can. The below is for 11/20 evening:

"Adding Separate Methods for specific widgets."

Next best practice: move things out of the build method and into helper methods of that widget.

Already doing this in the products.dart file -- the _buildProductList() method helps us outsource things so the build method is leaner.

Up to you how you prefer to organize code, but it's good practice not to write infinitely long build methods.

the build method in the product_create page is very long. The TextFields, for example, could be put into a separate method.

Add a new method to _ProductCreatePageState called _buildTitleTextField() which contains the code for the title TextField

The new method might be slightly more than the original block of code, only because you're adding a method name and return statement around the block, but the build method is learner, more efficient.

Make another new method for the description text field, called _buildDescriptionTextField(). Paste the code block within it.

Call each of these methods within the build method. In this case, we'll put it where we used to have the code blocks for each TextField().

Same thing for the Price -- making a new method, calling it _buildPriceTextField() and cut/pasting the code block for the price TextField().

Next thing is the RaisedButton. We'll keep it here, but the code block for onPressed inside of it is too much logic for a build method.

It's not good practice to have that much logic in your build method. Creating a new method, keeping the build method UI focused.

Making the new method: _submitForm() using the void datatype because it doesn't return. Delete the extra curly braces and empty parenthesis.

assign _submitForm to onPressed. Not calling an instance, but referencing the function. This will execute the function when clicked/tapped.

I like this. This makes sense. It's so organized.

Next: "Optimizing Your Project"

optimizing code on the auth page by doing what we did in the last lecture: making methods by removing logic from the build method.

You should name your methods in a way that you and your fellow developers understand

Taking the image code block, pasting in the new method and calling it where the block used to be.

adding a new method for the email text field and calling it in the build method also.

doing the same for the password TextField()

repeating for switchlisttile

for the button, like previously, take the onPressed logic, put it into a void function, then call the reference in onPressed

Remember, just use the reference, not the execution instance, so that Flutter can execute it at the right time

verify that the switch still works

now for the row in the product.dart page's build method

making a separate Widget within this class "ProductPage," called, _buildAddressPriceRow() -- same thing, but/paste, call method within build

Looking at products_admin page. Take the drawer out of the build method. Could make as separate widget to also use in products page

But for a sidedrawer you'd need a solution for replacing the icon, the text, and the link

For now, we're outsourcing the sidedrawer in a method: Widget _buildSideDrawer, returning the block for the sidedrawer

this method needs to be like the build method and accept an argument with BuildContext context because of the pushReplacement

When we call it in the actual build method, we need to pass context: _buildSideDrawer(context)

Doing a similar "outsourcing" but for the separate sidedrawer that we created in the build method of the products.dart page.

Let's outsource the Container for the card in product_card

Outsourcing the ButtonBar now

Need to pass BuildContext context for this as well. When we call it, we'll need to pass 'context': _buildActionButtons(context)

checking if everything's working now

Woo! That was fun. I love organizing! Everything's so much conciser now.

Stickk.com is down at the moment. I'll make the post in the morning.
joshmrallen
joshmrallen
November 17, 2018, 8:21 PM
Unwilling to admit defeat due to a recent change in priorities (pregnancy). I still don’t want to say I necessarily failed. I’m still thinking about programming on a daily basis and ideas for the future I can incorporate my new programming skills to achieve.
joshmrallen
joshmrallen
November 15, 2018, 3:07 AM
Ok, this has been a bad week. I’ve been spending most of my free time either sleeping or working on pregnancy prep again. I’ll be redesigning this commitment to work with my pregnancy prep. Spent the last few nights going over my wife’s insurance with her to make sure we know exactly what’s covered.

I also have something else to confess: I’m going to visit my grandmother for her 95th birthday, but because I need to take my work computer with me, I don’t have room for my own computer and won’t be able to work on coding 😭

I’ll be back on Tuesday 11/20, and I’ll try to find time to do it then. Perhaps I can find a way to do more on that day? Anyways, this week is bust 😭
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
  • Sep 22, 2018
Displaying 1-4 of 10 results.
November 16 to November 23
Successful (referee feedback expired)
Success
No report submitted
November 9 to November 16
Successful
Success
Success

MEGA
MEGA
- Referee approval report
I'm reporting success assuming you'll catch up with it.
joshmrallen
joshmrallen
- Committed user success report
November 3 to November 9
Successful
Success
Success

MEGA
MEGA
- Referee approval report
joshmrallen
joshmrallen
- Committed user success report
October 27 to November 3
Successful
Success
Success

MEGA
MEGA
- Referee approval report
Again, I'm reporting success because I know you're going through big changes in your life., However, I really think you should find a way to simplify this so you can make daily or almost daily progress and keep improving.
joshmrallen
joshmrallen
- Committed user success report
Recipient of Stakes
Anti-charity (Abortion: Americans United for Life)
To change the Recipient of Stakes for your Do 2 to 4 hours of coding per day Commitment, enter their email address or stickK username below.
Total at stake: $50.00
Stakes per period: $5.00
Remaining Stakes: $0.00
Total Money Lost: $0.00
Referee
Supporters
.
+
Server IP 10.0.0.224
Portal Id 0
User Id 0
Unix Timestamp 1734978720
Current Timezone GMT
Server encoding: utf-8
Assets folder: https://static.stickk.com/yii-assets/209680c5
Payment Type PRODUCTION
Your feedback has been sent. Thank you!
This website uses cookies to ensure you get the best experience on our website. Read our Privacy Policy
Loading...