Hello Flutter 04

Home   »   Hello Flutter 04

import 'package:flutter/material.dart';

class MyHelloWorld extends StatelessWidget {
  @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()
      ),
    ),
  ));
}

Leave a Reply

Your email address will not be published. Required fields are marked *