From 556c94f979fdab7a60c7f21b831b903d1c388f20 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 16 Dec 2022 05:38:59 -0600 Subject: [PATCH] example Step 3 Signed-off-by: Jeff Carr --- lib/main.dart | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index e59b547..4d40240 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,17 +13,31 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - final wordPair = WordPair.random(); return MaterialApp( title: 'Welcome to Flutter', home: Scaffold( appBar: AppBar( title: const Text('Welcome to Flutter'), ), - body: Center( - child: Text(wordPair.asPascalCase), + body: const Center( + child: RandomWords(), ), ), ); } -} \ No newline at end of file +} + +class RandomWords extends StatefulWidget { + const RandomWords({Key? key}) : super(key: key); + + @override + State createState() => _RandomWordsState(); +} + +class _RandomWordsState extends State { + @override + Widget build(BuildContext context) { + final wordPair = WordPair.random(); + return Text(wordPair.asPascalCase); + } +}