Why does clicking on a TextFormField trigger didUpdateWidget()? - flutter

I've ran into a problem. In one section of my page I have a date with today's date. If the user clicks on an arrow to the right it goes forward a date and if they person clicks an arrow to the left it goes back a date. On the arrow buttons I am using setState. The date changes perfectly fine.
I also have a form below on a separate card. To each textFormField I h ave a controller set up. I had to set these up because initialvalue: only gets called once so the fields were never changing with the date.
Anyway the fields now change with the date and it is correct. But the moment I click on the form, The top widget date shoots back to the initial value it was at?
I checked this by setting up a didUpdateWidget override and this is firing every time I click on the form field??? Why is this happening. I am not updating anything yet.
When I used a controller for the date value displayed between the two arrows it doesn't change but when I hit submit the value it's supposed to be assigned to is the wrong (very first date that appears). So it seems like when didUpdate fires it is setting that field which I have set in my extends StatefulWidget class{}.
EDIT: Wow typing that last sentence made me realize I needed to set the value in my bottom class that extends State<>. I was using it with widget.activeDay.
I guess I'm still curious as to why this is happening with the text form field though?

Clicking on a text-field opens the keyboard.
This changes the screen dimensions and leads to MaterialApp rebuilding the route.
The route rebuilding ultimately calls didUpdateWidget on that specific widget.

Related

How to reset the dropdown button in flutter?

I have a dropdown button which works fine when I visit the page(having the button) first time but whenever i revisit the page containing the dropdown button, the previously selected value appears rather than the hint text which i want to appear every time the page is visited.
Dropdown button has a property value where we specify our variable to get the selected value. Before moving to the next screen you can set back the default value to it and it should work.

Slider value doesn't update even if state is changing

I'm getting mad to understand why the slider inside a statefulBuilder won't update its value even if the state is continually changed by an audioPlayer listener function. Other values inside the same builder updates (the button icons for instance), but the slider keeps staying in its initial position even if it remains draggable.
I've searched the web and this site for two full days. I'm adding the link to the file on git to avoid pasting the entire file here
https://github.com/Adriano72/wccm/blob/master/lib/pages/john_main_talks.dart

Presenter saves the textbox value in gwtp, gwt

I tried to develop a shopping cart application.
I am able to process the deal. but when the user click the fresh start after completing the deal the first page starts with the value which I have entered previously.
I am using gwtp, uibinders, I have back, cancel, next functionality in series of screens.
what to do to make sure the screen is blank for every new start of deal.
I don't know which design pattern you use, but usually a "view" keeps its state after it is hidden. When you show your view the second time, you have to reset the values of all fields (textboxes, inputs, etc.), or they will show their state from the previous time.

Show transition screen fields on issue screen

Is it possible to show on an issue screen the value of transition screen fields ? (on the right side for example such as date fields)
Example :
I have a field called "initial date" in a transition of my workflow, and I wonder if it was possible to show it on the right side of my issue's screen ?
Thanks a lot,
Christophe
I'm not sure, but you can add this field to default screen on this issue type and if value of this field isn't empty, should show on view issue page.
On the right side of issue will show always all fields type: user and date in default configuration.

How to avoid CellList/Table from automatically scrolling to selected item when visible range is changed

I was implementing a custom CellTable that has a infinite scroll feature using the CellList showcase example ( http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellList ). However, I found a feature in CellList/Table that is undesirable in this case: changing visible range after clicking an item would cause the List/Table to be automatically scrolled to the selected item.
you can try the showcase example in above to see the exact same behavior. When no item is selected, the infinite scroll works just fine, but when you click an item and then scroll it, it will always jump back to the selected item when the range is changed.
I also found that it only happens when the focus is still on the item, that is, if you select an item and then click somewhere else to lose the focus, it wouldn't happen.
I've been digging around the GWT code and trying to find out how to disable this feature with no success. Did anyone handled this situation before?
As a simple workaround, you can call focus() on some element, to remove the focus from the item (without removing the selection).
In the showcase example, in ShowMorePagerPanel, add e.g.
scrollable.getElement().focus();
at the beginning of the onScroll(ScrollEvent event) method.
I ran into the same problem and couldn't get Chris's answer to solve it, but the following solution worked for me:
in your onScroll(ScrollEvent event) method, add a line similar to the following, assuming yourTable is an instance of something extending AbstractHasData
yourTable.setFocus(false);