example Step 3

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2022-12-16 05:38:59 -06:00
parent 2c2ef644a7
commit 556c94f979
1 changed files with 18 additions and 4 deletions

View File

@ -13,17 +13,31 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final wordPair = WordPair.random();
return MaterialApp( return MaterialApp(
title: 'Welcome to Flutter', title: 'Welcome to Flutter',
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Welcome to Flutter'), title: const Text('Welcome to Flutter'),
), ),
body: Center( body: const Center(
child: Text(wordPair.asPascalCase), child: RandomWords(),
), ),
), ),
); );
} }
} }
class RandomWords extends StatefulWidget {
const RandomWords({Key? key}) : super(key: key);
@override
State<RandomWords> createState() => _RandomWordsState();
}
class _RandomWordsState extends State<RandomWords> {
@override
Widget build(BuildContext context) {
final wordPair = WordPair.random();
return Text(wordPair.asPascalCase);
}
}