Skip to content

Commit cee0a8d

Browse files
committed
package updates
1 parent f6de9f7 commit cee0a8d

50 files changed

Lines changed: 1699 additions & 96 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/app/app_router/app_router.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import 'package:magic_yeti/app/app_router/go_router_refresh_stream.dart';
55
import 'package:magic_yeti/app/bloc/app_bloc.dart';
66
import 'package:magic_yeti/home/home_page.dart';
77
import 'package:magic_yeti/life_counter/view/view.dart';
8+
import 'package:magic_yeti/login/login.dart';
9+
import 'package:magic_yeti/reset_password/reset_password.dart';
10+
import 'package:magic_yeti/sign_up/sign_up.dart';
811

912
class AppRouter {
1013
AppRouter({
@@ -59,6 +62,29 @@ class AppRouter {
5962
child: GamePage.pageBuilder(context, state),
6063
),
6164
),
65+
AppRoute(
66+
name: LoginPage.routeName,
67+
path: LoginPage.routeName,
68+
appStatus: AppStatus.unauthenticated,
69+
pageBuilder: (context, state) => NoTransitionPage(
70+
name: LoginPage.routeName,
71+
child: LoginPage.pageBuilder(context, state),
72+
),
73+
routes: [
74+
AppRoute(
75+
name: ResetPasswordPage.routeName,
76+
path: ResetPasswordPage.routeName,
77+
appStatus: AppStatus.unauthenticated,
78+
builder: ResetPasswordPage.pageBuilder,
79+
),
80+
],
81+
),
82+
AppRoute(
83+
name: SignUpPage.routeName,
84+
path: SignUpPage.routeName,
85+
appStatus: AppStatus.unauthenticated,
86+
builder: SignUpPage.pageBuilder,
87+
),
6288
],
6389
);
6490
}

lib/home/home_page.dart

Lines changed: 123 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import 'package:app_ui/app_ui.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
66
import 'package:go_router/go_router.dart';
7+
import 'package:magic_yeti/app/bloc/app_bloc.dart';
78
import 'package:magic_yeti/game/bloc/game_bloc.dart';
89
import 'package:magic_yeti/l10n/l10n.dart';
910
import 'package:magic_yeti/life_counter/life_counter.dart';
11+
import 'package:magic_yeti/login/login.dart';
12+
import 'package:magic_yeti/sign_up/sign_up.dart';
1013

1114
class HomePage extends StatelessWidget {
1215
const HomePage({super.key});
@@ -83,10 +86,31 @@ class LeftSidePanel extends StatelessWidget {
8386
Expanded(
8487
child: GameModeButtons(l10n: l10n),
8588
),
86-
const Expanded(
89+
Expanded(
8790
child: Column(
8891
children: [
89-
SectionHeader(title: 'Player Stats'),
92+
const SectionHeader(title: 'Your Stats'),
93+
Expanded(
94+
child: Column(
95+
mainAxisAlignment: MainAxisAlignment.center,
96+
children: [
97+
ElevatedButton(
98+
onPressed: () => context.push(LoginPage.routeName),
99+
child: const Text('Login'),
100+
),
101+
ElevatedButton(
102+
onPressed: () => context.push(SignUpPage.routeName),
103+
child: const Text('Sign Up'),
104+
),
105+
ElevatedButton(
106+
onPressed: () => context
107+
.read<AppBloc>()
108+
.add(const AppLogoutRequested()),
109+
child: const Text('Logout'),
110+
),
111+
],
112+
),
113+
),
90114
],
91115
),
92116
),
@@ -183,79 +207,17 @@ class CustomListItem extends StatelessWidget {
183207
child: Row(
184208
children: <Widget>[
185209
// Left section - Large thumbnail
186-
Container(
187-
width: 120,
188-
height: 120,
189-
child: ClipRRect(
190-
borderRadius: const BorderRadius.only(
191-
topLeft: Radius.circular(4),
192-
bottomLeft: Radius.circular(4),
193-
),
194-
child: thumbnail,
195-
),
196-
),
197-
const SizedBox(
198-
width: 5,
199-
),
210+
WinnerWidget(thumbnail: thumbnail),
211+
const SizedBox(width: 5),
200212
// Middle section - Three stacked thumbnails
201-
SizedBox(
202-
width: 40,
203-
child: Column(
204-
children: [
205-
Expanded(
206-
child: Image.network(
207-
fit: BoxFit.cover,
208-
commanderList[Random().nextInt(commanderList.length)],
209-
),
210-
),
211-
Expanded(
212-
child: Image.network(
213-
fit: BoxFit.cover,
214-
commanderList[Random().nextInt(commanderList.length)],
215-
),
216-
),
217-
Expanded(
218-
child: Image.network(
219-
fit: BoxFit.cover,
220-
commanderList[Random().nextInt(commanderList.length)],
221-
),
222-
),
223-
],
224-
),
225-
),
213+
const LosersWidget(),
226214

227215
// Right section - Text information
228-
Expanded(
229-
child: Padding(
230-
padding: const EdgeInsets.symmetric(horizontal: 12.0),
231-
child: Column(
232-
crossAxisAlignment: CrossAxisAlignment.start,
233-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
234-
children: [
235-
Text(
236-
title,
237-
style: TextStyle(
238-
fontWeight: FontWeight.w500,
239-
fontSize: textStyle.headlineMedium?.fontSize,
240-
),
241-
),
242-
Text(
243-
user,
244-
style: const TextStyle(
245-
fontSize: 14.0,
246-
color: Colors.grey,
247-
),
248-
),
249-
Text(
250-
'$viewCount views',
251-
style: const TextStyle(
252-
fontSize: 14.0,
253-
color: Colors.grey,
254-
),
255-
),
256-
],
257-
),
258-
),
216+
DetailsWidget(
217+
title: title,
218+
textStyle: textStyle,
219+
user: user,
220+
viewCount: viewCount,
259221
),
260222
],
261223
),
@@ -264,47 +226,116 @@ class CustomListItem extends StatelessWidget {
264226
}
265227
}
266228

267-
class _VideoDescription extends StatelessWidget {
268-
const _VideoDescription({
229+
class DetailsWidget extends StatelessWidget {
230+
const DetailsWidget({
269231
required this.title,
232+
required this.textStyle,
270233
required this.user,
271234
required this.viewCount,
235+
super.key,
272236
});
273237

274238
final String title;
239+
final TextTheme textStyle;
275240
final String user;
276241
final int viewCount;
277242

278243
@override
279244
Widget build(BuildContext context) {
280-
return Padding(
281-
padding: const EdgeInsets.fromLTRB(5.0, 0.0, 0.0, 0.0),
245+
return Expanded(
246+
child: Padding(
247+
padding: const EdgeInsets.symmetric(horizontal: 12),
248+
child: Column(
249+
crossAxisAlignment: CrossAxisAlignment.start,
250+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
251+
children: [
252+
Text(
253+
title,
254+
style: TextStyle(
255+
fontWeight: FontWeight.w500,
256+
fontSize: textStyle.headlineMedium?.fontSize,
257+
),
258+
),
259+
Text(
260+
user,
261+
style: const TextStyle(
262+
fontSize: 14,
263+
color: Colors.grey,
264+
),
265+
),
266+
Text(
267+
'$viewCount views',
268+
style: const TextStyle(
269+
fontSize: 14,
270+
color: Colors.grey,
271+
),
272+
),
273+
],
274+
),
275+
),
276+
);
277+
}
278+
}
279+
280+
class LosersWidget extends StatelessWidget {
281+
const LosersWidget({
282+
super.key,
283+
});
284+
285+
@override
286+
Widget build(BuildContext context) {
287+
return SizedBox(
288+
width: 40,
282289
child: Column(
283-
crossAxisAlignment: CrossAxisAlignment.start,
284-
children: <Widget>[
285-
Text(
286-
title,
287-
style: const TextStyle(
288-
fontWeight: FontWeight.w500,
289-
fontSize: 14.0,
290+
children: [
291+
Expanded(
292+
child: Image.network(
293+
fit: BoxFit.cover,
294+
commanderList[Random().nextInt(commanderList.length)],
290295
),
291296
),
292-
const Padding(padding: EdgeInsets.symmetric(vertical: 2.0)),
293-
Text(
294-
user,
295-
style: const TextStyle(fontSize: 10.0),
297+
Expanded(
298+
child: Image.network(
299+
fit: BoxFit.cover,
300+
commanderList[Random().nextInt(commanderList.length)],
301+
),
296302
),
297-
const Padding(padding: EdgeInsets.symmetric(vertical: 1.0)),
298-
Text(
299-
'$viewCount views',
300-
style: const TextStyle(fontSize: 10.0),
303+
Expanded(
304+
child: Image.network(
305+
fit: BoxFit.cover,
306+
commanderList[Random().nextInt(commanderList.length)],
307+
),
301308
),
302309
],
303310
),
304311
);
305312
}
306313
}
307314

315+
class WinnerWidget extends StatelessWidget {
316+
const WinnerWidget({
317+
required this.thumbnail,
318+
super.key,
319+
});
320+
321+
final Widget thumbnail;
322+
323+
@override
324+
Widget build(BuildContext context) {
325+
return SizedBox(
326+
width: 120,
327+
height: 120,
328+
child: ClipRRect(
329+
borderRadius: const BorderRadius.only(
330+
topLeft: Radius.circular(4),
331+
bottomLeft: Radius.circular(4),
332+
),
333+
child: thumbnail,
334+
),
335+
);
336+
}
337+
}
338+
308339
final List<String> commanderList = [
309340
'https://cards.scryfall.io/art_crop/front/d/6/d67be074-cdd4-41d9-ac89-0a0456c4e4b2.jpg?1674057568',
310341
'https://cards.scryfall.io/art_crop/front/0/6/066c8f63-52e6-475e-8d27-6ee37e92fc05.jpg?1591234280',
@@ -327,5 +358,5 @@ final List<String> players = [
327358
'Nick',
328359
'Luke',
329360
'Scotty',
330-
'Brendan'
361+
'Brendan',
331362
];

0 commit comments

Comments
 (0)