diff --git a/firka/lib/app/initialization_screen.dart b/firka/lib/app/initialization_screen.dart index 6dcb9c85..038ea370 100644 --- a/firka/lib/app/initialization_screen.dart +++ b/firka/lib/app/initialization_screen.dart @@ -115,7 +115,9 @@ class _InitializationScreenState extends State { providers: [ BlocProvider.value(value: themeCubit), BlocProvider.value(value: settingsCubit), - BlocProvider.value(value: profilePictureCubit), + BlocProvider.value( + value: profilePictureCubit, + ), BlocProvider.value(value: reauthCubit), BlocProvider.value(value: homeRefreshCubit), ], diff --git a/firka/lib/ui/components/common_bottom_sheets.dart b/firka/lib/ui/components/common_bottom_sheets.dart index ac6f756b..b0117a47 100644 --- a/firka/lib/ui/components/common_bottom_sheets.dart +++ b/firka/lib/ui/components/common_bottom_sheets.dart @@ -861,7 +861,8 @@ Future showHomeworkBottomSheet( shadow: true, child: Card( color: appStyle.colors.card, - shadowColor: context.watch().state.isLightMode + shadowColor: + context.watch().state.isLightMode ? null : Colors.transparent, child: Align( diff --git a/firka/lib/ui/components/firka_card.dart b/firka/lib/ui/components/firka_card.dart index e72370f1..02ba4291 100644 --- a/firka/lib/ui/components/firka_card.dart +++ b/firka/lib/ui/components/firka_card.dart @@ -46,9 +46,7 @@ class FirkaCard extends StatelessWidget { shadow: shadow, child: Card( color: color ?? appStyle.colors.card, - shadowColor: isLight && shadow - ? null - : Colors.transparent, + shadowColor: isLight && shadow ? null : Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular( @@ -96,9 +94,7 @@ class FirkaCard extends StatelessWidget { shadow: shadow, child: Card( color: color ?? appStyle.colors.card, - shadowColor: isLight && shadow - ? null - : Colors.transparent, + shadowColor: isLight && shadow ? null : Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular( diff --git a/firka/lib/ui/phone/pages/home/home_main.dart b/firka/lib/ui/phone/pages/home/home_main.dart index 988656a2..44ff104c 100644 --- a/firka/lib/ui/phone/pages/home/home_main.dart +++ b/firka/lib/ui/phone/pages/home/home_main.dart @@ -217,16 +217,13 @@ class _HomeMainScreen extends FirkaState { Widget? nextTest; bool lessonActive = false; - if (lessons != null && noticeBoard != null && lessons!.isNotEmpty) { + if (lessons != null && lessons!.isNotEmpty) { if (now.isBefore(lessons!.first.start)) { welcomeWidget = StartingSoonWidget(widget.data.l10n, now, lessons!); } else { var currentLesson = lessons!.firstWhereOrNull( (lesson) => now.isAfter(lesson.start) && now.isBefore(lesson.end), ); - // "fun" fact if your clock was exactly when the class ends then isBefore - // and isAfter would fail, so to work around that we just add 1ms to the - // current time var prevLesson = lessons!.getPrevLesson(now); var nextLesson = lessons!.getNextLesson(now); int? lessonIndex; @@ -244,7 +241,7 @@ class _HomeMainScreen extends FirkaState { prevLesson, nextLesson, lessons!, - tests!, + tests ?? [], ); } } @@ -307,15 +304,13 @@ class _HomeMainScreen extends FirkaState { } } - if (student != null && - grades != null && - noticeBoard != null && - lessons != null && - homework != null && - tests != null) { - List<(Widget, DateTime)> noticeBoardWidgets = List.empty(growable: true); + if (student != null && lessons != null) { + final infoItems = infoBoard ?? []; + final gradeItems = grades ?? []; + final homeworkItems = homework ?? []; + final noticeBoardWidgets = <(Widget, DateTime)>[]; - for (final item in infoBoard!) { + for (final item in infoItems) { noticeBoardWidgets.add(( GestureDetector( child: InfoBoardItemWidget(item), @@ -327,7 +322,7 @@ class _HomeMainScreen extends FirkaState { )); } - for (final grade in grades!) { + for (final grade in gradeItems) { noticeBoardWidgets.add(( GestureDetector( child: FirkaCard( @@ -374,7 +369,7 @@ class _HomeMainScreen extends FirkaState { )); } - for (final entry in homework!) { + for (final entry in homeworkItems) { noticeBoardWidgets.add(( HomeworkWidget(widget.data, entry), entry.creationDate,