Skip to content

Instantly share code, notes, and snippets.

@tetujin
Last active December 23, 2021 02:05
Show Gist options
  • Save tetujin/a160cfebfe077596e2439f1cf11ceb55 to your computer and use it in GitHub Desktop.
Save tetujin/a160cfebfe077596e2439f1cf11ceb55 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: MyHomePage(), // メインページを作成
);
}
}
///////////////////////////////
// ③ アプリのメインページ(固定)
class MyHomePage extends StatelessWidget {
@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