Skip to content

Instantly share code, notes, and snippets.

@skybrian
Last active March 2, 2020 04:01
Show Gist options
  • Save skybrian/f8ebd163d789be9fd14b78c493abcf1d to your computer and use it in GitHub Desktop.
Save skybrian/f8ebd163d789be9fd14b78c493abcf1d to your computer and use it in GitHub Desktop.
Hello, Flutter World
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