Skip to content
Snippets Groups Projects
Commit 0b7e9fca authored by ahnjuseong's avatar ahnjuseong
Browse files

4단계 완료

parent 4e808948
Branches
No related tags found
1 merge request!1Roll Packages from 611aea1657fb to 28d126c54c63 (1 revision) (#145690)
......@@ -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'),
),
],
),
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment