Book Image

Learning Dart, Second Edition - Second Edition

By : Ivo Balbaert
Book Image

Learning Dart, Second Edition - Second Edition

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Learning Dart Second Edition
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 will add an input field with the #number id (and of the number type) that captures the amount of money we want to deposit or withdraw from our account. We add a Deposit-Withdrawal button to initiate this action, and also an Add interest button to calculate and add interest to our account. Our screen now looks like the following screenshot:

Changing data screen

Note

For the 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 = querySelector('#owner'');
  balance = querySelector ('#balance'');
  number = querySelector ('#number'');
  btn_other = querySelector ('#btn_other'');
  amount...