Skip to content

Instantly share code, notes, and snippets.

View Indy9000's full-sized avatar
🏠
Working from home

Indy M. Indy9000

🏠
Working from home
View GitHub Profile
@Indy9000
Indy9000 / linechartpainter-04.dart
Created June 13, 2021 19:50
line-chart-widget
@override
void paint(Canvas canvas, Size size) {
...
final labels = _computeLabels();
_drawYLabels(canvas, labels, points, boxW, border);
// draw x labels
final lt1 = Offset(border + boxW / 2.0, border + 4.5 * hu);
_drawXLabels(canvas, lt1, boxW);
@Indy9000
Indy9000 / main.dart
Created August 1, 2021 19:26
flutter-mybusting-01
Widget build(BuildContext context) {
print('MyHomePage is building');
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@Indy9000
Indy9000 / mywidget1.dart
Created August 1, 2021 19:30
flutter-mythbusting-02
class MyWidget1 extends StatelessWidget {
const MyWidget1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
print('MyWidget1 is building');
return Container(
child: Text("Stateless Widget1", style: TextStyle(fontSize: 30)));
}
}
@Indy9000
Indy9000 / mywidget2.dart
Created August 1, 2021 19:32
flutter-mythbusting-03
class MyWidget2 extends StatefulWidget {
const MyWidget2({Key? key}) : super(key: key);
@override
_MyWidget2State createState() => _MyWidget2State();
}
class _MyWidget2State extends State<MyWidget2> {
@override
Widget build(BuildContext context) {
@Indy9000
Indy9000 / main.dart
Last active August 1, 2021 20:35
flutter-mythbusting-04
...
children: <Widget>[
_buildMyWidget1(),
_buildMyWidget2(),
// MyWidget1(),
// MyWidget2(),
Text(
'You have pushed the button this many times:',
),
@Indy9000
Indy9000 / main.dart
Created August 1, 2021 19:53
flutter-mythbusting-05
...
children: <Widget>[
// _buildMyWidget1(),
// _buildMyWidget2(),
const MyWidget1(),
MyWidget2(),
Text(
'You have pushed the button this many times:',
),
@Indy9000
Indy9000 / main.dart
Created August 1, 2021 20:20
flutter-mythbusting-06
...
children: <Widget>[
_buildMyWidget1(),
_buildMyWidget2(),
// const MyWidget1(),
// const MyWidget2(),
Text(
'You have pushed the button this many times:',
),
Text(