Skip to content

Commit

Permalink
Merge pull request #45 from B3-3iL-DLW/ui/shared-design-and-splash
Browse files Browse the repository at this point in the history
UI/shared design and splash
  • Loading branch information
julesartd authored Mar 15, 2024
2 parents 3baaf3c + f716368 commit 9148d9a
Show file tree
Hide file tree
Showing 82 changed files with 547 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<application
android:label="app_student"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 frontend/app_student/assets/icon/3il-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions frontend/app_student/flutter_launcher_icons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
dev_dependencies:
flutter_launcher_icons: "^0.13.1"

flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/3il-icon.png"
min_sdk_android: 21 # android min sdk min:16, default 21
web:
generate: true
image_path: "assets/icon/3il-icon.png"
background_color: "#FFFFF"
theme_color: "#FFFFF"
windows:
generate: true
image_path: "assets/icon/3il-icon.png"
icon_size: 48 # min:48, max:256, default: 48
macos:
generate: true
image_path: "assets/icon/3il-icon.png"
4 changes: 2 additions & 2 deletions frontend/app_student/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -484,7 +484,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 +8,5 @@ class UserEntity {
{required this.ine,
required this.firstName,
required this.birthDate,
this.className = ''});
this.className});
}
2 changes: 1 addition & 1 deletion frontend/app_student/lib/api/users/models/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class UserModel {
String get file => entity.ine;
String get name => entity.firstName;
DateTime get birthDate => entity.birthDate;
String? get className => entity.className ?? '';
String? get className => entity.className;
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ class UserRepository {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('className', className);
}

Future<void> delete() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove('ine');
await prefs.remove('name');
await prefs.remove('birthDate');
await prefs.remove('className');
}
}
76 changes: 76 additions & 0 deletions frontend/app_student/lib/class_groups/views/class_group.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'package:app_student/api/class_groups/repositories/class_group_repository.dart';
import 'package:app_student/class_groups/cubit/class_group_cubit.dart';
import 'package:app_student/class_groups/views/widgets/card_list.dart';
import 'package:app_student/users/cubit/user_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:go_router/go_router.dart';

import '../../api/users/repositories/user_repository.dart';
import '../../shared_components/app_bar.dart';
import '../../shared_components/header_subtitle.dart';
import '../../shared_components/header_title.dart';

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

@override
Widget build(BuildContext context) {
final classRepository =
RepositoryProvider.of<ClassGroupRepository>(context);
final userRepository = RepositoryProvider.of<UserRepository>(context);
final classCubit = ClassGroupCubit(classRepository: classRepository)
..fetchClasses();
final userCubit = UserCubit(userRepository: userRepository)..fetchUser();

return MultiBlocProvider(
providers: [
BlocProvider<ClassGroupCubit>(create: (context) => classCubit),
BlocProvider<UserCubit>(create: (context) => userCubit),
],
child: Scaffold(
appBar: const CustomAppBar(),
body: BlocBuilder<UserCubit, UserState>(
builder: (context, userState) {
if (userState is UserClassesSelected) {
WidgetsBinding.instance.addPostFrameCallback((_) {
context.go('/schedule');
});
return const Center(child: CircularProgressIndicator());
} else if (userState is UserLoading) {
return const Center(child: CircularProgressIndicator());
} else if (userState is UserLoaded) {
final user = userState.user;
return BlocBuilder<ClassGroupCubit, ClassGroupState>(
builder: (context, classState) {
if (classState is ClassGroupLoading) {
return const Center(child: CircularProgressIndicator());
} else if (classState is ClassGroupLoaded) {
return Column(
children: [
HeaderTitle(AppLocalizations.of(context)!
.classSelectionTitle(user.name)),
HeaderSubtitle(AppLocalizations.of(context)!
.classSelectionSubtitle),
Expanded(
child: CardList(classesList: classState.classes),
),
],
);
} else if (classState is ClassGroupError) {
return Center(child: Text(classState.message));
} else {
return const Center(child: CircularProgressIndicator());
}
},
);
} else {
return const Center(child: CircularProgressIndicator());
}
},
),
),
);
}
}
74 changes: 0 additions & 74 deletions frontend/app_student/lib/class_groups/views/class_group_page.dart

This file was deleted.

This file was deleted.

22 changes: 22 additions & 0 deletions frontend/app_student/lib/generated/assets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
///This file is automatically generated. DO NOT EDIT, all your changes would be lost.
class Assets {
Assets._();

static const String appStudent = '.env';
static const String fontsArial = 'assets/fonts/arial.ttf';
static const String icon3ilIcon = 'assets/icon/3il-icon.png';
static const String icon3ilLogoWhite = 'assets/icon/3il-logo-white.jpeg';
static const String images3ilIcon = 'assets/images/3il-icon.png';
static const String images3ilIconBlue = 'assets/images/3il-icon-blue.png';
static const String images3ilIconWhite = 'assets/images/3il-icon-white.png';
static const String images3ilLogo = 'assets/images/3il-logo.jpg';
static const String images3ilLogoWhite = 'assets/images/3il-logo-white.jpeg';
static const String imagesCalendar = 'assets/images/calendar.svg';
static const String imagesDisconnect = 'assets/images/disconnect.svg';
static const String imagesEating = 'assets/images/eating.svg';
static const String imagesProfil = 'assets/images/profil.svg';
static const String imagesSchool = 'assets/images/school.svg';
static const String imagesStudentInfo = 'assets/images/student-info.svg';
static const String imagesTeams = 'assets/images/teams.svg';
static const String imagesUser = 'assets/images/user.svg';
}
18 changes: 17 additions & 1 deletion frontend/app_student/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@
"description": "Label pour la salle",
"example": "Salle"
},
"disconnectedMessage": "Vous avez été déconnecté",
"@disconnectedMessage": {
"description": "Message d'erreur pour une déconnexion"
},
"disconnect": "Déconnexion",
"@disconnect": {
"description": "Texte du bouton de déconnexion"
},
"schedule": "Emploi du temps",
"@schedule": {
"description": "Texte du bouton pour l'emploi du temps"
},
"profil": "Profil",
"@profil": {
"description": "Texte du bouton pour le profil"
},
"profilMessageTitle": "Quel beau profil {firstName} !",
"@profilMessageTitle": {
"description": "Message d'accueil de la page de profil",
Expand All @@ -93,4 +109,4 @@
"@profilChangeClassButton": {
"description": "Texte du bouton pour changer de classe"
}
}
}
7 changes: 6 additions & 1 deletion frontend/app_student/lib/login/cubit/login_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class LoginCubit extends Cubit<LoginState> {

Future<bool> checkUserAuthentication() async {
try {
await userRepository.getUser();
var user = await userRepository.getUser();
// Si la classe est vide
if (user.className == '') {
emit(LoginInitial());
return false;
}
emit(LoginAuthenticated());
return true;
} catch (e) {
Expand Down
52 changes: 52 additions & 0 deletions frontend/app_student/lib/login/views/login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:app_student/login/cubit/login_cubit.dart';
import 'package:app_student/login/views/login_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:go_router/go_router.dart';

import '../../users/cubit/user_cubit.dart';

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

@override
Widget build(BuildContext context) {
return BlocConsumer<LoginCubit, LoginState>(
listener: (context, state) {},
builder: (context, state) {
return BlocBuilder<UserCubit, UserState>(
builder: (context, userState) {
if (state is RedirectToClassSelection) {
WidgetsBinding.instance.addPostFrameCallback((_) {
context.go('/classList');
});
return Container();
} else if (state is LoginInitial) {
return LoginView(AppLocalizations.of(context)!.loginWelcomeTitle);
} else if (state is LoginAuthenticated) {
WidgetsBinding.instance.addPostFrameCallback((_) {
context.go('/schedule');
});
return Container();
} else if (state is LoginFieldError) {
WidgetsBinding.instance.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(AppLocalizations.of(context)!.loginFieldError),
backgroundColor: Colors.red,
),
);
});
return LoginView(
AppLocalizations.of(context)!.loginWelcomeTitleError);
} else {
return Container();
}
},
);
},
);
}
}
Loading

0 comments on commit 9148d9a

Please sign in to comment.