Skip to content

Instantly share code, notes, and snippets.

@tetujin
Created December 23, 2021 01:45
Show Gist options
  • Save tetujin/5d9e1fb27120f9d0d5e8d9748bcdd68a to your computer and use it in GitHub Desktop.
Save tetujin/5d9e1fb27120f9d0d5e8d9748bcdd68a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
///////////////////////////////
// ① Main:Flutterアプリもmain()からコードが実行されます。
// `void main() => runApp(MyApp());` でも意味は同じです。
void main() {
return runApp(MyApp());
}
///////////////////////////////
// ② アプリの基盤:アプリのテーマやスタイルを設定する。その上のページを追加していく。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// MaterialAppという形式のアプリを作成
return MaterialApp(
theme: ThemeData(), // アプリのテーマカラーなど詳細を入力
home: const MyHomePage(), // メインページを作成
);
}
}
///////////////////////////////
// ③ アプリのメインページ
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
// ④ アプリのメインページの状態
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Menu Bar"),
),
body: Center(
child: Text("ABC"),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment