diff --git a/firka/lib/ui/phone/widgets/info_card.dart b/firka/lib/ui/phone/widgets/info_card.dart index f1ac7cab..c64be3b7 100644 --- a/firka/lib/ui/phone/widgets/info_card.dart +++ b/firka/lib/ui/phone/widgets/info_card.dart @@ -56,13 +56,20 @@ class InfoCard extends StatelessWidget { size: 24, ), ), - texts: [test.theme.firstUpper(), test.subject.name.firstUpper()], + texts: [ + test.theme?.firstUpper() ?? test.method.description, + test.subject.name.firstUpper(), + ], right: [buildSubject(color, test.subject)], onTap: (context) => showTestBottomSheet(context, initData, test), ); } factory InfoCard.testDesc(Test test) { + if (test.theme == null) { + return InfoCard.test(test); + } + final color = appStyle.colors.accent; return InfoCard( @@ -76,7 +83,7 @@ class InfoCard extends StatelessWidget { size: 24, ), ), - texts: [test.theme.firstUpper(), test.method.description.firstUpper()], + texts: [test.theme!.firstUpper(), test.method.description.firstUpper()], right: [buildSubject(color, test.subject)], onTap: (context) => showTestBottomSheet(context, initData, test), ); diff --git a/firka/lib/ui/phone/widgets/lesson.dart b/firka/lib/ui/phone/widgets/lesson.dart index 3645891b..12910890 100644 --- a/firka/lib/ui/phone/widgets/lesson.dart +++ b/firka/lib/ui/phone/widgets/lesson.dart @@ -244,7 +244,7 @@ class LessonWidget extends StatelessWidget { ); if (test != null && showTests) { - var theme = test!.theme.firstUpper(); + var theme = test!.theme?.firstUpper() ?? ""; var method = test!.method.description.firstUpper(); elements.add( diff --git a/firka/lib/ui/phone/widgets/lesson_big.dart b/firka/lib/ui/phone/widgets/lesson_big.dart index 30ebdc22..5d5698ab 100644 --- a/firka/lib/ui/phone/widgets/lesson_big.dart +++ b/firka/lib/ui/phone/widgets/lesson_big.dart @@ -112,7 +112,7 @@ class LessonBigWidget extends StatelessWidget { SizedBox(width: 8), Expanded( child: Text( - test!.theme, + test!.theme ?? "", style: appStyle.fonts.B_16R.apply( color: appStyle.colors.textPrimary, ), diff --git a/kreta_api/lib/src/model/test.dart b/kreta_api/lib/src/model/test.dart index 00b31989..643d8525 100644 --- a/kreta_api/lib/src/model/test.dart +++ b/kreta_api/lib/src/model/test.dart @@ -9,7 +9,7 @@ class Test extends UidObj { final int lessonNumber; final Subject subject; final String subjectName; - final String theme; + final String? theme; final NameUidDesc method; final UidObj classGroup;