|
|
|
|
|
|
internal static Random random = new Random(); |
|
|
|
|
|
|
|
public static bool UseImage = true; |
|
|
|
public static bool UseAmountSlider = false; |
|
|
|
|
|
|
|
public static T RandomSelect<T>(this List<T> a) |
|
|
|
{ |
|
|
|
|
|
|
private readonly List<Widget> _tiles = new List<Widget>(); |
|
|
|
|
|
|
|
private int count = 4; |
|
|
|
private int tileCount = 10; |
|
|
|
private int tileCount = 30; |
|
|
|
|
|
|
|
public void UpdateTiles() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
public override Widget build(BuildContext context) |
|
|
|
{ |
|
|
|
return new Column( |
|
|
|
children: new List<Widget>() |
|
|
|
{ |
|
|
|
new Expanded(child: |
|
|
|
new Container( |
|
|
|
child: |
|
|
|
StaggeredGridView.count( |
|
|
|
crossAxisCount: count, |
|
|
|
staggeredTiles: _staggeredTiles, |
|
|
|
mainAxisSpacing: 3, |
|
|
|
crossAxisSpacing: 3, |
|
|
|
padding: EdgeInsets.all(4), |
|
|
|
children: _tiles |
|
|
|
) |
|
|
|
)), |
|
|
|
new Slider( |
|
|
|
activeColor: Colors.blue, |
|
|
|
inactiveColor: Colors.white, |
|
|
|
value: count, |
|
|
|
min: 2, |
|
|
|
max: 8, |
|
|
|
divisions: 6, |
|
|
|
label: count.ToString(), |
|
|
|
onChanged: v => |
|
|
|
var result = new List<Widget>() |
|
|
|
{ |
|
|
|
new Expanded(child: |
|
|
|
new Container( |
|
|
|
child: |
|
|
|
StaggeredGridView.count( |
|
|
|
crossAxisCount: count, |
|
|
|
staggeredTiles: _staggeredTiles, |
|
|
|
mainAxisSpacing: 3, |
|
|
|
crossAxisSpacing: 3, |
|
|
|
padding: EdgeInsets.all(4), |
|
|
|
children: _tiles |
|
|
|
) |
|
|
|
)), |
|
|
|
new Slider( |
|
|
|
activeColor: Colors.blue, |
|
|
|
inactiveColor: Colors.white, |
|
|
|
value: count, |
|
|
|
min: 2, |
|
|
|
max: 8, |
|
|
|
divisions: 6, |
|
|
|
label: count.ToString(), |
|
|
|
onChanged: v => |
|
|
|
{ |
|
|
|
int newCount = (int) v; |
|
|
|
if (newCount != count) |
|
|
|
int newCount = (int) v; |
|
|
|
if (newCount != count) |
|
|
|
{ |
|
|
|
setState(() => { count = newCount; }); |
|
|
|
} |
|
|
|
setState(() => { count = newCount; }); |
|
|
|
), |
|
|
|
} |
|
|
|
), |
|
|
|
}; |
|
|
|
if (Utils.UseAmountSlider) |
|
|
|
{ |
|
|
|
result.Add( |
|
|
|
new Slider( |
|
|
|
activeColor: Colors.blue, |
|
|
|
inactiveColor: Colors.white, |
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
), |
|
|
|
} |
|
|
|
); |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
return new Column(children: result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|