Skip to content

Instantly share code, notes, and snippets.

@preetjdp
Created May 29, 2020 05:44
Show Gist options
  • Select an option

  • Save preetjdp/788650466e1269f480ec44a4645b01ec to your computer and use it in GitHub Desktop.

Select an option

Save preetjdp/788650466e1269f480ec44a4645b01ec to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: CustomPaint(
painter: MyPainter(),
size: Size(150, 150),
));
}
}
class MyPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Offset center = size.center(Offset.zero);
Paint circlePainter = Paint()
..color = Colors.white
..style = PaintingStyle.stroke
..strokeWidth = 12;
Paint shadowPainter = Paint()
..color = Colors.white
..maskFilter = MaskFilter.blur(BlurStyle.normal, 100);
canvas.drawCircle(center, 50, circlePainter);
canvas.drawCircle(center, 50, shadowPainter);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment