Book Image

Learning Dart

Book Image

Learning Dart

Overview of this book

Table of Contents (19 chapters)
Learning Dart
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Spiral 5 – changing and updating data


Now that we have our bank account back on screen, we add an input field with ID #number (and of type number) that captures the amount of money that we want to deposit or withdraw from our account. We add a button "Deposit-Withdrawal" to initiate that action, and also a button "Add interest" to calculate and add interest to our account. Our screen now looks like the following screenshot:

Changing data screen

Note

For code files of this section, refer to chapter 6\bank_terminal_s5 in the code bundle.

Here is the code of bank_terminal_s5.dart (declarations are left out for brevity):

void main() {
  bind_elements();       (1)
  attach_event_handlers();     (2)
  disable_transactions(true);  (3)
}
bind_elements() {
  owner = query('#owner');
  balance = query('#balance');
  number = query('#number');
  btn_other = query('#btn_other');
  amount = query('#amount');
  btn_deposit = query('#btn_deposit');
  btn_interest = query('#btn_interest');
  error = query(...