diff --git a/.github/workflows/flutter_application_1/assign/lib/main.dart b/.github/workflows/flutter_application_1/assign/lib/main.dart index 3ff50641202bb3a186a22a337d4e15b7448ca22f..e6ed70be006858b4a5370b48e8eccef31dab7364 100644 --- a/.github/workflows/flutter_application_1/assign/lib/main.dart +++ b/.github/workflows/flutter_application_1/assign/lib/main.dart @@ -27,6 +27,11 @@ class MyApp extends StatelessWidget { class MyAppState extends ChangeNotifier { var current = WordPair.random(); + // ↓ Add this. + void getNext() { + current = WordPair.random(); + notifyListeners(); + } } class MyHomePage extends StatelessWidget { @@ -37,8 +42,16 @@ class MyHomePage extends StatelessWidget { return Scaffold( body: Column( children: [ - Text('A random idea:'), + Text('A random AWESOME idea:'), // ← Example change. Text(appState.current.asLowerCase), + // ↓ Add this. + ElevatedButton( + onPressed: () { + appState.getNext(); // ← This instead of print(). + }, + child: Text('Next'), + ), + ], ), );