flutter hello worldひな形
flutterが最初に作ってくれるプロジェクトだと大げさなのでこれくらいがいい
StatelessWidget
import 'package:flutter/material.dart'; void main() => runApp(HelloApp()); class HelloApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Hello', home: Scaffold( appBar: AppBar(title: Text("hello")), body: Center( child: Text("hello"), ), ) ); } }
StatefulWidget
import 'package:flutter/material.dart'; void main() => runApp( MaterialApp( title: "Hello", home: MainScreen(), ) ); //Full screen class MainScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Hello"), ), body: Content(), ); } } class Content extends StatefulWidget { Content({Key key}) : super(key: key); @override _ContentState createState() => new _ContentState(); } class _ContentState extends State<Content> { @override Widget build(BuildContext context) { return Container(); } }
以上です