Xamarin Forms Masterdetail back button navigation with Prism - mvvm

So I have built a Xamarin Forms app with Prism and have a Masterdetail page.
Current flow of the app is
> MasterDetail
> - ContentPage1
> - ContentPage2
> - ContentPage3
All these content names have been added in a formatted Listview in MasterDetail and the click of these listview item is handled is done in the MasterDetailViewModel where based on the item clicked it does a navigation like
_navigationservice.NavigateAsync("MasterdetailPage/"+selectedPage);
So the navigation happens correctly here.
Now if I select another ContentPage from the MasterDetailPage and try going back, all my stack content are gone and the app is just suspended, where as the behaviour I'm looking for should send me back to the previous selected ContentPage with the Masterdetial page.
I'm not sure what can I do other than handling the backbutton in individual ContentPages but thought it would mess up the code really bad.
Any suggestions where I'm going wrong.
Edit: I've also tried adding a NavigationPage before the ContentPage but that did not help.
Thanks.

Related

flutter: best way to implement inner navigation with bottom nav bar

I'm developing a flutter application and I'm now struggling to understand what is the best way to implement a complex bottom bar navigation.
Here are my requirements:
each button on the nav bar should lead to a different section
each section should be able to have multiple screens inside of it
user can navigate from any page of a section to any page in another section and back
each section should show the last visited page if we come back to it
for example, let's say we have two sections, each made of two pages: SectionOneA, SectionOneB, SectionTwoA, SectionTwoB.
A few use cases:
user navigates from SectionOneB to SectionTwoB by pressing a button inside SectionOneB, when user presses back (on android) from SectionTwoB, we should navigate back to SectionOneB
user navigates to SectionTwoA by the nav bar, then navigates to SectionTwoB via a button in SectionTwoA, then navigates to SectionOneA via the nav bar and then press the SectionTwo icon in the nav bar again. we should show SectionTwoB. if back is pressed we should navigate to SectionTwoA.
in both these examples, when moving from one section to another, the correct nav bar item should be highlighted.
I'm new to flutter so I'm learning as I go. For now, what I've done is using nav bar with PageViewer to switch from section to section, then each section uses a PageViewer to handle switching from page to page. This worked well until I had to implement the first usecase above, at this point it seems to me that it would be quite challenging to implment a proper navigation stack as demanded by the usecase and I feel it would be better to rethink the whole thing, only I've no idea what is the best way to approach this.
A temporary solution would be to also include SectionTwoB in the PageViewer of section one, but that would not allow me to highlight the proper nav bar item.
Any lead on how to approach this? All the examples I find seems too simple and/or I'm failing at understanding how to connect the pieces together. I'm using flutter_bloc as a state management library.

Ionic either doesn't show back button or page doesn't load at all

I am trying to create a new page from an existing page with a back button. I have recreated the issue here in a plunkr. In the trip analytics option When I click the first card i.e. Enter Home address. I want the todayDetail .html page to come up with a back button. I have already tried two approaches
First approach The ng-click approach. In which I give $state.go(statename) to give that page. But then I wouldn't get a back button as the navigation stack is changed.
Second approach - If I keep the navigation stack i.e. keep the state name as initial.trips.today.todayDetail. The page doesn't load at all.
What is the issue? How should I go about it?

ionic framework hide ion-tabs on certain tab state

I've been trying to find a solution but I can't find any.
I'll use basic examples so anyone who knows ionic can understand my problem well.
ionic start myApp tabs will create a new project with tabs ready to go.
Those tabs are Dashboard, Chat and Settings.
When you go to the Chat Tab you will then select a person to view its chat content (which directs you to the Chat-Detail Page in actuallity)
I wanted to hide the ion-tabs directive when I go to the chat-detail page so I can force the user to use the Back button instead of clicking anything on the ion-tabs.
Simply put : you will have a hard time doing that. At best it will not look good, IF you succeed to hide using css (I did it, and really, it's not pretty). Basically you would need to define a variable on the parent scope, that changes when entering the chat-detail state, and bind it to ng-class directives on multiple elements (the ion-tabs to hide it, the ion-content to translate it up to cover the area where the tabs were, and add some transition to make it not too brutal).
The logical thing to do would be to have the chat-detail state not being a child of the state containing the tabs. The problem you will have, though, is that there is a huge bug going to / from tabbed state. See details here : https://github.com/driftyco/ionic/issues/2997
At the end of this discussion you can find some posts by Jason and Jerrybels (that would be me), that could lead you on the right way to do it. Basically, you will have to get rid of the ion-tabs directive, and use Ionic's CSS for tabs instead, doing all the states manipulations yourself.
Good luck !
You can use "hidden" attribute of ion-tab like this -
<ion-tab hidden={{condition}}" />
Using this we can show/hide tab.

JFace Wizard hiding and displaying button bar

I am new to JFace Wizard development, so forgive me if my question sounds weird.
I have requirement where my first WizardPage should not display button bar, This I have achieved by extending WizardDialog and implementing createButtonsForButtonBar() method.
Now second wizardpage will load when user do some action on first page(Click button on page). This second wizard page should have button bar. I am not able to show the button bar on second page. I tried exploring JFace code but couldn't find any way to do it.
Can someone confirm whether it is possible or not? If yes, Can you give me some pointers to do it?
Thanks in Advance for you time.

Using back button doesn't clear old content

I'm using gwtp and I have some troubles with the browsers back button.
My DefaultPlace is a login page (root content). If the the login is correct, it directs you to a welcome page (MainPagePresenter) with a menu bar. This menu bar is always visible when going through its items. Clicking on an item reveals specific content (setInSlot) . When you use the back button it changes the token name to the token used before but you still see the old content.
My question is: How do I get back to the content which was shown before?
You shoud use the GWTP presenter lifecycle. When you use back button, the previous presenter is revealed. You should override onReveal() and onHide() to clean or save the presenter and view state.
If you want clean a presenter when the place changed, you should override onHide() and in the body you can clean the view before the place change.