SEC S20W3 - Exploring User Inputs, Gesture Detection, Navigation, and Bottom Sheets in Flutter

in #flutterdev-s20w32 months ago (edited)

steemit-engagement-challenge-cover.jpeg

Greetings Steemit friends

Design a simple form with a TextField where users can enter their name and a Button to submit the form. Use TextEditingController to retrieve the text from the TextField and display it on the screen when the button is pressed.

I followed the example of the course to carry out this task. It was not complicated to understand, but was very challenging using the virtual devices to run task one.

Screenshot 2024-09-26 084001-we-3-1a.jpg

Screenshot 2024-09-26 084001-we-3-1b.jpg

Screenshot 2024-09-26 084001-we-3-1c.jpg

Screenshot 2024-09-26 084001-we-3-1d.jpg

Screenshot 2024-09-26 084001-we-3-1e.jpg

Screenshot 2024-09-26 084001-we-3-1f.jpg

Screenshot 2024-09-26 084001-we-3-1g.jpg

Create multiple screens and navigate between them. Design two screens—HomeScreen and DetailsScreen. Use Navigator.push() to navigate from the HomeScreen to the DetailsScreen when a button is pressed.

Here, I will be working with two pages. I will make use of the navigator.push to navigate to a new screen and back to the main screen.

For each feature, I will always love to create a new file. That way I know I'm not tampering with any function that has to do something else. The file structure is not different, so I will create two new files MyHomeScreen and MyDetailsScreen.

Screenshot 2024-09-26 084001-we-3-2a.jpg

Screenshot 2024-09-26 084001-we-3-2b.jpg

In the MyHomeScreen file, I make use of the ElevatedButton Widget with the Navigator.push.

Screenshot 2024-09-26 084001-we-3-2c.jpg

Screenshot 2024-09-26 084001-we-3-2d.jpg

On the MyDetailsScreen file, the only change we have on the ElevatedButton is with the Navigator. It has changed from push to pop and doesn't hold any MaterialPageRoute widget.

Screenshot 2024-09-26 084001-we-3-2e.jpg

Screenshot 2024-09-26 084001-we-3-2f.jpg

Screenshot 2024-09-26 084001-we-3-2g.jpg


Implement a bottom sheet pop up. On the screen add a button to navigate from that screen to the bottom sheet. And add some data to display on the bottom sheet such as name, country, age, gender, etc.

I followed the example of the course to carry out this task.

Screenshot 2024-09-26 084001-we-3-3a.jpg

Screenshot 2024-09-26 084001-we-3-3b.jpg

Screenshot 2024-09-26 084001-we-3-3c.jpg

Screenshot 2024-09-26 084001-we-3-3d.jpg

Screenshot 2024-09-26 084001-we-3-3e.jpg

Screenshot 2024-09-26 084001-we-3-3f.jpg

Screenshot 2024-09-26 084001-we-3-3g.jpg


Develop a simple car loan calculator app where users can input loan details (like the loan amount, interest rate, and loan term) and view the calculated monthly payment on a bottom sheet. The bottom sheet should include the loan amount, interest rate, loan term, and the calculated monthly payment.

Building an application of this complexity will require us to break it down in order to understand what will be needed. The app is expected to calculate the monthly payment, which combines the loan amount, interest rate, and load term.

Let's start with creating the input field for the user to insert the load amount, interest rate, and load term. At the same time, we create the textEditingController to hold the input from the text field. At this point, we can print out input on the console.

Screenshot 2024-09-26 195917-proj-1a.jpg

Screenshot 2024-09-26 195917-proj-1b.jpg

Screenshot 2024-09-26 195917-proj-1c.jpg

Screenshot 2024-09-26 195917-proj-1d.jpg

Now, I move to logic, which is the core of the application. We need the formula to calculate Monthly payments. To be able to calculate the number raised to a power, I needed to import the 'dart:math'; package to handle exponentiation.

Monthly payments = loan Amount * monthly Interest rate / 1-(1+Monthly interest rate) raise to power (total payment).

Monthly interest rate (%) = Annual interest / 100 /12
Total payment = loan Amount *12

So I created the function _calculatemonthlyPayment with all the necessary logic. I started by declaring the necessary variables and data types.

Screenshot 2024-09-26 195917-proj-2a.jpg

Screenshot 2024-09-26 195917-proj-2b.jpg

I move ahead to create the function _showBottomSheet, which will collect the different inputs declared in the variables. Note I created a variable monthlyPayments, which will perform the logic after the necessary inputs have been inputted.

Screenshot 2024-09-26 195917-proj-2c.jpg

Screenshot 2024-09-26 195917-proj-2d.jpg

The showBottomSheet function will return the different input values and the result of the monthlyPayment of the user.

Screenshot 2024-09-26 195917-proj-2e.jpg

Screenshot 2024-09-26 195917-proj-2f.jpg

Screenshot 2024-09-26 195917-proj-2g.jpg



Cheers
Thanks for dropping by
@fombae

Sort:  
Loading...

Upvoted! Thank you for supporting witness @jswit.

TEAM 4

Congratulations! Your post has been upvoted through steemcurator06. Good post here should be..


post1.png

Curated by : @jyoti-thelight

Coin Marketplace

STEEM 0.20
TRX 0.19
JST 0.034
BTC 91364.38
ETH 3131.43
USDT 1.00
SBD 2.93