Created
June 2, 2019 07:27
-
-
Save snova301/cce2d15343e1463b95ec47460dce5d00 to your computer and use it in GitHub Desktop.
flutter get started, part1 step3
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'; | |
import 'package:english_words/english_words.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
// final wordPair = WordPair.random(); // 削除 | |
return MaterialApp( | |
title: 'Welcome to Flutter', | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Welcome to Flutter'), | |
), | |
body: Center( | |
// child: Text(wordPair.asPascalCase), // 削除 | |
child: RandomWords(), // 追加 | |
), | |
), | |
); | |
} | |
} | |
class RandomWords extends StatefulWidget { | |
@override | |
RandomWordsState createState() => RandomWordsState(); | |
} | |
class RandomWordsState extends State<RandomWords> { | |
@override | |
Widget build(BuildContext context) { | |
final wordPair = WordPair.random(); | |
return Text(wordPair.asPascalCase); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment