Skip to content

Commit

Permalink
♻️🎨💄: - added final design? and improved the structure of widgets
Browse files Browse the repository at this point in the history
👔: classcubit
👔: usercubit
  • Loading branch information
julesartd committed Mar 14, 2024
1 parent 0196b13 commit 57e4e43
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 27 deletions.
6 changes: 4 additions & 2 deletions frontend/app_student/lib/api/api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class ApiService {
String fullUrl = '$apiUrl$endpoint';
fullUrl = Uri.encodeFull(fullUrl);
try {
final response = await http.get(Uri.parse(fullUrl)).timeout(const Duration(seconds: 20), onTimeout: () {
final response = await http
.get(Uri.parse(fullUrl))
.timeout(const Duration(seconds: 20), onTimeout: () {
throw TimeoutException('The connection has timed out!');
});

Expand All @@ -35,4 +37,4 @@ class ApiService {
throw Exception('Failed to load data: $e');
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ class ClassGroupError extends ClassGroupState {

ClassGroupError([this.message = 'An error occurred']);
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class WeekScheduleLoaded extends WeekScheduleState {
final List<DayScheduleModel> allDaySchedules;
final UserModel user; // Ajout du champ UserModel

WeekScheduleLoaded(this.weekSchedule, this.todayIndex, this.allDaySchedules, this.user); // Ajout du UserModel au constructeur
WeekScheduleLoaded(this.weekSchedule, this.todayIndex, this.allDaySchedules,
this.user); // Ajout du UserModel au constructeur

WeekScheduleLoaded copyWith({
List<WeekScheduleModel>? weekSchedule,
Expand All @@ -40,4 +41,4 @@ class WeekScheduleError extends WeekScheduleState {
final String message;

WeekScheduleError(this.message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class DatePickerButton extends StatelessWidget {
Widget build(BuildContext context) {
final cubit = context.read<WeekScheduleCubit>();
return IconButton(
icon: const Icon(Icons.calendar_month, color: Colors.white, size: 30,),
icon: const Icon(
Icons.calendar_month,
color: Colors.white,
size: 30,
),
onPressed: () async {
final today = DateTime.now();
final date = await selectDate(context, cubit, today);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ class DayScheduleWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
String formattedDate = DateFormat('EEEE dd MMMM yyyy', 'fr_FR').format(daySchedule.date);
String capitalizedDate = formattedDate[0].toUpperCase() + formattedDate.substring(1);
String formattedDate =
DateFormat('EEEE dd MMMM yyyy', 'fr_FR').format(daySchedule.date);
String capitalizedDate =
formattedDate[0].toUpperCase() + formattedDate.substring(1);
return SingleChildScrollView(
child: Column(
children: [
Expand All @@ -32,4 +34,4 @@ class DayScheduleWidget extends StatelessWidget {
),
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EventCard extends StatelessWidget {
height: 110,
child: Padding(
padding:
const EdgeInsets.only(left: 20.0, right: 20, bottom: 3, top: 3),
const EdgeInsets.only(left: 20.0, right: 20, bottom: 3, top: 3),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: event.creneau == 3
Expand All @@ -42,8 +42,8 @@ class EventCard extends StatelessWidget {
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.bold)),
ColorFiltered(
colorFilter: const ColorFilter.mode(
Colors.white, BlendMode.srcIn),
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
child: SvgPicture.asset(
event.visio
? 'assets/images/teams.svg'
Expand All @@ -63,4 +63,4 @@ class EventCard extends StatelessWidget {
),
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class EventDetails extends StatelessWidget {
children: [
EventHours(event: event),
SizedBox(
width: constraints.maxWidth - 50, // Subtract the width of EventHours
width:
constraints.maxWidth - 50, // Subtract the width of EventHours
child: EventInfo(event: event),
),
],
);
},
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class EventEmptyCard extends StatelessWidget {
),
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class EventMealCard extends StatelessWidget {
),
height: 90,
child: Padding(
padding:
const EdgeInsets.only(left: 20.0, right: 20, bottom: 3, top: 3),
child: Center(
child: ColorFiltered(
colorFilter: const ColorFilter.mode(
Colors.white, BlendMode.srcIn),
child: SvgPicture.asset(
'assets/images/eating.svg',
width: 50,
height: 50,
),
padding:
const EdgeInsets.only(left: 20.0, right: 20, bottom: 3, top: 3),
child: Center(
child: ColorFiltered(
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
child: SvgPicture.asset(
'assets/images/eating.svg',
width: 50,
height: 50,
),
),
),
),
),
);
Expand Down

0 comments on commit 57e4e43

Please sign in to comment.