Flutter make a tab bar that picks the first element when user scrolls ( like in Airbnb home page) - flutter

As you can see in the gif here, the tab selects the appropriate item in the seen whenever the user scrolls, unlike the regular tab bar which require click action to change the selected item. Need help pls
[1]: https://i.stack.imgur.com/3cjhT.gif

This is a custom widget with animation controller , you must have some basic knowledge of animation in flutter .
but if you want to have a look at the code check this .

Related

Device back button has different result rather than getx toNamed

I have two screen, first is for load list off all shop data and second is the detail screen of the shop. When I'm in second page and go back with arrow icon with Get.toNamed the first screen will load all list again but when I in the second page and I go back with my device back button in the first page it just showing loader icon and the list not loading. Can someone help me why it can be happen ?
Use Get.off() or follow this article.

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.

How to reload a particular tab in bottom navigation bar flutter?

I have a bottom navigation bar with 5 tabs, In each tab I have a button that navigates to another separate screen using Navigation.pushNamed()(page 2); and from (page 2) I pop the screen, now the tab from where I navigated from need to be reloaded. because i store some data (page 2) and stored in sqflite i need to display the data in one of the tabs. Is it possible to reload a particular tab of a bottom navigation bar?
I tried using Navigator.pop(context,true) that also didnt work. Can some one help me with this, thanks in advance.
this is done by the provider. I'm new to flutter as well but this guy explained it very well!
Flutter by default does not save state (and disposes the widgets). If you want to save the state of a tab, you can use a PageStorageBucket. It is really well described in this tutorial:
https://medium.com/#lucassaltoncardinali/keeping-state-with-the-bottom-navigation-bar-in-flutter-69e4168878e1

How can i create a sticky tabhost on android applications?

I want to create a tabhost that can be sticky under the action bar, here is some concept image
http://i.imgur.com/NbzSIKj.png
this is the normal condition of the view, the app will have some other content above the tabhost, which the coding is also include in the tab activity and the app will have few tabs and each tabs will use listview to show the information.
http://i.imgur.com/oKWDzDy.png
i want the tabhost will be sticky just under the action bar when i scroll down the listview, is this possible?
Using the Android-ParallaxHeaderViewPager a good example of scrolling tab header by kmshack Github page
The Sample code is give in this Here Git Hub link
The explanation for the solution is begin described in the github page
Hope this will help you

Coda Slider Tab Navigation

I am using Coda-Slider for my website and I want to know if there is a way to change the content of each tab. For example, the user navigates onto tab2 where I placed a link to redirect the user to another page. Is there a way NOT to navigate away from the page nor the tab but instead load the link inside the tab? I was thinking it would look something like a modal box that would stay inside the tab instead of popping up.
see 19. Coda-Slider Sliding Tabs or you might want to try 35. JQuery IDTabs if you want the effect to be non-intrusive