Skip to content

Commit

Permalink
Add calendar line
Browse files Browse the repository at this point in the history
  • Loading branch information
Process-ing committed Oct 26, 2024
1 parent 5af8994 commit c707bd9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 21 deletions.
5 changes: 3 additions & 2 deletions packages/uni_ui/lib/calendar/calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
}
}
}
67 changes: 54 additions & 13 deletions packages/uni_ui/lib/calendar/calendar_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,57 @@ 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(
shape: BoxShape.circle,
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(
Expand All @@ -77,7 +105,7 @@ class CalendarItem extends StatelessWidget {
color: Theme.of(context).colorScheme.shadow.withAlpha(0x3f),
blurRadius: 6,
)
]
],
),
child: Text(
this.eventName,
Expand All @@ -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];
}

Expand All @@ -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)}";
}
}
}
}
8 changes: 2 additions & 6 deletions packages/uni_ui/lib/course_grade_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
],
)
],
Expand Down

0 comments on commit c707bd9

Please sign in to comment.