Skip to content

Commit 7e8a16f

Browse files
committed
fix(ui): push session routes
1 parent a31756e commit 7e8a16f

File tree

1 file changed

+50
-12
lines changed

1 file changed

+50
-12
lines changed

lib/Screens/Racing/circuit.dart

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,56 @@ class SessionItemForCircuit extends StatelessWidget {
341341
return Padding(
342342
padding: EdgeInsets.symmetric(vertical: 5),
343343
child: InkWell(
344-
onTap: () => Navigator.push(
345-
context,
346-
MaterialPageRoute(
347-
builder: (context) => SessionScreen(
348-
sessionFullName,
349-
session,
350-
meetingCountryName,
351-
meetingOfficialName,
352-
meetingId,
353-
),
354-
),
355-
),
344+
onTap: () =>
345+
session.endTime.isAfter(DateTime.now()) || session.isRunning
346+
? Navigator.push(
347+
context,
348+
MaterialPageRoute(
349+
builder: (context) => SessionScreen(
350+
sessionFullName,
351+
session,
352+
meetingCountryName,
353+
meetingOfficialName,
354+
meetingId,
355+
),
356+
),
357+
)
358+
: session.sessionsAbbreviation.startsWith('p')
359+
? context.pushNamed(
360+
'practice',
361+
pathParameters: {
362+
'meetingId': meetingId,
363+
'sessionIndex':
364+
session.sessionsAbbreviation.substring(1)
365+
},
366+
)
367+
: session.sessionsAbbreviation == 'ss'
368+
? context.pushNamed(
369+
'sprint-shootout',
370+
pathParameters: {
371+
'meetingId': meetingId,
372+
},
373+
)
374+
: session.sessionsAbbreviation == 's'
375+
? context.pushNamed(
376+
'sprint',
377+
pathParameters: {
378+
'meetingId': meetingId,
379+
},
380+
)
381+
: session.sessionsAbbreviation == 'q'
382+
? context.pushNamed(
383+
'qualifyings',
384+
pathParameters: {
385+
'meetingId': meetingId,
386+
},
387+
)
388+
: context.pushNamed(
389+
'race',
390+
pathParameters: {
391+
'meetingId': meetingId,
392+
},
393+
),
356394
borderRadius: BorderRadius.circular(6),
357395
child: Ink(
358396
height: 80,

0 commit comments

Comments
 (0)