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 all 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 15 additions & 11 deletions packages/uni_ui/lib/cards/generic_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import 'package:figma_squircle/figma_squircle.dart';
import 'package:flutter/material.dart';

class GenericCard extends StatelessWidget {
const GenericCard({
super.key,
this.margin,
this.padding,
this.color,
this.shadowColor,
this.borderRadius,
this.onClick,
this.child,
});
const GenericCard(
{super.key,
this.margin,
this.padding,
this.color,
this.shadowColor,
this.borderRadius,
this.onClick,
this.child,
this.gradient});

final EdgeInsetsGeometry? margin;
final EdgeInsetsGeometry? padding;
Expand All @@ -20,6 +20,7 @@ class GenericCard extends StatelessWidget {
final double? borderRadius;
final Function? onClick;
final Widget? child;
final Gradient? gradient;

@override
Widget build(BuildContext context) {
Expand All @@ -40,6 +41,7 @@ class GenericCard extends StatelessWidget {
color: color ??
cardTheme.color ??
theme.colorScheme.surfaceContainer,
gradient: gradient,
boxShadow: [
BoxShadow(
color: shadowColor ??
Expand All @@ -50,7 +52,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
133 changes: 133 additions & 0 deletions packages/uni_ui/lib/cards/schedule_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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 StatelessWidget {
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(
gradient: isActive
? RadialGradient(
colors: [
Color(0xFF280709),
Color(0xFF511515),
],
center: Alignment.topLeft,
radius: 1.5,
stops: [0, 1])
: null,
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)),
],
)
],
),
);
}
}
Loading
Loading