Created
March 21, 2018 07:09
-
-
Save toshimasa-nanaki/c582b8d95dbd2e455d6cfad2e9cf73fe to your computer and use it in GitHub Desktop.
flutterアプリを作ってみたい2-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
/// english_wordsパッケージを追加する | |
import 'package:english_words/english_words.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
/// ランダムな2単語を生成してくれます。 | |
final wordPair = new WordPair.random(); | |
return new MaterialApp( | |
title: 'Flutterへようこそ', | |
home: new Scaffold( | |
appBar: new AppBar( | |
title: new Text('Flutterへようこそ'), | |
), | |
body: new Center( | |
/// 画面中央に表示する文字列を変更します。 | |
/// asPascalCaseは「upper camel case」と同義で、単語の先頭は大文字になる表記です。 | |
/// つまり、helloとworldの2文字があったとしたら、「HelloWorld」みたいになります。 | |
/// 今回は生成された2単語をつなぎ合わせます。 | |
child: new Text(wordPair.asPascalCase), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment