Flutter: How to display repeated value in the Text widget - flutter

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.

Related

Screen resizing after keyboard is shown on TextField tap

Widget Tree - https://i.imgur.com/xZjMRm2.png
So I have this widget tree, the TextField in question is inside the column where it shows a RenderFlex error(please ignore the error, it's only there because I animate the column to appear and disappear on button pressed).
The problem is every time I tap on the TextField my screen is pushed up from the bottom as the keyboard is pushing their way through.
To fix this issue I tried to put the Scaffold property resizeToAvoidBottomInset: false, but it did not fix the issue.
Also when I close the keyboard, the background of my screen changes.
If you need code snippets please let me know.
Thank you for your time :)
i need a code snippets, but you can add SingleChildScrollView at the top of the column.
and for when you close the keyboard, the background of your screen changes, my guess for that is when the keyboard opens the screen rebuilds and this will call the build function so if you initialized any variables or anything related to the background change inside the build function it will rebuild or re-initialized.
i do not know if my answer helps but it will be better to share a code snippest, have a great day.

Screenshot Controller flutter - capture method returns a null Uint8List when record is added

On the home screen on my app :
I have a list view with a bunch of card widgets and a screenshot action associated with each card widget. When I click on the screenshot action it captures the screenshot of that widget as it’s supposed to.
I have a floating action button which when clicked takes me to an add screen where I add data and save it to the database. Once saved a snackbar message is displayed and screen is popped out. The list view now displays the new record as a card widget.
PROBLEM :
After adding the record, when I click the screenshot action no widget screenshot is captured and on debugging I noticed the “Uint8List? image” is null.
Now if I scroll the list view and perform the screenshot action again everything seems to work.
It sounds to me that this might be a widget tree rebuild issue, but I am not sure how to go about with it. I have other actions, edit and delete on the card widget and they work without any issue.
Package used: screenshot 1.2.3

DropdownButton - don't show popup on tap

I want to show my own page on dropdown button tap, then item selected on page should be set as dropdown button value.
So basically, I need DropdownButton without any popup on tap. When I use onTap still default popup will be shown, how to prevent that?
why you don't use a button instead? or you can try to create an Inkwell put a container on its child and make it look like a button and write your code inside Inkwell OnTap(){}
1- Pass null to items parameter to disable the button.
2- You'll notice icon's color will be grey with disabled button, you can change it by setting color of the icon you send to icon parameter or send color directly to iconDisabledColor parameter.
3- You'll not use value parameter, instead you'll just use hint to show both your hint and your value. and update it using your state management after you pick new value from your own page.
4- Wrap your DropdownButton with GestureDetector or InkWell to show your own page when you tap on the button.
5- If you want to customize your DropdownButton shape, size and more. You can try my new package DropdownButton2. It's simple, easy, based on Flutter's core DropdownButton and have lots of features.

How to change floating action button between tabs in flutter

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.

Flutter - FloatingActionButton is shown after going to next screen

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()