i have the following code
Listener(
onPointerMove: (detail){
print(detail.position);
}
)
now by default detail.position will give the following
Offest(dy,dx);
now after many test i noticed the max value of dy equal MediaQuery.of(context).size.height
and the same with dx the max value equal MediaQuery.of(context).size.width
lets assume that my MediaQuery.of(context).size.height equal 800 in double, and i wrap my scaffold into Listener widget so if i touch any point (lets say at the bottom at the last point in screen ) so of course i will outputs 800 .
Question what if i want replace the max value with other value lets say from 800 to 1000 ??
in other word when i repeat the same touch process so it will outputs 1000 .
NOTE : i know it is impossible to replace it but i mean I want the output calculations to come based on a maximum value of the value I set and not MediaQuery.of(context).size.height so There is no problem if the value remains the same .
in the fact other value come from image height from server so it is not fixed always it might be even less than original value
i need it the same with width too .
It's purely a math matter
How can i handle with it ?
Related
I have two edit boxes on my simulation experiment screen prior to running the model, one box for a minimum value, and the other for a maximum value.
I want the value within the minimum edit box to be equal to the value within the maximum edit box if the user ever inputs a value that is higher than the latter.
Something like this :
mininum box = 10
maximum box = 15
User tries to do:
minimum box = 20
End result
minumum box = 15
maximum box = 15
I tried this below in the "action" properties of my Edit Box element, but it hasn't worked.
if(min > max){
min = max;
value = Integer.toString(max);
}
Thank you for your help
Write this in the min-box action code:
if (value >= maxEditbox.getValue()) {
minEditBox.setValue(maxEditbox.getValue());
}
I have data in the form of [DateTime, num]. I have converted the DateTime object into a string and used it as a x-axis label. I am getting this glitch now. Is there a property which I need to change to fix this?
As you can see, there is a repetition of the x axis labels at either end. I am using Fl_Chart library. If you require my current code I can attach it.
fl_chart uses the interval you provide to determine which points should have labels for, however, it also creates a label for 0 and maxX. You can fix it by adding
if (value % (xAxisInterval?.ceil() ?? 1) == 0) {
//return label
}else{
return SideTitleWidget(
axisSide: meta.axisSide,
child: Container(),
);
}
to your getTitlesWidget function. Where xAxisInterval is the value you passed into your SideTitles object for interval for the xAxis.
I have a UI with multiple pickers on the screen. The first one being select an age from the list. When I pass to the second picker where we pick a weight with an initial value of 65 kg, it takes as an initial value last chosen index from the age picker. If the age was chosen 21 years, then an initial value of the weight picker becomes 21 kg. Is there any solvation for it? Because third is sex picker, where I have just two values, but an initial value appears empty because on previous was chosen 75 kg.
Found a solution to add key property to widget, so rebuild will run correctly.
return Container(
key: ValueKey(someUniqueValue),
child: ...
);
Initially, all rows will have the same height of 50. When a cell is focused,if it has more content and requires more height, I need to increase the height of that particular cell. If that is not possible, atleast that entire particular row's height has to be increased. The remaining rows should not get effected.
I would make use of rowSelection api particularly the selected property of each rowNode.
You can define getRowHeight in html [getRowHeight]="getRowHeight"
and (selectionChanged)="onSelectionChanged($event)"
And define getRowHeight like this -
this.getRowHeight = function(params) {
return params.node.selected ? 100 : 50; // if selected height is 100 else default 50
}
and then in your onSelectionChanged,
onSelectionChanged() {
this.gridApi.resetRowHeights();
}
The reason you would want to piggyback on selected attribute is because it is maintained by ag-grid for each row.
You could do something similar by implementing the callback onCellFocused but then you will have to maintain a similar attribute for each row because you also need to adjust the height once the focused row is out of focus which might be an expensive operation.
I'm trying to enforce a maximum height for an element and I can't figure out exactly which LayoutSpec can help me do that. It seems like the sizeRange property is what I would expect to work but that appears to work only with ASStaticLayoutSpec, which seems like more of a last resort option. (This element I need to constrain is contained in an ASInsetLayoutSpec in my case.)
Here's my attempt:
CGSize max = CGSizeMake(constrainedSize.max.width, [self.class maxSinglePhotoHeight]);
_singlePhotoNode.sizeRange = ASRelativeSizeRangeMake(ASRelativeSizeMakeWithCGSize(constrainedSize.min), ASRelativeSizeMakeWithCGSize(max));
ASInsetLayoutSpec *inset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:PHOTO_INSET child:_singlePhotoNode];
I'm found this:
ASInsetLayoutSpec *insetLayoutSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(INFINITY, INFINITY, INFINITY, INFINITY) child:self.displayNode];
But be sure max size must not be inf in param, or u go in infinity layouts loop.