Last active
February 14, 2022 14:05
-
-
Save oianmol/1dfb0ee0a703b2e26715cc9c18188bcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class StreamLoadingMarchingAnts extends CustomPainter { | |
late double progress; | |
StreamLoadingMarchingAnts({required this.progress}); | |
final antPaint = Paint() | |
..strokeWidth = 2 | |
..strokeCap = StrokeCap.round | |
..strokeJoin = StrokeJoin.round | |
..strokeMiterLimit = 10 | |
..style = PaintingStyle.stroke | |
..shader = const LinearGradient( | |
colors: [Colors.red, Colors.blue], | |
stops: [0.5, 0.5], | |
tileMode: TileMode.repeated) | |
.createShader( const Rect.fromLTWH(0, 0, 10, 10)); | |
@override | |
void paint(Canvas canvas, Size size) { | |
final antPath = Path() | |
..moveTo(84.609299, 20.5695) | |
..lineTo(125.579002, 17.6653) | |
..moveTo(128.404007, 22.7234) | |
..quadraticBezierTo(128.283005, 17.4736, 129.985992, 20.5212) | |
..lineTo(99.744698, 62.643501) | |
..moveTo(97.145401, 63.9772) | |
..quadraticBezierTo(99.143799, 63.480598, 98.176102, 63.9772) | |
..lineTo(32.875999, 63.9772) | |
..moveTo(30.2789, 62.646702) | |
..quadraticBezierTo(31.846901, 63.9772, 30.880501, 63.482201) | |
..lineTo(1.54301, 22.726601) | |
..moveTo(4.36729, 17.6653) | |
..quadraticBezierTo(-0.041925, 20.5247, 1.66077, 17.4729) | |
..lineTo(45.2118, 20.569799) | |
..lineTo(62.657001, 1.06645) | |
..moveTo(67.4431, 1.08469) | |
..quadraticBezierTo(63.935398, -0.362652, 66.175301, -0.354332) | |
..lineTo(84.609299, 20.5695) | |
..moveTo(93.189796, 57.6478) | |
..lineTo(66.600998, 47.710999) | |
..lineTo(66.600998, 57.6478) | |
..lineTo(93.189796, 57.6478) | |
..moveTo(63.400101, 57.6478) | |
..lineTo(63.400101, 47.710999) | |
..lineTo(36.811298, 57.6478) | |
..lineTo(63.400101, 57.6478) | |
..moveTo(60.3321, 45.337101) | |
..lineTo(33.1661, 55.477699) | |
..lineTo(13.1805, 27.697001) | |
..lineTo(60.3321, 45.337101) | |
..moveTo(69.613297, 45.337101) | |
..lineTo(96.779297, 55.477699) | |
..lineTo(116.764999, 27.697001) | |
..lineTo(69.613297, 45.337101) | |
..moveTo(63.4249, 43.018501) | |
..lineTo(63.4249, 9.5828) | |
..lineTo(41.212799, 34.657001) | |
..lineTo(63.4249, 43.018501) | |
..moveTo(66.600998, 43.0191) | |
..lineTo(66.600998, 9.58759) | |
..lineTo(88.813499, 34.6576) | |
..lineTo(66.600998, 43.0191) | |
..moveTo(34.699501, 32.345699) | |
..lineTo(39.8102, 26.6031) | |
..lineTo(14.8419, 24.8137) | |
..lineTo(34.699501, 32.345699) | |
..moveTo(95.057899, 32.345699) | |
..lineTo(89.947601, 26.6031) | |
..lineTo(114.916, 24.8137) | |
..lineTo(95.057899, 32.345699) | |
..moveTo(95.057899, 32.345699) | |
..close(); | |
canvas.drawPath(antPath, antPaint); | |
} | |
@override | |
bool shouldRepaint(covariant StreamLoadingMarchingAnts oldDelegate) => | |
true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment