Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/empty state illustrations #1415

Open
wants to merge 5 commits into
base: ui/redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added packages/uni_app/assets/images/no_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/uni_app/assets/images/papers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@ class ImageLabel extends StatelessWidget {
this.labelTextStyle,
this.sublabel = '',
this.sublabelTextStyle,
this.subheight = 300,
this.subwidth = 300,
});
final String imagePath;
final String label;
final TextStyle? labelTextStyle;
final String sublabel;
final TextStyle? sublabelTextStyle;

final double subheight;
final double subwidth;

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Image.asset(
imagePath,
height: 300,
width: 300,
height: subheight,
width: subwidth,
),
Text(
label,
Expand Down
16 changes: 12 additions & 4 deletions packages/uni_app/lib/view/home/widgets/exam_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:uni/generated/l10n.dart';
import 'package:uni/model/entities/exam.dart';
import 'package:uni/model/providers/lazy/exam_provider.dart';
import 'package:uni/utils/navigation_items.dart';
import 'package:uni/view/common_widgets/expanded_image_label.dart';
import 'package:uni/view/common_widgets/generic_card.dart';
import 'package:uni/view/home/widgets/exam_card_shimmer.dart';
import 'package:uni/view/home/widgets/next_exams_card.dart';
Expand Down Expand Up @@ -89,10 +90,17 @@ class ExamCard extends GenericCard {
},
hasContent: (allExams) =>
getVisibleExams(allExams, hiddenExams).isNotEmpty,
onNullContent: Center(
child: Text(
S.of(context).no_selected_exams,
style: Theme.of(context).textTheme.titleLarge,
onNullContent: const Center(
child: ImageLabel(
imagePath: 'assets/images/papers.png',
label: 'Não há exames',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use translations

labelTextStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.grey,
),
subwidth: 130,
subheight: 130,
),
),
contentLoadingWidget: const ExamCardShimmer(),
Expand Down
17 changes: 12 additions & 5 deletions packages/uni_app/lib/view/home/widgets/schedule_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:uni/model/providers/lazy/lecture_provider.dart';
import 'package:uni/model/utils/time/week.dart';
import 'package:uni/utils/navigation_items.dart';
import 'package:uni/view/common_widgets/date_rectangle.dart';
import 'package:uni/view/common_widgets/expanded_image_label.dart';
import 'package:uni/view/common_widgets/generic_card.dart';
import 'package:uni/view/home/widgets/schedule_card_shimmer.dart';
import 'package:uni/view/lazy_consumer.dart';
Expand Down Expand Up @@ -41,11 +42,17 @@ class ScheduleCard extends GenericCard {
children: getScheduleRows(context, lectures),
),
hasContent: (lectures) => lectures.isNotEmpty,
onNullContent: Center(
child: Text(
S.of(context).no_classes,
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
onNullContent: const Center(
child: ImageLabel(
imagePath: 'assets/images/no_data.png',
label: 'Não há aulas',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use translations

labelTextStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.grey,
),
subheight: 130,
subwidth: 130,
),
),
contentLoadingWidget: const ScheduleCardShimmer().build(context),
Expand Down
Loading