From d46e5e25f3610bf21bd302a03fbd1186f352ac95 Mon Sep 17 00:00:00 2001 From: thePeras Date: Fri, 26 Jul 2024 10:42:08 +0100 Subject: [PATCH 1/3] new generic card --- README.md | 4 +- packages/uni_app/pubspec.lock | 15 +++++++ packages/uni_app/pubspec.yaml | 2 + packages/uni_ui/lib/generic_card.dart | 58 +++++++++++++++++++++++++++ packages/uni_ui/pubspec.lock | 8 ++++ packages/uni_ui/pubspec.yaml | 1 + 6 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 packages/uni_ui/lib/generic_card.dart diff --git a/README.md b/README.md index 4387ae5cb..0f27c71ff 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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). diff --git a/packages/uni_app/pubspec.lock b/packages/uni_app/pubspec.lock index 22937daf1..04ebf0c95 100644 --- a/packages/uni_app/pubspec.lock +++ b/packages/uni_app/pubspec.lock @@ -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: @@ -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: diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 2bc3262a7..14b47ab0a 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -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 diff --git a/packages/uni_ui/lib/generic_card.dart b/packages/uni_ui/lib/generic_card.dart new file mode 100644 index 000000000..bd1acfc37 --- /dev/null +++ b/packages/uni_ui/lib/generic_card.dart @@ -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), + ), + ), + ), + ); + } +} diff --git a/packages/uni_ui/pubspec.lock b/packages/uni_ui/pubspec.lock index 70207236c..25a63aad9 100644 --- a/packages/uni_ui/pubspec.lock +++ b/packages/uni_ui/pubspec.lock @@ -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: diff --git a/packages/uni_ui/pubspec.yaml b/packages/uni_ui/pubspec.yaml index 0dde2f809..9f518255d 100644 --- a/packages/uni_ui/pubspec.yaml +++ b/packages/uni_ui/pubspec.yaml @@ -8,6 +8,7 @@ environment: flutter: 3.22.0 dependencies: + figma_squircle: ^0.5.3 flutter: sdk: flutter From 0a10cba66b90c25122d116a7971e3f9bd6a307f2 Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 31 Jul 2024 22:52:39 +0100 Subject: [PATCH 2/3] Add theme color and fix deploy --- .github/workflows/deploy.yaml | 4 ++-- packages/uni_ui/lib/generic_card.dart | 3 ++- packages/uni_ui/lib/theme.dart | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e6de70735..2322fb4f7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,7 +22,7 @@ jobs: PUBSPEC_PATH: pubspec.yaml defaults: run: - working-directory: ./uni + working-directory: ./packages/uni/ steps: - uses: actions/checkout@v4 with: @@ -110,7 +110,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: stable - flutter-version-file: uni/pubspec.yaml + flutter-version-file: packages/uni/pubspec.yaml cache: true - name: Download Android keystore diff --git a/packages/uni_ui/lib/generic_card.dart b/packages/uni_ui/lib/generic_card.dart index bd1acfc37..c2fb96d8b 100644 --- a/packages/uni_ui/lib/generic_card.dart +++ b/packages/uni_ui/lib/generic_card.dart @@ -24,6 +24,7 @@ class GenericCard extends StatelessWidget { @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), @@ -38,7 +39,7 @@ class GenericCard extends StatelessWidget { decoration: BoxDecoration( color: color ?? cardTheme.color ?? - const Color.fromARGB(255, 255, 245, 243), + theme.colorScheme.surfaceContainer, boxShadow: [ BoxShadow( color: shadowColor ?? diff --git a/packages/uni_ui/lib/theme.dart b/packages/uni_ui/lib/theme.dart index b778155e5..e6c28318f 100644 --- a/packages/uni_ui/lib/theme.dart +++ b/packages/uni_ui/lib/theme.dart @@ -10,6 +10,8 @@ const Color normalGray = Color.fromARGB(255, 127, 127, 127); const Color lightGray = Color.fromARGB(255, 229, 229, 229); const Color salmon = Color.fromARGB(255, 227, 145, 145); +255, 255, 245, 243), + const _textTheme = TextTheme( displayLarge: TextStyle(fontSize: 40, fontWeight: FontWeight.w400), displayMedium: TextStyle(fontSize: 32, fontWeight: FontWeight.w400), @@ -42,10 +44,10 @@ ThemeData lightTheme = ThemeData( cardTheme: CardTheme( margin: EdgeInsets.all(4), color: mildWhite, - ), dividerColor: lightGray, hintColor: lightGray, indicatorColor: darkRed, iconTheme: const IconThemeData(color: darkRed), -) +); + From c26b4fd2454cce8d69e30941174da79630afc016 Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 31 Jul 2024 22:52:51 +0100 Subject: [PATCH 3/3] Add theme color and fix deploy --- .github/workflows/deploy.yaml | 6 ++--- packages/uni_ui/lib/theme.dart | 46 ++++++++++++++++------------------ 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 2322fb4f7..10027b6a0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,7 +22,7 @@ jobs: PUBSPEC_PATH: pubspec.yaml defaults: run: - working-directory: ./packages/uni/ + working-directory: ./packages/uni_app steps: - uses: actions/checkout@v4 with: @@ -110,7 +110,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: stable - flutter-version-file: packages/uni/pubspec.yaml + flutter-version-file: packages/uni_app/pubspec.yaml cache: true - name: Download Android keystore @@ -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" diff --git a/packages/uni_ui/lib/theme.dart b/packages/uni_ui/lib/theme.dart index e6c28318f..02ec51da9 100644 --- a/packages/uni_ui/lib/theme.dart +++ b/packages/uni_ui/lib/theme.dart @@ -10,8 +10,6 @@ const Color normalGray = Color.fromARGB(255, 127, 127, 127); const Color lightGray = Color.fromARGB(255, 229, 229, 229); const Color salmon = Color.fromARGB(255, 227, 145, 145); -255, 255, 245, 243), - const _textTheme = TextTheme( displayLarge: TextStyle(fontSize: 40, fontWeight: FontWeight.w400), displayMedium: TextStyle(fontSize: 32, fontWeight: FontWeight.w400), @@ -27,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), ); -