Saransh-cpp / BookRentApp-Chapter3

An app where you can rent some books!
12 stars 27 forks source link

Issue 92 weird app behavior #100

Closed mortal-ghost closed 2 years ago

mortal-ghost commented 2 years ago

Program

Issue

Fixes #92

Description

Most of the issues seemed to be created by the _key.currentState.showSnackBar which is replaced by ScaffoldMessenger.of(context).showSnackBar. Issue with confirming an order on dialog was because of the same reason as above but also needed the context of the underlying Scaffold rather than the dialog context which is declared as a new variable. The issues mentioned are resolved, I did not face any other issues.

Type of change

You can write manually also

Checklist:

Saransh-cpp commented 2 years ago

Will review after #95 is merged.

Saransh-cpp commented 2 years ago

@mortal-ghost, please merge the master branch of my repository in this PR

mortal-ghost commented 2 years ago

Thanks, @mortal-ghost! Awesome work! This was a hard-to-spot bug. A few minor changes -

  • There are other SnackBars in product_details.dart that need these changes.
  • You will need to do the same for the Favourite screen (again, just SnackBars and probably the context), plus remove the MaterialApp parent widget from that screen.

I have made the changes. On the product_details.dart, since the snackbar is displayed on the underlying Scaffold, Navigator pops the dialog first before displaying the snackbar. This is inline with the cart checkout.