Options constructor

Options({
  1. double tension = 0.45,
  2. double width = 50,
  3. double height = 20,
  4. double hoverFactor = -0.3,
  5. double gap = 5,
  6. double forceFactor = 0.15,
  7. double forceFactorBuild = 1,
  8. double forceFactorOnTap = 1,
  9. List<LayerModel>? layers,
  10. List<TouchModel>? touches,
  11. List<int>? layerNumbers,
  12. List<double>? scaleOptionLayer,
  13. double noise = 0,
})

Designer with liquid widget settings

Implementation

Options({
  this.tension = 0.45,
  this.width = 50,
  this.height = 20,
  this.hoverFactor = -0.3,
  this.gap = 5,
  this.forceFactor = 0.15,
  this.forceFactorBuild = 1,
  this.forceFactorOnTap = 1,
  List<LayerModel>? layers,
  List<TouchModel>? touches,

  /// To draw layers
  List<int>? layerNumbers,

  /// Scale object size at each level, independent of layer order
  List<double>? scaleOptionLayer,
  this.noise = 0,
})  : layers = layers ??
          [
            LayerModel(
              points: [],
              viscosity: 0.5,
              touchForce: 100,
              forceLimit: 2,
            ),
            LayerModel(
              points: [],
              viscosity: 0.8,
              touchForce: 150,
              forceLimit: 3,
            ),
          ],
      touches = touches ?? [] {
  this.layerNumbers = layerNumbers ?? List.generate(this.layers.length, (index) => index);
  layerScales = scaleOptionLayer ?? List.generate(this.layers.length, (index) => 1.0);
}