September 2019
Beginner
512 pages
12h 52m
English
This is how the "Do" button looks after using the preceding technique:
FlatButton( child: Text("Do"), onPressed: () { FavorsPageState.of(context).acceptToDo(favor); }, )
And the corresponding acceptToDo(favor) method is done as follows:
void acceptToDo(Favor favor) { setState(() { pendingAnswerFavors.remove(favor); acceptedFavors.add(favor.copyWith(accepted: true)); });}
As you can see, it is almost the same as the refuseToDo() method; the only differences are in the target list and accepted status.
Read now
Unlock full access