Skip to content
Snippets Groups Projects
Commit db72f0ae authored by Lee Jaehyeok's avatar Lee Jaehyeok
Browse files

codelab4-1

parent 7e4887d8
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,11 @@ class MyApp extends StatelessWidget { ...@@ -27,6 +27,11 @@ class MyApp extends StatelessWidget {
class MyAppState extends ChangeNotifier { class MyAppState extends ChangeNotifier {
var current = WordPair.random(); var current = WordPair.random();
void getNext() {
current = WordPair.random();
notifyListeners();
}
} }
class MyHomePage extends StatelessWidget { class MyHomePage extends StatelessWidget {
...@@ -42,7 +47,7 @@ class MyHomePage extends StatelessWidget { ...@@ -42,7 +47,7 @@ class MyHomePage extends StatelessWidget {
// //
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
print('button pressed!'); appState.getNext();
}, },
child: Text('Next'), child: Text('Next'),
), ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment