Created
December 25, 2020 11:22
-
-
Save imaNNeo/1fd6bf61bd37934bd4960af5bb973feb to your computer and use it in GitHub Desktop.
This file contains hidden or 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'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter4Fun.com', | |
theme: ThemeData( | |
primarySwatch: Colors.yellow, | |
visualDensity: VisualDensity.adaptivePlatformDensity, | |
), | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatefulWidget { | |
const HomePage({Key key}) : super(key: key); | |
@override | |
_HomePageState createState() => _HomePageState(); | |
} | |
class _HomePageState extends State<HomePage> { | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Color(0xFF191636), | |
body: Center( | |
child: CustomPaint( | |
painter: _OrbitPainter(), | |
size: Size(300, 100), | |
), | |
), | |
); | |
} | |
} | |
class _OrbitPainter extends CustomPainter { | |
@override | |
void paint(Canvas canvas, Size size) { | |
final center = Offset(size.width / 2, size.height / 2); | |
final rect = Rect.fromCenter(center: center, width: size.width, height: size.height); | |
canvas.drawOval( | |
rect, | |
Paint() | |
..color = Colors.white | |
..style = PaintingStyle.stroke | |
..strokeWidth = 1, | |
); | |
} | |
@override | |
bool shouldRepaint(covariant CustomPainter oldDelegate) => true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment