How to set an empty initial value for Flutter Slider? - flutter

Currently the "value" property of Slider is required, however I was wondering if it is possible to create a Slider such that it initially has no value and the thumb is hidden. Then when the user presses along the line, the thumb appears at that point.
I looked at https://pub.dev/packages/flutter_xlider but it seems like that package also required values to be set.

I think not, and for good reason. The function of the Slider and the understanding of how it is used is interpreted by the user primarily based on seeing the thumb indicator on a line. So regardless how you set up the requirements for the slider's usage in your app, the Slider control needs to always have a value represented. You could default the slider value to the min, the max, the middle(-ish), or any valid value.
If you want to ensure the user makes a selection (making it a required field sort of), you could set a bool state variable on an ancestor widget (perhaps named sliderWasTouched) to true when any part of the Slider is tapped and whenever the Slider changes value (after initialization), and then make that state variable being true part of your form field validation.

Related

Shape property which references documentsheet property doesn't get updated when documentsheet property changes

I have the following case:
I defined a user property ("User.DocProp") at the documentsheet level. I want to reference this property in a shape property cell ("Prop.SomeProp") and display the shape property as text on the shape.
This is working (I inserted a field into the shape text which points to my shape data). The value of the document property is correctly displayed on the shape.
And when I change the document property the shape's text gets updated. Awesome!
BUT this (update of the shape's text after change of the document property) doesn't work anymore when I have multiple pages each with the same kind of shape as before. When I now change the property on the documentsheet only those shapes get updated which lay on pages that I have navigated to before (since I opened the drawing). On all other pages the shape text will show the old value of the document property. Only when I directly enter the cell in the shapesheet by pressing F2 and leave with ENTER the text will get updated.
I tried several formulas in the shape property with no avail:
=TheDoc!User.DocProp
=SETATREF(TheDoc!User.DocProp)
=SETATREF(TheDoc!User.DocProp,SETATREFEVAL(SETATREFEXPR()))
I can't find a method to force recalculation of formulas neither. What am I missing here?
Screenshot from test drawing

ag-grid refresh rowStyle to default after redux action

I have a react-redux app, where in my ag-grid I use getRowStyle to set rows based on a certain field value. For instance, if a row's edited I set a field called isDirty to true and pass this to redux, which updates state and then via props I get this back and page re-renders and makes use of getRowStyle to set this row to a diff style, like below -
_getRowStyle = params => {
if (params.node.data.isDirty) {
return {'fontWeight': 'bold'};
}
};
But, once this is persisted somewhere (thru' my redux-action), I update the state's isDirty to false. Again, this is received via props, and re-renders, but now in _getRowStyle() the "if" is no longer true, so it doesn't default back to the original value, so the row remains in "bold" style. If I force a gridApi.redrawRows(), it renders correctly, but I want to see if I can somehow avoid this heavy operation. All that is needed a refresh, but refreshCells() doesn't give me what I'm after.
Any assistance is deeply appreciated!

Swift UI Test Static Text Value

I have a label that gets its text assigned after a certain action happens, and I want to test that the text it has been assigned is correct with a UI test.
I am getting the XCUIElement with
.descendantsMatchingType(.StaticText).elementBoundByIndex(UInt(3))
The element is a staticText, and the element.value is not returning anything useful, and I'm unable to find another way of getting any sort of useful value from the staticText, besides the debugDescription. However, it says in the docs that the debugDescription is unreliable and should not be used for the actual tests.
How can I verify that this label has the correct text?
This has been answered with a recent update to XCUIElement; there is now a label property that gets the text from a .StaticText element.

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).

wicket: Dropdownchoice

i have two dropdowns using same model and sets the value into it. Dropdown1 will visible on screen always and Dropdown2, will be visible for only one particular option choosen in Dropdown1. and i am making an query to the DB based on the selections in dropdowns.
But when i have both the dropdown first and then hide the second one, The value already set but the Dropdown2 is still avalible in my model, and making my query to fetch improper data.
So can any one suggest me an idea, how to set the value to null for the attribute which is actually set but dropdown2, if dropdown2 is inVisible.
(i tried to set the ModelObject to null, when making the dropdown2 invisible (using AjaxFormComponentupdateBehavior), but when i make the dropdown2, visible again, it returns null,even if i make any selection in it)
Are you using a LoadableDetachableModel ? try to explicitly detach model from that dropdown on setHide event. I did not try it though.