hackslash-nitp / cura

An application, made with Flutter, that acts as a platform for the charity institutions (old-age-homes, orphanages) to connect with the people
7 stars 15 forks source link

Bug in Bottom Navigation Bar #49

Closed shazebK closed 2 years ago

shazebK commented 2 years ago

Current page get pushed on itself on clicking that page icon in Bottom Navigation bar, thus clicking back button does opens up the previous page, this is a bug and need fixing. I can fix this bug So I request you to assign this issue to me.

https://user-images.githubusercontent.com/106864146/195773640-fe257f6e-4297-4695-92ce-6f72ef39e61d.mp4

RitwikSingh28 commented 2 years ago

This seems a genuine bug. :thinking: Please let me know how you are going to fix this bug, before I assign it to you.

shazebK commented 2 years ago

I am thinking if , In navigation-bar.dart we can check if index of page does not matches with the current page index then only we have to push that page.

RitwikSingh28 commented 2 years ago

Yes, that seems a plausible fix to me. Although we also have to consider one scenario, say the user navigates from home to post_feed, then to chat screen, then profile screen, and again clicks on chat_screen. We are pushing new widgets again and again onto the stack, which compromises the performance of the app. I was wondering if we should solve this issue alongside as well, what do you think?

shazebK commented 2 years ago

Yes you are right.

shazebK commented 2 years ago

What if clicking on back button it directly takes us to homepage only.

shazebK commented 2 years ago

Because we already have bottom navigation bar to navigate to required pages,

RitwikSingh28 commented 2 years ago

Yes, that would be ideal. And when the different icon is clicked, we use pushReplacement to navigate. We will need to take care of the home screen though, because that should not be replaced. For that case, we may use simple push() to put the next page on top of the home-screen

RitwikSingh28 commented 2 years ago

I guess, we will have to use popUntil() for going back to Home page, when the back button is pressed.

shazebK commented 2 years ago

Yeah works fine with me.

RitwikSingh28 commented 2 years ago

Okay, so with the bug being properly discussed, and an idea formulated, I am assigning this issue to you to resolve.

shazebK commented 2 years ago

Ok I will keep these things in mind.

RitwikSingh28 commented 2 years ago

As per the documentation, popUntil() requires the route name, and since we haven't yet implemented Named Routing in our application, this won't be possible as of now. So, we'll deal with that in an upcoming issue. For now, please try to fix the bug the way we had initially discussed.

shazebK commented 2 years ago

Yes we can use pushReplacement and directly pushing the home page on pressing the back button