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

Add illustration to empty page #1508

Open
wants to merge 6 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/files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions packages/uni_app/lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
Expand All @@ -21,8 +20,8 @@ import 'messages_pt_PT.dart' as messages_pt_pt;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'pt_PT': () => new SynchronousFuture(null),
'en': () => new Future.value(null),
'pt_PT': () => new Future.value(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -37,18 +36,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new SynchronousFuture(false);
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
return new Future.value(true);
}

bool _messagesExistFor(String locale) {
Expand Down
19 changes: 11 additions & 8 deletions packages/uni_app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -20,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

static String m0(type) => "${Intl.select(type, {
static m0(type) => "${Intl.select(type, {
'all_dishes': 'All dishes',
'meat_dishes': 'Meat dishes',
'fish_dishes': 'Fish dishes',
Expand All @@ -32,12 +31,12 @@ class MessageLookup extends MessageLookupByLibrary {
'other': 'Other',
})}";

static String m1(time) => "last refresh at ${time}";
static m1(time) => "last refresh at ${time}";

static String m2(time) =>
static m2(time) =>
"${Intl.plural(time, zero: 'Refreshed ${time} minutes ago', one: 'Refreshed ${time} minute ago', other: 'Refreshed ${time} minutes ago')}";

static String m3(title) => "${Intl.select(title, {
static m3(title) => "${Intl.select(title, {
'horario': 'Schedule',
'exames': 'Exams',
'area': 'Personal Area',
Expand All @@ -53,14 +52,14 @@ class MessageLookup extends MessageLookupByLibrary {
'other': 'Other',
})}";

static String m4(period) => "${Intl.select(period, {
static m4(period) => "${Intl.select(period, {
'lunch': 'Lunch',
'dinner': 'Dinner',
'other': 'Other',
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
static _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("About us"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Academic services"),
Expand Down Expand Up @@ -248,8 +247,12 @@ class MessageLookup extends MessageLookupByLibrary {
"Looks like you are on vacation!"),
"no_favorite_restaurants":
MessageLookupByLibrary.simpleMessage("No favorite restaurants"),
"no_files":
MessageLookupByLibrary.simpleMessage("There\'s no files attached"),
"no_files_found":
MessageLookupByLibrary.simpleMessage("No files found"),
"no_files_label":
MessageLookupByLibrary.simpleMessage("You have nothing to see!"),
"no_info": MessageLookupByLibrary.simpleMessage(
"There is no information to display"),
"no_internet": MessageLookupByLibrary.simpleMessage(
Expand Down
19 changes: 11 additions & 8 deletions packages/uni_app/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -20,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'pt_PT';

static String m0(type) => "${Intl.select(type, {
static m0(type) => "${Intl.select(type, {
'all_dishes': 'Todos os pratos',
'meat_dishes': 'Pratos de Carne',
'fish_dishes': 'Pratos de Peixe',
Expand All @@ -32,12 +31,12 @@ class MessageLookup extends MessageLookupByLibrary {
'other': 'Outros',
})}";

static String m1(time) => "última atualização às ${time}";
static m1(time) => "última atualização às ${time}";

static String m2(time) =>
static m2(time) =>
"${Intl.plural(time, zero: 'Atualizado há ${time} minutos', one: 'Atualizado há ${time} minuto', other: 'Atualizado há ${time} minutos')}";

static String m3(title) => "${Intl.select(title, {
static m3(title) => "${Intl.select(title, {
'horario': 'Horário',
'exames': 'Exames',
'area': 'Área Pessoal',
Expand All @@ -53,14 +52,14 @@ class MessageLookup extends MessageLookupByLibrary {
'other': 'Outros',
})}";

static String m4(period) => "${Intl.select(period, {
static m4(period) => "${Intl.select(period, {
'lunch': 'Almoço',
'dinner': 'Jantar',
'other': 'Other',
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
static _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("Sobre nós"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Serviços académicos"),
Expand Down Expand Up @@ -247,8 +246,12 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Parece que estás de férias!"),
"no_favorite_restaurants":
MessageLookupByLibrary.simpleMessage("Sem restaurantes favoritos"),
"no_files": MessageLookupByLibrary.simpleMessage(
"Não possui ficheiros anexados"),
"no_files_found":
MessageLookupByLibrary.simpleMessage("Nenhum ficheiro encontrado"),
"no_files_label":
MessageLookupByLibrary.simpleMessage("Não tens nada para ver!"),
"no_info": MessageLookupByLibrary.simpleMessage(
"Não existem informações para apresentar"),
"no_internet":
Expand Down
22 changes: 21 additions & 1 deletion packages/uni_app/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/uni_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@
"@no_exams": {},
"no_exams_label": "Looks like you are on vacation!",
"@no_exams_label": {},
"no_files": "There's no files attached",
"@no_files": {},
"no_files_label": "You have nothing to see!",
"@no_files_label": {},
"no_favorite_restaurants": "No favorite restaurants",
"@no_favorite_restaurants": {},
"no_info": "There is no information to display",
Expand Down
4 changes: 4 additions & 0 deletions packages/uni_app/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@
"@no_events": {},
"no_exams_label": "Parece que estás de férias!",
"@no_exams_label": {},
"no_files": "Não possui ficheiros anexados",
"@no_files": {},
"no_files_label": "Não tens nada para ver!",
"@no_files_label": {},
"no_favorite_restaurants": "Sem restaurantes favoritos",
"@no_favorite_restaurants": {},
"no_info": "Não existem informações para apresentar",
Expand Down
15 changes: 11 additions & 4 deletions packages/uni_app/lib/view/course_unit_info/course_unit_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:uni/model/providers/startup/session_provider.dart';
import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart';
import 'package:uni/view/course_unit_info/widgets/course_unit_classes.dart';
import 'package:uni/view/course_unit_info/widgets/course_unit_files.dart';
import 'package:uni/view/course_unit_info/widgets/course_unit_no_files.dart';
import 'package:uni/view/course_unit_info/widgets/course_unit_sheet.dart';
import 'package:uni_ui/icons.dart';
import 'package:uni_ui/tabs/tab_icon.dart';
Expand Down Expand Up @@ -138,10 +139,16 @@ class CourseUnitDetailPageViewState
.courseUnitsFiles[widget.courseUnit];

if (files == null || files.isEmpty) {
return Center(
child: Text(
S.of(context).no_files_found,
textAlign: TextAlign.center,
return LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Container(
height: constraints.maxHeight,
padding: const EdgeInsets.only(bottom: 120),
child: const Center(
child: NoFilesWidget(),
),
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import 'package:uni/view/common_widgets/toast_message.dart';
import 'package:uni_ui/cards/file_card.dart';
import 'package:uni_ui/cards/folder_card.dart';

import 'course_unit_no_files.dart';

class CourseUnitFilesView extends StatelessWidget {
const CourseUnitFilesView(this.files, {super.key});
final List<CourseUnitFileDirectory> files;
Expand All @@ -22,10 +24,16 @@ class CourseUnitFilesView extends StatelessWidget {
.toList();

return cards.isEmpty
? Center(
child: Container(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Text(S.of(context).no_files_found),
? LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Container(
height: constraints.maxHeight,
padding: const EdgeInsets.only(bottom: 120),
child: const Center(
child: NoFilesWidget(),
),
),
),
)
: Container(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:uni/generated/l10n.dart';
import 'package:uni/view/common_widgets/expanded_image_label.dart';

class NoFilesWidget extends StatelessWidget {
const NoFilesWidget({super.key});

@override
Widget build(BuildContext context) {
return ImageLabel(
imagePath: 'assets/images/files.png',
label: S.of(context).no_files_label,
labelTextStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Theme.of(context).colorScheme.primary,
),
sublabel: S.of(context).no_files,
sublabelTextStyle: const TextStyle(fontSize: 15),
);
}
}