diff --git a/lib/main.dart b/lib/main.dart index 4791e67dd9ce4a8199f7bfcf7b196dab46b6d3aa..a8e30418ac525284b6e69c2834bcadb6c7d3369c 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'), + ), + ], ), ); }