Skip to content

Latest commit

 

History

History
45 lines (44 loc) · 1.02 KB

File metadata and controls

45 lines (44 loc) · 1.02 KB
  1. Add class
class RandomWordsState extends State<RandomWords> {
  // TODO Add build method
}
  1. Add class
class RandomWords extends StatefulWidget {
  @override
  RandomWordsState createState() => RandomWordsState();
}
  1. Change class RandomWrodsState
class RandomWordsState extends State<RandomWords> {
  @override 
  Widget build(BuildContext context) {
    final WordPair wordPair = WordPair.random();
    return Text(wordPair.asPascalCase);
  }
}
  1. Change class MyApp
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final WordPair wordPair = WordPair.random();  // Delete this line.

    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: Center(
          //child: Text(wordPair.asPascalCase), // Change this line to... 
          child: RandomWords(),                 // ... this line.
        ),
      ),
    );
  }
}