From ce79b2d0e7e68715dbebb4e77958791f2c68ec15 Mon Sep 17 00:00:00 2001 From: Jingeun Lee <exploitsori@ajou.ac.kr> Date: Wed, 16 Apr 2025 18:24:51 +0900 Subject: [PATCH] =?UTF-8?q?4.=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 4791e67..a8e3041 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,6 +26,11 @@ class MyApp extends StatelessWidget { class MyAppState extends ChangeNotifier { var current = WordPair.random(); + + void getNext() { + current = WordPair.random(); + notifyListeners(); + } } class MyHomePage extends StatelessWidget { @@ -35,7 +40,16 @@ class MyHomePage extends StatelessWidget { return Scaffold( body: Column( - children: [Text('A random idea:'), Text(appState.current.asLowerCase)], + children: [ + Text('A random AWESOME idea:'), + Text(appState.current.asLowerCase), + ElevatedButton( + onPressed: () { + appState.getNext(); + }, + child: Text('Next'), + ), + ], ), ); } -- GitLab