I am trying to implement different floating action button for different tabs in flutter. Upon entering a tab, the previous floating action button should hide and a new floating action button should appear (with animation). I have already implemented the method described in Flutter - Different floating action button in TabBar
which works fine, but does not animate, and also delays in changing. So is there any better way to implement this desired behavior as shown below ?
You could use a tabController to get the index of the current tab. Then call setState to change the UI, eg setState(() => _myIndex = tabController.index )
Based on _myIndex display the button you want for the current tab.
Related
I am a new in Flutter.
I want to make possible to show the same value when tapped on the button in the widget Text();
For example:
Button with value - (0) zero.
Tapping button -> shows 0.
Again Tapping button -> shows 00.
Again Tapping button -> shows 000
I my case I made just to when button is tapped I show the value zero, when I tap again nothing happens in the UI but in the console I see that button tapped.
As you see in the screenshot
14 flutter: Tap Number 1. In this case I tapped 14 time on the button.
enter image description here
I guess the problem could be with Flutter Keys.
I use the setState. As I understand setState change the value if it is changed but in my case when I tap several times same button with the same value nothing happened because the value is not changed, so UI does not change too, am I right ?
I do not need ready solution, I just want to get the advices how to work with such cases in order to make myself.
I just want to get the advices how to work with such cases in order to make myself.
I've looked through many tutorials for the side nav drawer. I can create one that works fine to lead to different pages. However, when I travel to a page that's different from home, it only gives me the arrow icon to go back to home at the top left instead of keeping the button to bring me back to the side navbar. How can I prevent this?
I can't use the home page to navigate everywhere because it's just supposed to be a blank splash screen.
You can define your drawer in a separate widget file, that you can import everywhere you have a scafold.
I created a package for it because I was missing similar functionality. If you want a Flutter approach for this navigation check out: https://api.flutter.dev/flutter/material/NavigationRail-class.html
Or if you want to have a look at my package: https://pub.dev/packages/side_navigation
It's because you're moving to a new page/Scaffold (probably using Navigator.push()). So, the default button in the AppBar will be the back button.
You can either have the same Drawer in every Scaffold you navigate to, which is not recommended since you'll just keep pushing routes to the navigation stack.
Or, you can change pages within the Scaffold. Check the interactive examples in BottomNavigationBar and NavigationRail to get an idea of how to do it. Basically instead of calling Navigator.push() when a tile in Drawer is tapped, just update the selected index and call setState().
I'm Trying to Build an App but I'm stuck at the floating action button.
I have tried to create custom floating action using the animated builder.
This is what I want to achieve
[]
I have designed a simple dashboard menu using valuelistenablebuilder which basically changes based on the selected icon.
Here's an example of how it looks
Whenever i click one of the dashboard buttons (cards inside a gridview), it updates the listennablevalue, and thus it leads to a similar view but the number of buttons (and the content within the button) changes.
however, there is no transition or animation as the basic material pageroute given the builder is just rebuilding the view.
Is there a way to add a smooth transition using this listener?
I tried a bottom navigation bar with Floating Action button as in the following link
https://codewithandrea.com/articles/2018-09-13-bottom-bar-navigation-with-fab/
It works well but when I move to next screen the floating button gets displayed and its funtion's are still working
I found a same type of issue(question) but no answer
Flutter - FloatingActionButton isn't shown after going back a screen
how to block the floating button visibility in upcoming screens
please put your code. I am not aware of this problem but if you don't want it to be visible in a specific screen you can do so for example
_currentIndex==2? FloatingActionButton():Container()