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

Schedule card #1293

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class GenericCard extends StatelessWidget {
],
),
child: Padding(
padding: padding ?? const EdgeInsets.all(10), child: child),
padding: padding ??
const EdgeInsets.symmetric(vertical: 15, horizontal: 25),
child: child),
),
),
),
Expand Down
124 changes: 124 additions & 0 deletions packages/uni_ui/lib/cards/schedule_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';
import 'package:uni_ui/cards/generic_card.dart';
import 'package:uni_ui/theme.dart';

class ScheduleCard extends GenericCard {
DGoiana marked this conversation as resolved.
Show resolved Hide resolved
const ScheduleCard(
{super.key,
required this.name,
required this.acronym,
required this.room,
required this.type,
// required this.badgeColor,
this.isActive = false,
this.teacherName,
this.teacherPhoto});

final String name;
final String acronym;
final String room;
final String type;
// final BadgeColors badgeColor;
final bool isActive;
final String? teacherName;
final String? teacherPhoto;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teacherPhoto is not being used


@override
Widget build(BuildContext context) {
return GenericCard(
key: key,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
if (isActive) ...[
PhosphorIcon(
PhosphorIcons.clock(PhosphorIconsStyle.duotone),
color: Theme.of(context).colorScheme.secondary,
size: 20,
),
SizedBox(width: 5),
],
Text(
acronym,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.headlineMedium!
.fontSize,
fontWeight: Theme.of(context)
.textTheme
.headlineMedium!
.fontWeight,
color: isActive
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.primary),
vitormpp marked this conversation as resolved.
Show resolved Hide resolved
),
const SizedBox(width: 8), //TODO: Create a custom Gap()?
Badge(
label: Text(type),
backgroundColor: BadgeColors.tp,
textColor: Theme.of(context).colorScheme.surface,
),
],
),
Text(
name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize:
Theme.of(context).textTheme.titleLarge!.fontSize,
fontWeight:
Theme.of(context).textTheme.titleLarge!.fontWeight,
color: isActive
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.primary),
),
SizedBox(height: 5),
if (isActive)
Row(children: [
CircleAvatar(
radius: 15,
backgroundImage: const AssetImage(
'assets/images/profile_placeholder.png', // to change
)),
const SizedBox(width: 8), //TODO: create gap()?
Text(teacherName!,
style: TextStyle(
color: isActive
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.primary)),
])
],
),
),
Column(
children: [
PhosphorIcon(
PhosphorIcons.mapPin(PhosphorIconsStyle.duotone),
color: isActive
? Theme.of(context).colorScheme.secondary
: Theme.of(context).iconTheme.color,
size: 35,
),
Text(room,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isActive
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.primary)),
],
)
],
),
color: isActive ? Color.fromARGB(255, 40, 7, 9) : null,
);
}
}
37 changes: 37 additions & 0 deletions packages/uni_ui/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:uni_ui/cards/schedule_card.dart';
import 'package:uni_ui/theme.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: lightTheme,
home: Scaffold(
body: Column(
children: [
Row(
children: [
SizedBox(
width: 70,
),
Flexible(
child: ScheduleCard(
name: "Computer Laboratory",
acronym: "LCOM",
room: "B315",
type: "TP",
isActive: false,
teacherName: 'Pedro Souto'),
)
],
)
],
)),
);
}
}
20 changes: 16 additions & 4 deletions packages/uni_ui/lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const Color salmon = Color.fromARGB(255, 227, 145, 145);
const _textTheme = TextTheme(
displayLarge: TextStyle(fontSize: 40, fontWeight: FontWeight.w400),
displayMedium: TextStyle(fontSize: 32, fontWeight: FontWeight.w400),
displaySmall: TextStyle(fontSize: 28, fontWeight: FontWeight.w400),
headlineMedium: TextStyle(fontSize: 24, fontWeight: FontWeight.w300),
displaySmall: TextStyle(fontSize: 28, fontWeight: FontWeight.w500),
headlineMedium: TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
headlineSmall: TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
titleLarge: TextStyle(fontSize: 18, fontWeight: FontWeight.w300),
titleMedium: TextStyle(fontSize: 17, fontWeight: FontWeight.w300),
titleLarge: TextStyle(fontSize: 18, fontWeight: FontWeight.w400),
titleMedium: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
titleSmall: TextStyle(fontSize: 16, fontWeight: FontWeight.w300),
bodyLarge: TextStyle(fontSize: 16, fontWeight: FontWeight.w400),
bodyMedium: TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
Expand All @@ -41,9 +41,21 @@ ThemeData lightTheme = ThemeData(
cardTheme: CardTheme(
margin: EdgeInsets.all(4),
color: mildWhite,
shadowColor: Colors.black.withOpacity(0.25),
),
dividerColor: lightGray,
hintColor: lightGray,
indicatorColor: darkRed,
iconTheme: const IconThemeData(color: darkRed),
scaffoldBackgroundColor: pureWhite,
);

class BadgeColors {
static const te = Color(0xFFfbc11f);
static const tp = Color(0xFFd3944c);
static const p = Color(0xFFab4d39);
static const pl = Color(0xFF769c87);
static const ot = Color(0xFF7ca5b8);
static const tc = Color(0xFFcdbeb1);
static const s = Color(0xFF917c9b);
}
8 changes: 8 additions & 0 deletions packages/uni_ui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
phosphor_flutter:
dependency: "direct main"
description:
name: phosphor_flutter
sha256: "8a14f238f28a0b54842c5a4dc20676598dd4811fcba284ed828bd5a262c11fde"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
pool:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions packages/uni_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
figma_squircle: ^0.5.3
flutter:
sdk: flutter
phosphor_flutter: ^2.1.0

dev_dependencies:
custom_lint: ^0.6.4
Expand Down