Yczar/textura

fix: Values are hardcoded

Opened this issue · 0 comments

Description

The texture property values are hardcoded. For example, for the radius of the Bubble texture, the step size of the Celtic knots texture, and so on.

Expected Behavior

A suggestion of how it should be done is to have a super-class of TextureRenderObject that is extended by every texture, each with its own specific properties.
For instance,

sealed class TextureRenderObject extends RenderProxyBox {}  // sealed for exhaustiveness checking

class BubbleTexture extends TextureRenderObject {
    final int bubbleRadius;
    final int numberOfBubbles;
    const BubbleTexture ({
        this.bubbleRadius = 20,
        this.numberOfBubbles = 100,
    });

  @override
  void paint(PaintingContext context, Offset offset) {
    // TODO: Implement
  }
}

In use, it can be like:

Textura(
    textureType: BubbleTexture(
        bubbleRadius: 15,
        noOfBubbles: 200,
    ),
    child: Container(),
)