Last active
March 2, 2020 04:01
-
-
Save skybrian/f8ebd163d789be9fd14b78c493abcf1d to your computer and use it in GitHub Desktop.
Hello, Flutter World
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'; | |
void main() => runApp(App()); | |
class App extends StatelessWidget { | |
@override | |
Widget build(BuildContext ctx) { | |
return MaterialApp(home: new Home()); | |
} | |
} | |
class Home extends StatefulWidget { | |
@override | |
_HomeState createState() => _HomeState(); | |
} | |
class _HomeState extends State<Home> { | |
@override | |
Widget build(BuildContext ctx) { | |
return Scaffold( | |
appBar: AppBar(title: Text("Hello, Flutter World")), | |
body: Center( | |
child: SizedBox( | |
width: 400, | |
height: 400, | |
child: CustomPaint(painter: Drawing())))); | |
} | |
} | |
class Drawing extends CustomPainter { | |
@override | |
bool shouldRepaint(Drawing prev) { | |
return false; | |
} | |
@override | |
void paint(Canvas canvas, Size size) { | |
var center = size.width / 2; | |
var paint = Paint()..color = Colors.blue; | |
canvas.drawCircle(Offset(center, center), 100, paint); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment