Skip to content
Snippets Groups Projects
Commit f1bbba59 authored by Jingeun Lee's avatar Jingeun Lee
Browse files

5. 더 멋진 앱 만들기

parent ce79b2d0
Branches
No related tags found
No related merge requests found
...@@ -37,12 +37,15 @@ class MyHomePage extends StatelessWidget { ...@@ -37,12 +37,15 @@ class MyHomePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var appState = context.watch<MyAppState>(); var appState = context.watch<MyAppState>();
var pair = appState.current;
return Scaffold( return Scaffold(
body: Column( body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('A random AWESOME idea:'), BigCard(pair: pair),
Text(appState.current.asLowerCase), SizedBox(height: 10),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
appState.getNext(); appState.getNext();
...@@ -51,6 +54,33 @@ class MyHomePage extends StatelessWidget { ...@@ -51,6 +54,33 @@ class MyHomePage extends StatelessWidget {
), ),
], ],
), ),
),
);
}
}
class BigCard extends StatelessWidget {
const BigCard({super.key, required this.pair});
final WordPair pair;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final style = theme.textTheme.displayMedium!.copyWith(
color: theme.colorScheme.onPrimary,
);
return Card(
color: theme.colorScheme.primary,
child: Padding(
padding: const EdgeInsets.all(20),
child: Text(
pair.asLowerCase,
style: style,
semanticsLabel: "${pair.first} ${pair.second}",
),
),
); );
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment