Skip to content

Commit

Permalink
new generic card
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras committed Jul 26, 2024
1 parent 47c42da commit d46e5e2
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

## Overview

**uni** is a project developed by [NIAEFEUP](https://ni.fe.up.pt/) to help students of the [University of Porto](https://up.pt) to manage their academic life, including useful features such as upcoming classes and exams. It is a mobile app that is available for both Android and iOS, and is developed using the [Flutter](https://flutter.dev/) framework.
**uni** is a project developed by [NIAEFEUP](https://niaefeup.pt/) to help students of the [University of Porto](https://up.pt) to manage their academic life, including useful features such as upcoming classes and exams. It is a mobile app that is available for both Android and iOS, and is developed using the [Flutter](https://flutter.dev/) framework.

Some of the features are only available to students of [FEUP](https://fe.up.pt). The reliability of the information provided by the app is not guaranteed, and the app is not affiliated with the University of Porto or any of its faculties.

Expand All @@ -34,4 +34,4 @@ This application is licensed under the [GNU General Public License v3.0](./LICEN

Contributions are welcome, and can be made by opening a pull request. Please note, however, that a university's account is required to access most of the app's features.

For further information about the project structure, please refer to [the app's README file](./uni/README.md).
For further information about the project structure, please refer to [the app's README file](./packages/uni_app/README.md).
15 changes: 15 additions & 0 deletions packages/uni_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
figma_squircle:
dependency: transitive
description:
name: figma_squircle
sha256: "790b91a9505e90d246f6efe2fa065ff7fffe658c7b44fe9b5b20c7b0ad3818c0"
url: "https://pub.dev"
source: hosted
version: "0.5.3"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -1507,6 +1515,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
uni_ui:
dependency: "direct main"
description:
path: "../uni_ui"
relative: true
source: path
version: "1.0.0"
unicode:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions packages/uni_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dependencies:
timelines: ^0.1.0
tuple: ^2.0.0
ua_client_hints: ^1.3.1
uni_ui:
path: ../uni_ui
url_launcher: ^6.2.2
workmanager: ^0.5.2

Expand Down
58 changes: 58 additions & 0 deletions packages/uni_ui/lib/generic_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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,
});

final EdgeInsetsGeometry? margin;
final EdgeInsetsGeometry? padding;
final Color? color;
final Color? shadowColor;
final double? borderRadius;
final Function? onClick;
final Widget? child;

@override
Widget build(BuildContext context) {
final cardTheme = CardTheme.of(context);

return Padding(
padding: margin ?? cardTheme.margin ?? const EdgeInsets.all(4),
child: GestureDetector(
onTap: () => onClick,
child: ClipSmoothRect(
radius: SmoothBorderRadius(
cornerRadius: borderRadius ?? 20,
cornerSmoothing: 1,
),
child: Container(
decoration: BoxDecoration(
color: color ??
cardTheme.color ??
const Color.fromARGB(255, 255, 245, 243),
boxShadow: [
BoxShadow(
color: shadowColor ??
cardTheme.shadowColor ??
Colors.black.withOpacity(0.25),
blurRadius: 6,
),
],
),
child: Padding(
padding: padding ?? const EdgeInsets.all(10), child: child),
),
),
),
);
}
}
8 changes: 8 additions & 0 deletions packages/uni_ui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
figma_squircle:
dependency: "direct main"
description:
name: figma_squircle
sha256: "790b91a9505e90d246f6efe2fa065ff7fffe658c7b44fe9b5b20c7b0ad3818c0"
url: "https://pub.dev"
source: hosted
version: "0.5.3"
file:
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 @@ -8,6 +8,7 @@ environment:
flutter: 3.22.0

dependencies:
figma_squircle: ^0.5.3
flutter:
sdk: flutter

Expand Down

0 comments on commit d46e5e2

Please sign in to comment.