Skip to content

Commit

Permalink
New Generic Card (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras authored Jul 31, 2024
2 parents 0ee167c + c26b4fd commit 586ddf9
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
PUBSPEC_PATH: pubspec.yaml
defaults:
run:
working-directory: ./uni
working-directory: ./packages/uni_app
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: uni/pubspec.yaml
flutter-version-file: packages/uni_app/pubspec.yaml
cache: true

- name: Download Android keystore
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
with:
name: appbundle
if-no-files-found: error
path: uni/build/app/outputs/bundle/release/app-release.aab
path: packages/uni_app/build/app/outputs/bundle/release/app-release.aab

deploy_play_store:
name: "Deploy to Google Play Store"
Expand Down
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
59 changes: 59 additions & 0 deletions packages/uni_ui/lib/generic_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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);
final theme = Theme.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 ??
theme.colorScheme.surfaceContainer,
boxShadow: [
BoxShadow(
color: shadowColor ??
cardTheme.shadowColor ??
Colors.black.withOpacity(0.25),
blurRadius: 6,
),
],
),
child: Padding(
padding: padding ?? const EdgeInsets.all(10), child: child),
),
),
),
);
}
}
46 changes: 22 additions & 24 deletions packages/uni_ui/lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@ const _textTheme = TextTheme(
);

ThemeData lightTheme = ThemeData(
useMaterial3: true,
textTheme: _textTheme,
colorScheme: ColorScheme.fromSeed(
seedColor: darkRed,
surface: mildWhite,
surfaceContainer: mildWhite,
primary: darkRed,
onPrimary: pureWhite,
secondary: dust,
onSecondary: pureWhite,
tertiary: salmon,
onTertiary: pureWhite
),
primaryColor: darkRed,
cardTheme: CardTheme(
margin: EdgeInsets.all(4),
color: mildWhite,

),
dividerColor: lightGray,
hintColor: lightGray,
indicatorColor: darkRed,
iconTheme: const IconThemeData(color: darkRed),
)
useMaterial3: true,
textTheme: _textTheme,
colorScheme: ColorScheme.fromSeed(
seedColor: darkRed,
surface: mildWhite,
surfaceContainer: mildWhite,
primary: darkRed,
onPrimary: pureWhite,
secondary: dust,
onSecondary: pureWhite,
tertiary: salmon,
onTertiary: pureWhite),
primaryColor: darkRed,
cardTheme: CardTheme(
margin: EdgeInsets.all(4),
color: mildWhite,
),
dividerColor: lightGray,
hintColor: lightGray,
indicatorColor: darkRed,
iconTheme: const IconThemeData(color: darkRed),
);
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 586ddf9

Please sign in to comment.