Created
May 29, 2021 08:34
-
-
Save vladnicula/38bcd714e44ef6bee7cc9d66767e8340 to your computer and use it in GitHub Desktop.
Hello Flutter 05
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'; | |
class MyHelloWorld extends StatefulWidget { | |
const MyHelloWorld({Key? key}) : super(key: key); | |
@override | |
MyHelloWorldState createState() => MyHelloWorldState(); | |
} | |
class MyHelloWorldState extends State<MyHelloWorld> { | |
@override | |
build (BuildContext context) { | |
return Center( | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
Text('Hello, world!'), | |
TextButton( | |
onPressed: () { | |
print("I was pressed"); | |
}, | |
child: Text("Click me") | |
) | |
] | |
) | |
); | |
} | |
} | |
void main() { | |
runApp( | |
MaterialApp( | |
title: 'Hello From Flutter', // used by the OS task switcher | |
home: SafeArea( | |
child: Scaffold( | |
body: MyHelloWorld() | |
), | |
), | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment