diff --git a/namer_app/lib/main.dart b/namer_app/lib/main.dart index ca550b3..e0f3427 100644 --- a/namer_app/lib/main.dart +++ b/namer_app/lib/main.dart @@ -14,7 +14,7 @@ class MyApp extends StatelessWidget { return ChangeNotifierProvider( create: (context) => MyAppState(), child: MaterialApp( - title: 'Namer App', + title: 'Namer App (EXAMPLE PROJECT)', theme: ThemeData( useMaterial3: true, colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange), @@ -26,7 +26,13 @@ class MyApp extends StatelessWidget { } class MyAppState extends ChangeNotifier { - var current = WordPair.random(); + var current = WordPair.random();// ... + + // ↓ Add this. + void getNext() { + current = WordPair.random(); + notifyListeners(); + } } class MyHomePage extends StatelessWidget { @@ -37,8 +43,15 @@ class MyHomePage extends StatelessWidget { return Scaffold( body: Column( children: [ - Text('A random idea:'), + Text('A random wordpair:'), Text(appState.current.asLowerCase), + ElevatedButton( + onPressed: () { + appState.getNext(); + }, + child: Text('Next'), + ), + ], ), );