Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Created March 21, 2018 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshimasa-nanaki/c582b8d95dbd2e455d6cfad2e9cf73fe to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/c582b8d95dbd2e455d6cfad2e9cf73fe to your computer and use it in GitHub Desktop.
flutterアプリを作ってみたい2-2
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