Do action handling

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.

The Give up and Complete actions are also very similar to the previous ones. Please check out the attached source files to see how they look.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.190.167