「Flutter/モジュール分割」の版間の差分
提供: 初心者エンジニアの簡易メモ
| (同じ利用者による、間の2版が非表示) | |||
| 行8: | 行8: | ||
<pre> | <pre> | ||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||
| − | + | void main() => runApp(new MyApp()); | |
| − | + | ||
| − | + | ||
class MyApp extends StatelessWidget { | class MyApp extends StatelessWidget { | ||
| − | |||
@override | @override | ||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||
| − | return MaterialApp( | + | return new MaterialApp( |
| − | title: ' | + | title: 'Hello Wolrd', |
| − | + | home: new Scaffold( | |
| − | + | body: new Center( | |
| − | + | child: new Text('Hello World'), | |
| − | + | ), | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
), | ), | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
); | ); | ||
} | } | ||
} | } | ||
</pre> | </pre> | ||
2019年4月30日 (火) 00:52時点における最新版
lib/main.dart
import 'helloworld/app.dart'; void main() => runApp(MyApp());
helloworld/app.dart
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Hello Wolrd',
home: new Scaffold(
body: new Center(
child: new Text('Hello World'),
),
),
);
}
}
