Skip to content

Instantly share code, notes, and snippets.

@av
Created October 11, 2019 12:04
Show Gist options
  • Save av/8ac7a8fc9931425eae6d924af8ea6e29 to your computer and use it in GitHub Desktop.
Save av/8ac7a8fc9931425eae6d924af8ea6e29 to your computer and use it in GitHub Desktop.
Flutter: tough_bikes, draw random lines
@override
void paint(Canvas canvas, Size size) {
// This [Rect] will fill the whole canvas we got
var fillRect = Rect.fromPoints(Offset.zero, size.bottomRight(Offset.zero));
var count = 100;
// Background for our texture
canvas.drawRect(fillRect, fillPaint);
for (var i = 0; i < count; i++) {
canvas.drawLine(randomOffset(size), randomOffset(size), linePaint);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment