Created
January 21, 2020 13:42
-
-
Save GursheeshSingh/2fa17ecd73cb26c64f6c9115c6ad5f0a 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 'dart:math'; | |
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
///Primary Color of Twitter | |
const kTwitterPrimaryColor = Color(0xFF1da1f2); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
body: Center( | |
child: CustomPaint( | |
painter: TwitterSpinnerPainter(), | |
), | |
), | |
), | |
); | |
} | |
} | |
class TwitterSpinnerPainter extends CustomPainter { | |
@override | |
void paint(Canvas canvas, Size size) { | |
double radius = 25; | |
double width = 8; | |
Paint innerCirclePaint = Paint() | |
..color = kTwitterPrimaryColor.withOpacity(0.3) | |
..style = PaintingStyle.stroke | |
..strokeWidth = width; | |
Offset center = new Offset(size.width / 2, size.height / 2); | |
canvas.drawCircle(center, radius, innerCirclePaint); | |
} | |
@override | |
bool shouldRepaint(TwitterSpinnerPainter oldDelegate) { | |
//Will be changed later | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment