W9 - Forms-HandlingLarge Datasets - Handling Multiple UIs
W9 - Forms-HandlingLarge Datasets - Handling Multiple UIs
Week 9
Chapter 5 – Multi-Screen UIs (Navigators & Routes)
&
Chapter 6 – Basic State Management
Book: Flutter Cookbook -
Over 100 proven techniques and solutions for app
development with Flutter 2.2 and Dart
Dr. Yasir Faheem
Associate Professor, NUST-SEECS
https://www.yasirfaheem.com/ 1
Disclaimer
These lecture slides have been prepared using the content available on the official websites of
Dart, Flutter, and other online resources.
Primarily, this lecture has been prepared from Chapters numbered 5 & 6 of the textbook titled,
“Flutter Cookbook Over 100 proven techniques and solutions for app development with Flutter 2.2
and Dart” by Harrington
All the copyrights are reserved with the original content creators.
2
Recap
3
Today’s Lecture
4
Part A
5
Handling large datasets with list builders
6
Replace ListView widget with its varian ListView.builder
7
ScrollViews can get too big,
Let us make listView.builder scroll to the bottom of the list everytime the lap button is tapped
8
Run the App – Checkpoint 2
9
How ListView.builder handles large datasets?
10
How ListView.builder handles large datasets?
Flutter continuously calls the ItemBuilder function with the appropriate index.
When widgets move off the screen, Flutter removes them from the tree, freeing up precious
memory.
We are only going to need the same fixed number of visible entries at a time.
11
Working with TextFields
Let’s create a login form for our stopwatch app so that we know which runner we're timing.
12
login_screen.dart
LoginScreen
13
login_screen.dart
14
login_screen.dart
15
login_screen.dart
16
login_screen.dart
17
login_screen.dart
18
login_screen.dart
19
login_screen.dart
20
login_screen.dart
`
Navigator also keeps a full history of your routes so that you can return to the previous screens
easily.
22
Navigating to the next screen
23
Navigating to the next screen
24
Navigating to the next screen
25
Navigating to the next screen
26
Navigating to the next screen
27
How it Works?
28
How Navigator Works?
29
How MaterialPageRoute Works?
This object will create a platform-aware transition between the two screens.
On iOS, it will push onto the screen from right.
On Android, it will pop onto the screen from the bottom.
30
How MaterialPageRoute Works?
31
Invoking navigation routes by name
We simply invoke them as if we were just going to another page on a website.
32
Invoking navigation routes by name
33
Invoking navigation routes by name
34
How Routes work?
35
How Routes work?
36
How Routes work?
37
Conclusion
38