From f9cdc1ec4bf32938cf8d10780c54714a531a5dd6 Mon Sep 17 00:00:00 2001 From: unknown <asdfqwer1234@ajou.ac.kr> Date: Tue, 24 Sep 2024 18:08:39 +0900 Subject: [PATCH] codelab5 --- devtools_options.yaml | 3 +++ lib/main.dart | 59 +++++++++++++++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 devtools_options.yaml diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/lib/main.dart b/lib/main.dart index be19051..0007bda 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,7 +17,7 @@ class MyApp extends StatelessWidget { title: 'Namer App', theme: ThemeData( useMaterial3: true, - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange), + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), ), home: MyHomePage(), ), @@ -38,20 +38,53 @@ class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { var appState = context.watch<MyAppState>(); + var pair = appState.current; return Scaffold( - body: Column( - children: [ - Text('A random AWESOME idea:'), - Text(appState.current.asLowerCase), - // - ElevatedButton( - onPressed: () { - appState.getNext(); - }, - child: Text('Next'), - ), - ], + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('A random AWESOME idea:'), + BigCard(pair: pair), + SizedBox(height: 10), + ElevatedButton( + onPressed: () { + appState.getNext(); + }, + child: Text('Next'), + ), + ], + ), + ), + ); + } +} + +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}", + ), ), ); } -- GitLab