From c707bd9f204baf5334b109d43155310bbb0cd0e3 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Sat, 26 Oct 2024 19:01:39 +0100 Subject: [PATCH] Add calendar line --- packages/uni_ui/lib/calendar/calendar.dart | 5 +- .../uni_ui/lib/calendar/calendar_item.dart | 67 +++++++++++++++---- packages/uni_ui/lib/course_grade_card.dart | 8 +-- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/packages/uni_ui/lib/calendar/calendar.dart b/packages/uni_ui/lib/calendar/calendar.dart index 255beb06b..8d0a948f6 100644 --- a/packages/uni_ui/lib/calendar/calendar.dart +++ b/packages/uni_ui/lib/calendar/calendar.dart @@ -13,9 +13,10 @@ class Calendar extends StatelessWidget { Widget build(BuildContext context) { return SingleChildScrollView( scrollDirection: Axis.horizontal, - child: Row( // To avoid the widget from expanding vertically + child: Row( + // To avoid the widget from expanding vertically children: items, ), ); } -} \ No newline at end of file +} diff --git a/packages/uni_ui/lib/calendar/calendar_item.dart b/packages/uni_ui/lib/calendar/calendar_item.dart index 837272a5b..89c577427 100644 --- a/packages/uni_ui/lib/calendar/calendar_item.dart +++ b/packages/uni_ui/lib/calendar/calendar_item.dart @@ -35,7 +35,7 @@ class CalendarItem extends StatelessWidget { alignment: Alignment.bottomCenter, children: [ Container( - margin: EdgeInsets.only(top: 5, bottom: 12), + margin: EdgeInsets.only(top: 5, bottom: 10), width: 20, height: 20, decoration: BoxDecoration( @@ -43,21 +43,49 @@ class CalendarItem extends StatelessWidget { border: Border.all( color: Theme.of(context).colorScheme.primary, width: 4.0, - ) + ), ), ), Container( - width: 6, - height: 14, + width: 4, + height: 12, decoration: BoxDecoration( borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(3), - bottomRight: Radius.circular(3) - ), + bottomLeft: Radius.circular(3), + bottomRight: Radius.circular(3)), shape: BoxShape.rectangle, color: Theme.of(context).primaryColor, ), - ) + ), + Container( + margin: EdgeInsets.only(bottom: 18), + child: Row( + children: [ + Container( + width: 60, + height: 4, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + borderRadius: BorderRadius.only( + topRight: Radius.circular(3), + bottomRight: Radius.circular(3), + )), + ), + SizedBox(width: 30), + Container( + width: 60, + height: 4, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(3), + bottomLeft: Radius.circular(3), + ), + ), + ), + ], + ), + ), ], ), Container( @@ -77,7 +105,7 @@ class CalendarItem extends StatelessWidget { color: Theme.of(context).colorScheme.shadow.withAlpha(0x3f), blurRadius: 6, ) - ] + ], ), child: Text( this.eventName, @@ -95,7 +123,20 @@ class CalendarItem extends StatelessWidget { static String monthToString(int month) { // TODO: Support English - const strMonths = ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dec"]; + const strMonths = [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dec" + ]; return strMonths[month - 1]; } @@ -104,10 +145,10 @@ class CalendarItem extends StatelessWidget { if (start.month == end.month) { return start.day == end.day - ? "${start.day} ${monthToString(start.month)}." - : "${start.day}-${end.day} ${monthToString(start.month)}."; + ? "${start.day} ${monthToString(start.month)}." + : "${start.day} - ${end.day} ${monthToString(start.month)}."; } else { return "${start.day} ${monthToString(start.month)} - ${end.day} ${monthToString(end.month)}"; } } -} \ No newline at end of file +} diff --git a/packages/uni_ui/lib/course_grade_card.dart b/packages/uni_ui/lib/course_grade_card.dart index e004c5ee6..60ab3bd66 100644 --- a/packages/uni_ui/lib/course_grade_card.dart +++ b/packages/uni_ui/lib/course_grade_card.dart @@ -32,12 +32,8 @@ class CourseGradeCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "${ects} ECTS", - style: theme.textTheme.bodyLarge - ), - Text("${grade.toInt()}", - style: theme.textTheme.bodyLarge) + Text("${ects} ECTS", style: theme.textTheme.bodyLarge), + Text("${grade.toInt()}", style: theme.textTheme.bodyLarge) ], ) ],