Begin styling the app.
This commit is contained in:
parent
0cd06931bb
commit
66e1f3a05b
@ -17,7 +17,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: 'Namer App (EXAMPLE PROJECT)',
|
title: 'Namer App (EXAMPLE PROJECT)',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.purple),
|
||||||
),
|
),
|
||||||
home: MyHomePage(),
|
home: MyHomePage(),
|
||||||
),
|
),
|
||||||
@ -39,12 +39,13 @@ 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: Column(
|
||||||
children: [
|
children: [
|
||||||
Text('A random wordpair:'),
|
Text('A random wordpair:'),
|
||||||
Text(appState.current.asLowerCase),
|
BigCard(pair: pair),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
appState.getNext();
|
appState.getNext();
|
||||||
@ -57,3 +58,29 @@ 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(15.0),
|
||||||
|
child: Text(pair.asLowerCase, style: style),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user