「Flutter/モジュール分割」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「lib/main.dart <pre> import 'package:flutter/material.dart'; import 'gallery/app.dart'; void main() { runApp(const GalleryApp()); } </pre> gallery/app.dart <pre> class...」) |
|||
行11: | 行11: | ||
<pre> | <pre> | ||
class GalleryApp extends StatefulWidget { | class GalleryApp extends StatefulWidget { | ||
+ | @override | ||
+ | Widget build(BuildContext context) { | ||
+ | return new MaterialApp( | ||
+ | title: 'Hello Wolrd', | ||
+ | home: new Scaffold( | ||
+ | body: new Center( | ||
+ | child: new Text('Hello World'), | ||
+ | ), | ||
+ | ), | ||
+ | ); | ||
+ | } | ||
} | } | ||
</pre> | </pre> |
2019年4月30日 (火) 00:23時点における版
lib/main.dart
import 'package:flutter/material.dart'; import 'gallery/app.dart'; void main() { runApp(const GalleryApp()); }
gallery/app.dart
class GalleryApp extends StatefulWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Hello Wolrd', home: new Scaffold( body: new Center( child: new Text('Hello World'), ), ), ); } }