Skip to content

Commit

Permalink
fix: only navigate to day wise attendance if lectures are greater than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Garg committed Sep 7, 2022
1 parent 3baa431 commit 107c015
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
6 changes: 1 addition & 5 deletions lib/cubits/attendance/attendance_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ class AttendanceCubit extends Cubit<AttendanceState> {
_extraLectures = extraLectures;
_mainLectures = mainLectures;
_subId = subjectId;
if (mainLectures.isNotEmpty) {
_calculate();
} else {
emit(state.copyWith(loading: false));
}
_calculate();
}

changeDate(DateTime date) {
Expand Down
26 changes: 16 additions & 10 deletions lib/ui/home/widgets/subjects_list_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:edtrack/ui/common/custom_snackbar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -30,16 +31,21 @@ class SubjectsListView extends StatelessWidget {
shape: AppTheme.cardShape,
child: InkWell(
borderRadius: BorderRadius.circular(AppTheme.cardRadius),
onTap: () => Navigator.push(
context,
CupertinoPageRoute(
builder: (_) => SubjectAttendance(
mainLectures: attendance.attendanceData,
extraLectures: attendance.extraLectures,
subject: subject,
),
),
),
onTap: () => subject.totalLectures > 0
? Navigator.push(
context,
CupertinoPageRoute(
builder: (_) => SubjectAttendance(
mainLectures: attendance.attendanceData,
extraLectures: attendance.extraLectures,
subject: subject,
),
),
)
: showCustomSnack(
context: context,
message: 'No lectures to show for this subject yet',
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ListTile(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Edumarshal client for AKGEC

publish_to: "none"

version: 1.3.1+10
version: 1.4.0+11

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down

0 comments on commit 107c015

Please sign in to comment.