Modify Flutter CupertinoPicker scroll to not continuously scroll? - flutter

Is there a way to modify CupertinoPicker scroll so that it's not possible to continuously scroll through a range. For example, right now if the range of values is 1-7, a user is able to continuously scroll 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, ... Is there a way to modify CupertinoPicker to have the scroll stop at the 1 and 7 (in this use case), so that there isn't a continuous scroll?

Update: found it; there's a property called "looping" (boolean)

Related

How can I sorting ListView by trailing value in Flutter?

I have a ListView in Flutter shows stores location information from firebase after that a function works to calculate a distance between customer location and stores locations and show distance value in the trailing of ListView, now I want to sort this ListView based on trailing value (nearest stores):
Most of solution I have tried was so complicated and want an easy a effective way.
For ascending
var dataList = [1, 6, 8, 2, 16, 0] //your dynamic list
dataList.sort((a, b) => a.compareTo(b));
For descending
var dataList = [1, 6, 8, 2, 16, 0] //your dynamic list
dataList .sort((b, a) => a.compareTo(b));
don't forgot to call setState to reload your UI again

How can graphic objects be drawn in AnyLogic during runtime?

I am trying to add reactangles to the graphic screen in Anylogic during runtime. This is what I have so far:
ShapeRectangle a = new ShapeRectangle(SHAPE_DRAW_2D ,true,
10,
10,
2,
0,
black,
black,
20,
20,
5,
0.5,
LINE_STYLE_SOLID);
I bet the object is created. However, it is not printed on the canvas. How can I do that?
You are just missing that you need to add the shape to the presentation like this:
presentation.add(a);

FPDF align values on right

I am using FPDF to generate a report, and i need to align the number on right taking the number on top(Year) by reference.
But I am having a problem on this align.
If i use a function Cell like this:
$pdf->Cell(0,5,$alue,'B',1,'D');
All values stay on right Overlapping.
I tried to use a function SetX but did not changed anything.
how it is now
Take a look at the documentation. It states that:
Cell width. If 0, the cell extends up to the right margin.
Since you're right-aligning your text and your Cell sits on the right margin of the page, it makes sense that it does not align properly.
Try specifying a width for your cell. For example, replace your example line of code with:
$pdf->Cell(50,5,$alue,'B',1,'D');
<?php
//right align
$pdf->Cell(50, 5, $alue, 0, 0, 'R' );
//Left Align
$pdf->Cell(50, 5, $alue, 0, 0, 'L' );
//Center Align
$pdf->Cell(50, 5, $alue, 0, 0, 'C' );
?>

Break from within a oneliner

Is it possible to simplify the second line keeping the code in three lines at the same time? current should have the "error" value.
for item in [ 1, 2, 3, undefined, 5, 6]
break if (current = if item? then item else "error") is "error"
console.dir current
I was trying to make something like that with no luck:
for item in [ 1, 2, 3, undefined, 5, 6]
current = if item? then item else "error", break
console.dir current
Here is a one liner, that's the best way I found to write it in coffee, but wouldn't in production, so my colleagues won't kill me while reading it.
break for item in [ 1, 2, 3, undefined, 5, 6] when (current = item ? 'error') is 'error'
console.dir current
There are actually many way to write this, with exactly the same output in Javascript.
Regards,

Large gaps in GFlot bar chart with value series

I use GFLot 2.4.3 with GWT 2.4 and have a problem regarding a series of values, NOT a time series. x-axis shows several IDs and y-axis shows the corresponding values as bars.
The problem is that these IDs have large gaps in their numbering, for example 1, 9, 47 or 128 and up to above 4000. In a bar chart this is plotted as seen on the following image:
Can I somehow deactivate these interpolation of points and get all bars aligned next to each other without gaps?
The only solution I could find is to use a TickFormatter.
Add your points to the model using constant gap as x-axis (1, 2, 3, 4, 5, etc.) and add a TickFormatter to the x-axis option :
plotOptions.addXAxisOptions( new AxisOptions().setTickFormatter( new TickFormatter() {
#Override
public String formatTickValue( double tickValue, Axis axis )
{
// return the label you want ("1", "9", "47", "128", "4000", etc.) for the tickValue (1, 2, 3, 4, 5, etc.)
}
} ) );