From 340bc71e3b3a086170ceb1518f3f75959171395e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Tue, 7 Feb 2023 15:23:03 +0100 Subject: [PATCH 1/9] docs: update readme --- README.md | 94 ++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index b6ec3314..410ef3c4 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,7 @@ -->

- - - - - +

Wyatt Packages

@@ -44,10 +40,9 @@ ## About -Here is it a set of [Flutter plugins](https://flutter.io/platform-plugins/) that power up your applications. +Here is a set of [Flutter plugins](https://flutter.io/platform-plugins/) that enhance your applications. -[Flutter](https://flutter.dev) is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. Flutter is used by developers and organizations around the world, and is free -and open source. +[Flutter](https://flutter.dev) is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop using a single codebase. It is used by developers and organizations worldwide and is free and open-source. --- @@ -61,21 +56,21 @@ git clone ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git ### Prerequisite -- [Flutter](https://github.com/flutter/flutter). +1. [Flutter](https://github.com/flutter/flutter). It is a UI toolkit developed by Google for building beautiful and natively compiled applications for mobile, web, and desktop from a single codebase. -- [Melos](https://github.com/invertase/melos). Used to manage Dart projects with multiple packages. +2. [Melos](https://github.com/invertase/melos). Melos is a tool that helps in managing Dart projects that have multiple packages. It can be installed using the following command: ```shell dart pub global activate melos ``` -- [Mason](https://github.com/felangel/mason). Used for code generation. +3. [Mason](https://github.com/felangel/mason). Mason is used for code generation purposes. It can be installed by running the following command: ```shell dart pub global activate mason_cli ``` -- [Lcov](https://github.com/linux-test-project/lcov). Used to generate coverage data. +4. [Lcov](https://github.com/linux-test-project/lcov). Lcov is a tool used to generate coverage data. It can be installed on macOS by running the following command: ```shell # on macos @@ -84,38 +79,39 @@ brew install lcov - genhtml. Used to convert coverage data into html pages. -After installing all these packages, bootstrap with `melos bs`. +After installation of all these packages, the project can be bootstrapped using the command `melos bs`. ### Create a new package Create a new package in `packages/` folder. +To create a new package in the packages/ folder, run the following command in the terminal: ```shell mason make wyatt_package --package_name wyatt_ --description A new Wyatt package --flutter_only false ``` -Then bootstrap project with `melos bs` command. +The variable in the above command is important and must be clear and understandable. + +After creating the package, bootstrap the project with the `melos bs` command. #### Naming In the previous instructions `` variable is important. It have to be clear and intelligible. -You **MUST** use underscores. +1. You must use underscores in the name. +2. You must use the wyatt prefix for the package name. +3. You must name the example with a specific name. -You **MUST** use `wyatt` prefix for package. +For example, if the name is "CRUD BLOC," the following naming conventions should be used: -You **MUST** name example with specific name. - -For example, if name is CRUD BLOC - -- name will be crud_bloc -- so the package will be: `wyatt_crud_bloc` -- and the example will be: `crud_bloc_example` +1. name: crud_bloc +2. package name: wyatt_crud_bloc +3. example name: crud_bloc_example ### Create issues -Add the issues directly related to what you want to develop and label them correctly. +Create an issue for each specific feature or task you want to work on and label it correctly using the following format: ``` Type(scope): issue. @@ -128,18 +124,18 @@ For example, on notification bloc package : ### Branches -Master is protected. You can't push on it. Please develop your feature on another branch. The name of your branch has to match with the issue opened. +The master branch is protected and cannot be pushed to directly. Please create a separate branch for each feature or task, with a name that corresponds to the related issue. The branch name should follow this format: `type(scope):issue` Example : -Issue : +For the issue: - `Feature(notification_bloc): add firebase messaging data source.` -Branch related to this issue : +The related branch should be named: -- `feature(notification_bloc)/add_firebase_messaging_data_source` +- `notification_bloc/feat/add_firebase_messaging_data_source` ### Commits @@ -163,12 +159,11 @@ Some examples : - `docs: update readme.` = update **this** readme file. - `fix(crud)!: fix bug in awesome() function. (#32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue. -When you have finished developing, and are ready to close the issue, close it via your commit : +When you have completed your development work and are ready to resolve the related issue, you can close it via your commit message by including (close #issue_number). For example: -`feat(auth): add AWS support. (close #31)` - -Note that your issue will be close after merging on master. -Before closing the issue, please check tests and update coverage. You might run : +```shell +feat(auth): add AWS support. (close #31) +``` ```shell melos run test:all # this will run all tests in this project @@ -179,45 +174,44 @@ melos run publish:validate # this will run a validation before publish packages melos run publish # this will publish packages ``` -> Note that only modified package will be verified and published. +Please note that the issue will only be closed after it has been merged into the master branch. Before closing the issue, it is important to verify that all tests have been run and that coverage has been updated. #### Merge your work -After closing your issue, some work may have been done on master in the meantime. To keep a clean git history, please rebase before opening a change request. +When you have completed your work and closed the related issue, it's possible that some changes may have been made to the master branch in the meantime. To maintain a clean Git history, it's recommended to rebase before creating a change request (pull request). Two situations : -- You have not yet created your branch and have committed locally : +- You haven't created a branch yet and have made local commits: ```shell git pull --rebase ``` -- You are already working on your branch : +- You are already working on a branch: ```shell git rebase -i master ``` -If possible, please use `--fixup` on your commit in interactive rebase. +It's recommended to use the `--fixup` option during the interactive rebase to keep the Git history clean. -Then, opend your PR, get the necessary approval and merge your work. Then you're done ✅. +Once you have rebased, you can create a pull request, receive the necessary approvals, and then merge your work. And with that, you're done! 🎉 #### Update version. -Once your work is on the master, you can update your package version. Please filter packages to update only your package. `--scope` is used to do it. -For example, after merging changes on `wyatt_otification_bloc` package, you might run : +When your work has been merged into the master branch, it's time to update the package version. To update only your specific package, use the --scope option. For example, after merging changes into the `wyatt_notification_bloc` package, you can run the following command: ```shell melos version --scope="*wyatt_notification_bloc*" ``` -In fact, melos will filter all packages that match the `wyatt_notification_block` pattern. +This will filter all packages that match the `wyatt_notification_bloc` pattern and update only that package. -You can update check all packages tests by running : +You can then verify that all packages and their tests are working correctly by running: ```shell -melos run test +melos run test:all ``` #### Publish your package @@ -265,14 +259,14 @@ Here you can change `package name` and `package version`. --- -## Status - -![Status: Experimental](https://img.shields.io/badge/Status-WIP-red?style=flat-square) - -This repository is maintained by Wyatt Studio but work is in progress. - ## Simple work flow diagramm To sum up, here a simple work flow diagramm. ![Dev Wokflow](doc/workflow.svg) + +## Status + +![Status: Experimental](https://img.shields.io/badge/Status-WIP-red?style=flat-square) + +This repository is maintained by Wyatt Studio but work is in progress. -- 2.47.2 From 07a9b47b36b34f1a278eb1c4bfd43ebcbc947515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Tue, 7 Feb 2023 18:30:46 +0100 Subject: [PATCH 2/9] feat(ui_components): add information_card & quote_card (#126) --- .../wyatt_ui_components/analysis_options.yaml | 2 +- .../wyatt_ui_components/example/lib/main.dart | 4 +- .../example/test/widget_test.dart | 15 ----- .../domain/entities/app_bar_component.dart | 8 +-- .../bottom_navigation_bar_component.dart | 6 +- .../domain/entities/cards/card_component.dart | 60 +++++++++++++++++++ .../cards/information_card_component.dart | 54 +++++++++++++++++ .../cards/information_card_component.g.dart | 42 +++++++++++++ .../entities/cards/quote_card_component.dart | 43 +++++++++++++ .../cards/quote_card_component.g.dart | 46 ++++++++++++++ .../lib/src/domain/entities/entities.dart | 2 +- .../entities/error_widget_component.dart | 6 +- .../entities/loading_widget_component.dart | 4 +- .../lib/src/features/component_theme.dart | 6 +- .../src/features/component_theme_data.dart | 8 +-- .../lib/src/features/features.dart | 2 +- packages/wyatt_ui_components/pubspec.yaml | 10 ++-- 17 files changed, 274 insertions(+), 44 deletions(-) delete mode 100644 packages/wyatt_ui_components/example/test/widget_test.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart diff --git a/packages/wyatt_ui_components/analysis_options.yaml b/packages/wyatt_ui_components/analysis_options.yaml index 225c0796..90d6bd51 100644 --- a/packages/wyatt_ui_components/analysis_options.yaml +++ b/packages/wyatt_ui_components/analysis_options.yaml @@ -14,4 +14,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml +include: package:wyatt_analysis/analysis_options.flutter.yaml diff --git a/packages/wyatt_ui_components/example/lib/main.dart b/packages/wyatt_ui_components/example/lib/main.dart index 7cb59bf7..2ee31aeb 100644 --- a/packages/wyatt_ui_components/example/lib/main.dart +++ b/packages/wyatt_ui_components/example/lib/main.dart @@ -27,8 +27,7 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override - Widget build(BuildContext context) { - return ComponentTheme( + Widget build(BuildContext context) => ComponentTheme( componentThemeWidget: AppThemeComponent.components, child: MaterialApp( title: 'Wyatt Ui Components Example', @@ -40,7 +39,6 @@ class MyApp extends StatelessWidget { ), ), ); - } } class Home extends StatelessWidget { diff --git a/packages/wyatt_ui_components/example/test/widget_test.dart b/packages/wyatt_ui_components/example/test/widget_test.dart deleted file mode 100644 index bc890a0c..00000000 --- a/packages/wyatt_ui_components/example/test/widget_test.dart +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2023 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . \ No newline at end of file diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart index 1a12cb97..be5dc624 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart @@ -15,8 +15,8 @@ // along with this program. If not, see . import 'package:flutter/material.dart'; -import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/component.dart'; part 'app_bar_component.g.dart'; @@ -24,13 +24,13 @@ part 'app_bar_component.g.dart'; @ComponentProxyExtension() abstract class AppBarComponent extends Component with CopyWithMixin<$AppBarComponentCWProxy> { - final String? title; - final Widget? leading; - final List? actions; const AppBarComponent({ this.title, this.leading, this.actions, super.key, }); + final String? title; + final Widget? leading; + final List? actions; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/bottom_navigation_bar_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/bottom_navigation_bar_component.dart index 0620ef87..0daf25fd 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/bottom_navigation_bar_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/bottom_navigation_bar_component.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; // Copyright (C) 2023 WYATT GROUP // Please see the AUTHORS file for details. // @@ -17,18 +18,17 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/component.dart'; -import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; part 'bottom_navigation_bar_component.g.dart'; @ComponentProxyExtension() abstract class BottomNavigationBarComponent extends Component with CopyWithMixin<$BottomNavigationBarComponentCWProxy> { - final int currentIndex; - final void Function(BuildContext, int)? onTap; const BottomNavigationBarComponent({ this.onTap, this.currentIndex = 0, super.key, }); + final int currentIndex; + final void Function(BuildContext, int)? onTap; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart new file mode 100644 index 00000000..73f7ce79 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart @@ -0,0 +1,60 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_ui_components/src/domain/entities/component.dart'; + +abstract class CardComponent extends Component { + const CardComponent({ + this.radius, + this.padding, + this.borderColors, + this.backgroundColor, + this.minSize, + this.maxSize, + this.shadow, + this.isDarkModeEnabled, + this.background, + super.key, + }); + + /// Card radius + final double? radius; + + /// Padding and gaps of this card + final double? padding; + + /// Border gradient color (from left to right) + final List? borderColors; + + /// Card background color + final Color? backgroundColor; + + /// Minimum size for this card + final Size? minSize; + + /// Maximum size for this card + final Size? maxSize; + + /// Drop shadow + final BoxShadow? shadow; + + /// Is this component in dark mode or not + final bool? isDarkModeEnabled; + + /// Background of the card + final Widget? background; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart new file mode 100644 index 00000000..a6676d0c --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart @@ -0,0 +1,54 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; +import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; + +part 'information_card_component.g.dart'; + +@ComponentProxyExtension() +abstract class InformationCardComponent extends CardComponent + with CopyWithMixin<$InformationCardComponentCWProxy> { + const InformationCardComponent({ + this.icons, + this.title, + this.subtitle, + this.body, + this.axis = Axis.vertical, + super.radius = 12, + super.padding = 25, + super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)], + super.backgroundColor = const Color(0xFFF6F6F6), + super.minSize = const Size(330, 230), + super.maxSize = const Size(330, 530), + super.shadow = const BoxShadow( + blurRadius: 30, + offset: Offset(0, 5), + color: Color.fromRGBO(0, 0, 0, 0.05), + ), + super.isDarkModeEnabled = false, + super.background, + super.key, + }); + + final Axis? axis; + final List? icons; + final Widget? title; + final Widget? subtitle; + final Widget? body; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart new file mode 100644 index 00000000..78cdc783 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart @@ -0,0 +1,42 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'information_card_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $InformationCardComponentCWProxy { + InformationCardComponent icons(List? icons); + InformationCardComponent title(Widget? title); + InformationCardComponent subtitle(Widget? subtitle); + InformationCardComponent body(Widget? body); + InformationCardComponent axis(Axis? axis); + InformationCardComponent radius(double? radius); + InformationCardComponent padding(double? padding); + InformationCardComponent borderColors(List? borderColors); + InformationCardComponent backgroundColor(Color? backgroundColor); + InformationCardComponent minSize(Size? minSize); + InformationCardComponent maxSize(Size? maxSize); + InformationCardComponent shadow(BoxShadow? shadow); + InformationCardComponent isDarkModeEnabled(bool? isDarkModeEnabled); + InformationCardComponent background(Widget? background); + InformationCardComponent key(Key? key); + InformationCardComponent call({ + List? icons, + Widget? title, + Widget? subtitle, + Widget? body, + Axis? axis, + double? radius, + double? padding, + List? borderColors, + Color? backgroundColor, + Size? minSize, + Size? maxSize, + BoxShadow? shadow, + bool? isDarkModeEnabled, + Widget? background, + Key? key, + }); +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart new file mode 100644 index 00000000..76892c39 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -0,0 +1,43 @@ +import 'package:flutter/widgets.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; +import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; + +part 'quote_card_component.g.dart'; + +@ComponentProxyExtension() +abstract class QuoteCardComponent extends CardComponent + with CopyWithMixin<$QuoteCardComponentCWProxy> { + const QuoteCardComponent({ + required this.avatar, + required this.name, + required this.subtitle, + required this.gradient, + required this.quote, + this.leftQuote, + this.rightQuote, + super.radius = 12, + super.padding = 25, + super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)], + super.backgroundColor = const Color(0xFFF6F6F6), + super.minSize = const Size(330, 230), + super.maxSize = const Size(330, 530), + super.shadow = const BoxShadow( + blurRadius: 30, + offset: Offset(0, 5), + color: Color.fromRGBO(0, 0, 0, 0.05), + ), + super.isDarkModeEnabled = false, + super.background, + super.key, + }); + + final Widget avatar; + final Widget name; + final Text subtitle; + final Gradient gradient; + final Widget quote; + + final Widget? leftQuote; + final Widget? rightQuote; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart new file mode 100644 index 00000000..e48b6963 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart @@ -0,0 +1,46 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'quote_card_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $QuoteCardComponentCWProxy { + QuoteCardComponent avatar(Widget? avatar); + QuoteCardComponent name(Widget? name); + QuoteCardComponent subtitle(Text? subtitle); + QuoteCardComponent gradient(Gradient? gradient); + QuoteCardComponent quote(Widget? quote); + QuoteCardComponent leftQuote(Widget? leftQuote); + QuoteCardComponent rightQuote(Widget? rightQuote); + QuoteCardComponent radius(double? radius); + QuoteCardComponent padding(double? padding); + QuoteCardComponent borderColors(List? borderColors); + QuoteCardComponent backgroundColor(Color? backgroundColor); + QuoteCardComponent minSize(Size? minSize); + QuoteCardComponent maxSize(Size? maxSize); + QuoteCardComponent shadow(BoxShadow? shadow); + QuoteCardComponent isDarkModeEnabled(bool? isDarkModeEnabled); + QuoteCardComponent background(Widget? background); + QuoteCardComponent key(Key? key); + QuoteCardComponent call({ + Widget? avatar, + Widget? name, + Text? subtitle, + Gradient? gradient, + Widget? quote, + Widget? leftQuote, + Widget? rightQuote, + double? radius, + double? padding, + List? borderColors, + Color? backgroundColor, + Size? minSize, + Size? maxSize, + BoxShadow? shadow, + bool? isDarkModeEnabled, + Widget? background, + Key? key, + }); +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart index 51d081f6..3a2811ae 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart @@ -16,6 +16,6 @@ export './app_bar_component.dart'; export './bottom_navigation_bar_component.dart'; +export './component.dart'; export './error_widget_component.dart'; export './loading_widget_component.dart'; -export './component.dart'; diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart index e4a0ae83..c896417a 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +import 'package:flutter/material.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/component.dart'; -import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:flutter/material.dart'; part 'error_widget_component.g.dart'; @ComponentProxyExtension() abstract class ErrorWidgetComponent extends Component with CopyWithMixin<$ErrorWidgetComponentCWProxy> { - final String? error; const ErrorWidgetComponent({required this.error, super.key}); + final String? error; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/loading_widget_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/loading_widget_component.dart index c565b6e3..41783f4e 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/loading_widget_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/loading_widget_component.dart @@ -15,15 +15,15 @@ // along with this program. If not, see . import 'package:flutter/material.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/component.dart'; -import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; part 'loading_widget_component.g.dart'; @ComponentProxyExtension() abstract class LoadingWidgetComponent extends Component with CopyWithMixin<$LoadingWidgetComponentCWProxy> { - final Color? color; const LoadingWidgetComponent({required this.color, super.key}); + final Color? color; } diff --git a/packages/wyatt_ui_components/lib/src/features/component_theme.dart b/packages/wyatt_ui_components/lib/src/features/component_theme.dart index 9e3b64d3..49de4780 100644 --- a/packages/wyatt_ui_components/lib/src/features/component_theme.dart +++ b/packages/wyatt_ui_components/lib/src/features/component_theme.dart @@ -18,14 +18,14 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/src/features/features.dart'; class ComponentTheme extends StatelessWidget { - final Widget child; - final ComponentThemeData componentThemeWidget; const ComponentTheme({ required this.child, required this.componentThemeWidget, super.key, }); + final Widget child; + final ComponentThemeData componentThemeWidget; static ComponentThemeData of(BuildContext context) { final _InheritedComponentTheme? inheritedThemeComponent = @@ -46,11 +46,11 @@ class ComponentTheme extends StatelessWidget { } class _InheritedComponentTheme extends InheritedWidget { - final ComponentTheme themeWidget; const _InheritedComponentTheme( this.themeWidget, { required super.child, }); + final ComponentTheme themeWidget; @override bool updateShouldNotify(covariant InheritedWidget oldWidget) => diff --git a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart index f518caa7..0d247bf3 100644 --- a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart +++ b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart @@ -17,10 +17,6 @@ import 'package:wyatt_ui_components/src/domain/entities/entities.dart'; class ComponentThemeData { - final AppBarComponent? appBar; - final BottomNavigationBarComponent? bottomNavigationBar; - final ErrorWidgetComponent? errorWidget; - final LoadingWidgetComponent? loadingWidget; const ComponentThemeData.raw({ this.appBar, @@ -28,4 +24,8 @@ class ComponentThemeData { this.errorWidget, this.loadingWidget, }); + final AppBarComponent? appBar; + final BottomNavigationBarComponent? bottomNavigationBar; + final ErrorWidgetComponent? errorWidget; + final LoadingWidgetComponent? loadingWidget; } diff --git a/packages/wyatt_ui_components/lib/src/features/features.dart b/packages/wyatt_ui_components/lib/src/features/features.dart index 806071dc..6c0f1b4a 100644 --- a/packages/wyatt_ui_components/lib/src/features/features.dart +++ b/packages/wyatt_ui_components/lib/src/features/features.dart @@ -14,5 +14,5 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'component_theme_data.dart'; export 'component_theme.dart'; +export 'component_theme_data.dart'; diff --git a/packages/wyatt_ui_components/pubspec.yaml b/packages/wyatt_ui_components/pubspec.yaml index 47955e53..42033ddd 100644 --- a/packages/wyatt_ui_components/pubspec.yaml +++ b/packages/wyatt_ui_components/pubspec.yaml @@ -3,16 +3,18 @@ description: Primary ui components repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_ui_components version: 0.0.1 +publish_to: none + environment: sdk: ">=2.17.0 <3.0.0" dependencies: flutter: sdk: flutter -wyatt_component_copy_with_extension: - git: - url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git - path: packages/wyatt_component_copy_with_extension + wyatt_component_copy_with_extension: + git: + url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git + path: packages/wyatt_component_copy_with_extension dev_dependencies: flutter_test: -- 2.47.2 From 9bc453e04fb7a23c3feb1e2ccd23624e2ea5eb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 8 Feb 2023 13:23:45 +0100 Subject: [PATCH 3/9] feat(ui_components): export components and add license header --- .../lib/src/domain/entities/cards/cards.dart | 18 ++++++++++++++++++ .../entities/cards/quote_card_component.dart | 16 ++++++++++++++++ .../lib/src/domain/entities/entities.dart | 1 + 3 files changed, 35 insertions(+) create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart new file mode 100644 index 00000000..62d4b88e --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart @@ -0,0 +1,18 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export './information_card_component.dart'; +export './quote_card_component.dart'; diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart index 76892c39..40f11239 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -1,3 +1,19 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import 'package:flutter/widgets.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart index 3a2811ae..0d8a3b29 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart @@ -16,6 +16,7 @@ export './app_bar_component.dart'; export './bottom_navigation_bar_component.dart'; +export './cards/cards.dart'; export './component.dart'; export './error_widget_component.dart'; export './loading_widget_component.dart'; -- 2.47.2 From 8304aaf8c808fdc314a6d778bb6af5244bbb75f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 8 Feb 2023 15:43:20 +0100 Subject: [PATCH 4/9] fix(ui_components): remove darkmode enable field in cards --- .../lib/src/domain/entities/cards/card_component.dart | 4 ---- .../src/domain/entities/cards/information_card_component.dart | 1 - .../domain/entities/cards/information_card_component.g.dart | 2 -- .../lib/src/domain/entities/cards/quote_card_component.dart | 1 - .../lib/src/domain/entities/cards/quote_card_component.g.dart | 2 -- 5 files changed, 10 deletions(-) diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart index 73f7ce79..ea3ef7bc 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart @@ -26,7 +26,6 @@ abstract class CardComponent extends Component { this.minSize, this.maxSize, this.shadow, - this.isDarkModeEnabled, this.background, super.key, }); @@ -52,9 +51,6 @@ abstract class CardComponent extends Component { /// Drop shadow final BoxShadow? shadow; - /// Is this component in dark mode or not - final bool? isDarkModeEnabled; - /// Background of the card final Widget? background; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart index a6676d0c..2af68c67 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart @@ -41,7 +41,6 @@ abstract class InformationCardComponent extends CardComponent offset: Offset(0, 5), color: Color.fromRGBO(0, 0, 0, 0.05), ), - super.isDarkModeEnabled = false, super.background, super.key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart index 78cdc783..c5a3e0fb 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart @@ -19,7 +19,6 @@ abstract class $InformationCardComponentCWProxy { InformationCardComponent minSize(Size? minSize); InformationCardComponent maxSize(Size? maxSize); InformationCardComponent shadow(BoxShadow? shadow); - InformationCardComponent isDarkModeEnabled(bool? isDarkModeEnabled); InformationCardComponent background(Widget? background); InformationCardComponent key(Key? key); InformationCardComponent call({ @@ -35,7 +34,6 @@ abstract class $InformationCardComponentCWProxy { Size? minSize, Size? maxSize, BoxShadow? shadow, - bool? isDarkModeEnabled, Widget? background, Key? key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart index 40f11239..004cfea8 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -43,7 +43,6 @@ abstract class QuoteCardComponent extends CardComponent offset: Offset(0, 5), color: Color.fromRGBO(0, 0, 0, 0.05), ), - super.isDarkModeEnabled = false, super.background, super.key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart index e48b6963..9e7f4318 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart @@ -21,7 +21,6 @@ abstract class $QuoteCardComponentCWProxy { QuoteCardComponent minSize(Size? minSize); QuoteCardComponent maxSize(Size? maxSize); QuoteCardComponent shadow(BoxShadow? shadow); - QuoteCardComponent isDarkModeEnabled(bool? isDarkModeEnabled); QuoteCardComponent background(Widget? background); QuoteCardComponent key(Key? key); QuoteCardComponent call({ @@ -39,7 +38,6 @@ abstract class $QuoteCardComponentCWProxy { Size? minSize, Size? maxSize, BoxShadow? shadow, - bool? isDarkModeEnabled, Widget? background, Key? key, }); -- 2.47.2 From 82a643cbb4174f5b98ecb055ec5e1f5540591e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 8 Feb 2023 15:54:50 +0100 Subject: [PATCH 5/9] feat(ui_components): make fields nullable and not required in quote card --- .../entities/cards/quote_card_component.dart | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart index 004cfea8..c5ac26c7 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -25,11 +25,11 @@ part 'quote_card_component.g.dart'; abstract class QuoteCardComponent extends CardComponent with CopyWithMixin<$QuoteCardComponentCWProxy> { const QuoteCardComponent({ - required this.avatar, - required this.name, - required this.subtitle, - required this.gradient, - required this.quote, + this.avatar, + this.name, + this.subtitle, + this.gradient, + this.quote, this.leftQuote, this.rightQuote, super.radius = 12, @@ -47,11 +47,11 @@ abstract class QuoteCardComponent extends CardComponent super.key, }); - final Widget avatar; - final Widget name; - final Text subtitle; - final Gradient gradient; - final Widget quote; + final Widget? avatar; + final Widget? name; + final Text? subtitle; + final Gradient? gradient; + final Widget? quote; final Widget? leftQuote; final Widget? rightQuote; -- 2.47.2 From 47773872ebf5fc6a8475127993771aec375d5d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 8 Feb 2023 17:42:33 +0100 Subject: [PATCH 6/9] feat(ui_components): add text wrapper instead of String/Widget for Texts --- .../lib/components/custom_app_bar.dart | 4 ++- .../lib/components/custom_app_bar.g.dart | 4 +-- .../lib/components/custom_error_widget.dart | 2 +- .../lib/components/custom_error_widget.g.dart | 4 +-- .../lib/src/core/core.dart | 2 ++ .../lib/src/core/utils/text_wrapper.dart | 26 +++++++++++++++++++ .../domain/entities/app_bar_component.dart | 5 ++-- .../domain/entities/app_bar_component.g.dart | 4 +-- .../cards/information_card_component.dart | 12 ++++----- .../cards/information_card_component.g.dart | 12 ++++----- .../entities/cards/quote_card_component.dart | 14 +++++----- .../cards/quote_card_component.g.dart | 12 ++++----- .../entities/error_widget_component.dart | 5 ++-- .../entities/error_widget_component.g.dart | 4 +-- 14 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart diff --git a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart index 924281cb..95110dd8 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart @@ -10,6 +10,8 @@ class CustomAppBar extends AppBarComponent with $CustomAppBarCWMixin { @override Widget build(BuildContext context) => AppBar( - title: Text(super.title ?? ''), + title: Text( + super.title?.text ?? '', + ), ); } diff --git a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart index 89c78122..2fd0319a 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart @@ -10,7 +10,7 @@ class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy { const $CustomAppBarCWProxyImpl(this._value); final CustomAppBar _value; @override - CustomAppBar title(String? title) => this(title: title); + CustomAppBar title(TextWrapper? title) => this(title: title); @override CustomAppBar leading(Widget? leading) => this(leading: leading); @override @@ -19,7 +19,7 @@ class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy { CustomAppBar key(Key? key) => this(key: key); @override CustomAppBar call({ - String? title, + TextWrapper? title, Widget? leading, List? actions, Key? key, diff --git a/packages/wyatt_ui_components/example/lib/components/custom_error_widget.dart b/packages/wyatt_ui_components/example/lib/components/custom_error_widget.dart index 450cf851..b0336e29 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_error_widget.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_error_widget.dart @@ -12,6 +12,6 @@ class CustomErrorWidget extends ErrorWidgetComponent @override Widget build(BuildContext context) => ColoredBox( color: Colors.red, - child: Center(child: Text(error ?? 'Error')), + child: Center(child: Text(error?.text ?? 'Error')), ); } diff --git a/packages/wyatt_ui_components/example/lib/components/custom_error_widget.g.dart b/packages/wyatt_ui_components/example/lib/components/custom_error_widget.g.dart index 67f26fcf..ae1e64dd 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_error_widget.g.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_error_widget.g.dart @@ -10,12 +10,12 @@ class $CustomErrorWidgetCWProxyImpl implements $ErrorWidgetComponentCWProxy { const $CustomErrorWidgetCWProxyImpl(this._value); final CustomErrorWidget _value; @override - CustomErrorWidget error(String? error) => this(error: error); + CustomErrorWidget error(TextWrapper? error) => this(error: error); @override CustomErrorWidget key(Key? key) => this(key: key); @override CustomErrorWidget call({ - String? error, + TextWrapper? error, Key? key, }) => CustomErrorWidget( diff --git a/packages/wyatt_ui_components/lib/src/core/core.dart b/packages/wyatt_ui_components/lib/src/core/core.dart index 243dd3d2..dd4b140f 100644 --- a/packages/wyatt_ui_components/lib/src/core/core.dart +++ b/packages/wyatt_ui_components/lib/src/core/core.dart @@ -15,3 +15,5 @@ // along with this program. If not, see . export 'extensions/build_context_extensions.dart'; +export 'mixins/copy_with_mixin.dart'; +export 'utils/text_wrapper.dart'; diff --git a/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart new file mode 100644 index 00000000..d3ce5513 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart @@ -0,0 +1,26 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/material.dart'; + +class TextWrapper { + TextWrapper(this.text, {this.style}); + + factory TextWrapper.text(String text) => TextWrapper(text); + + final String text; + final TextStyle? style; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart index be5dc624..4345b741 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.dart @@ -16,8 +16,7 @@ import 'package:flutter/material.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; -import 'package:wyatt_ui_components/src/domain/entities/component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; part 'app_bar_component.g.dart'; @@ -30,7 +29,7 @@ abstract class AppBarComponent extends Component this.actions, super.key, }); - final String? title; + final TextWrapper? title; final Widget? leading; final List? actions; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.g.dart index fe0b0b20..e16ec248 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/app_bar_component.g.dart @@ -7,12 +7,12 @@ part of 'app_bar_component.dart'; // ************************************************************************** abstract class $AppBarComponentCWProxy { - AppBarComponent title(String? title); + AppBarComponent title(TextWrapper? title); AppBarComponent leading(Widget? leading); AppBarComponent actions(List? actions); AppBarComponent key(Key? key); AppBarComponent call({ - String? title, + TextWrapper? title, Widget? leading, List? actions, Key? key, diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart index 2af68c67..614729a2 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart @@ -16,8 +16,8 @@ import 'package:flutter/widgets.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; part 'information_card_component.g.dart'; @@ -32,8 +32,8 @@ abstract class InformationCardComponent extends CardComponent this.axis = Axis.vertical, super.radius = 12, super.padding = 25, - super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)], - super.backgroundColor = const Color(0xFFF6F6F6), + super.borderColors, + super.backgroundColor, super.minSize = const Size(330, 230), super.maxSize = const Size(330, 530), super.shadow = const BoxShadow( @@ -47,7 +47,7 @@ abstract class InformationCardComponent extends CardComponent final Axis? axis; final List? icons; - final Widget? title; - final Widget? subtitle; - final Widget? body; + final TextWrapper? title; + final TextWrapper? subtitle; + final TextWrapper? body; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart index c5a3e0fb..b4387287 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.g.dart @@ -8,9 +8,9 @@ part of 'information_card_component.dart'; abstract class $InformationCardComponentCWProxy { InformationCardComponent icons(List? icons); - InformationCardComponent title(Widget? title); - InformationCardComponent subtitle(Widget? subtitle); - InformationCardComponent body(Widget? body); + InformationCardComponent title(TextWrapper? title); + InformationCardComponent subtitle(TextWrapper? subtitle); + InformationCardComponent body(TextWrapper? body); InformationCardComponent axis(Axis? axis); InformationCardComponent radius(double? radius); InformationCardComponent padding(double? padding); @@ -23,9 +23,9 @@ abstract class $InformationCardComponentCWProxy { InformationCardComponent key(Key? key); InformationCardComponent call({ List? icons, - Widget? title, - Widget? subtitle, - Widget? body, + TextWrapper? title, + TextWrapper? subtitle, + TextWrapper? body, Axis? axis, double? radius, double? padding, diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart index c5ac26c7..e11f3502 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -16,8 +16,8 @@ import 'package:flutter/widgets.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; part 'quote_card_component.g.dart'; @@ -34,8 +34,8 @@ abstract class QuoteCardComponent extends CardComponent this.rightQuote, super.radius = 12, super.padding = 25, - super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)], - super.backgroundColor = const Color(0xFFF6F6F6), + super.borderColors, + super.backgroundColor, super.minSize = const Size(330, 230), super.maxSize = const Size(330, 530), super.shadow = const BoxShadow( @@ -48,11 +48,11 @@ abstract class QuoteCardComponent extends CardComponent }); final Widget? avatar; - final Widget? name; - final Text? subtitle; - final Gradient? gradient; - final Widget? quote; + final TextWrapper? name; + final TextWrapper? subtitle; + final TextWrapper? quote; + final Gradient? gradient; final Widget? leftQuote; final Widget? rightQuote; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart index 9e7f4318..12dcf876 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.g.dart @@ -8,10 +8,10 @@ part of 'quote_card_component.dart'; abstract class $QuoteCardComponentCWProxy { QuoteCardComponent avatar(Widget? avatar); - QuoteCardComponent name(Widget? name); - QuoteCardComponent subtitle(Text? subtitle); + QuoteCardComponent name(TextWrapper? name); + QuoteCardComponent subtitle(TextWrapper? subtitle); QuoteCardComponent gradient(Gradient? gradient); - QuoteCardComponent quote(Widget? quote); + QuoteCardComponent quote(TextWrapper? quote); QuoteCardComponent leftQuote(Widget? leftQuote); QuoteCardComponent rightQuote(Widget? rightQuote); QuoteCardComponent radius(double? radius); @@ -25,10 +25,10 @@ abstract class $QuoteCardComponentCWProxy { QuoteCardComponent key(Key? key); QuoteCardComponent call({ Widget? avatar, - Widget? name, - Text? subtitle, + TextWrapper? name, + TextWrapper? subtitle, Gradient? gradient, - Widget? quote, + TextWrapper? quote, Widget? leftQuote, Widget? rightQuote, double? radius, diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart index c896417a..bba5c1c6 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.dart @@ -16,8 +16,7 @@ import 'package:flutter/material.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart'; -import 'package:wyatt_ui_components/src/domain/entities/component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; part 'error_widget_component.g.dart'; @@ -25,5 +24,5 @@ part 'error_widget_component.g.dart'; abstract class ErrorWidgetComponent extends Component with CopyWithMixin<$ErrorWidgetComponentCWProxy> { const ErrorWidgetComponent({required this.error, super.key}); - final String? error; + final TextWrapper? error; } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.g.dart index 6d62b709..c7dba4d6 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.g.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/error_widget_component.g.dart @@ -7,10 +7,10 @@ part of 'error_widget_component.dart'; // ************************************************************************** abstract class $ErrorWidgetComponentCWProxy { - ErrorWidgetComponent error(String? error); + ErrorWidgetComponent error(TextWrapper? error); ErrorWidgetComponent key(Key? key); ErrorWidgetComponent call({ - String? error, + TextWrapper? error, Key? key, }); } -- 2.47.2 From 3c1c63235fb93ca225050af63e0c7bc2dad142d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 8 Feb 2023 21:33:23 +0100 Subject: [PATCH 7/9] feat: make text wrapper constructor constant --- .../wyatt_ui_components/lib/src/core/utils/text_wrapper.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart index d3ce5513..cc9e4119 100644 --- a/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart +++ b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart @@ -17,7 +17,7 @@ import 'package:flutter/material.dart'; class TextWrapper { - TextWrapper(this.text, {this.style}); + const TextWrapper(this.text, {this.style}); factory TextWrapper.text(String text) => TextWrapper(text); -- 2.47.2 From e934595ee9f44ac848aacbc9f292f03fbe5bc50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Thu, 9 Feb 2023 15:15:53 +0100 Subject: [PATCH 8/9] feat(ui_components): add portfolio & skill cards #126 --- .../domain/entities/cards/card_component.dart | 14 +++-- .../cards/information_card_component.dart | 14 ++--- .../cards/portfolio_card_component.dart | 55 +++++++++++++++++++ .../cards/portfolio_card_component.g.dart | 46 ++++++++++++++++ .../entities/cards/quote_card_component.dart | 14 ++--- .../entities/cards/skill_card_component.dart | 51 +++++++++++++++++ .../cards/skill_card_component.g.dart | 42 ++++++++++++++ 7 files changed, 213 insertions(+), 23 deletions(-) create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.g.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.g.dart diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart index ea3ef7bc..abb87bca 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/card_component.dart @@ -19,13 +19,17 @@ import 'package:wyatt_ui_components/src/domain/entities/component.dart'; abstract class CardComponent extends Component { const CardComponent({ - this.radius, - this.padding, + this.radius = 12, + this.padding = 25, this.borderColors, this.backgroundColor, - this.minSize, - this.maxSize, - this.shadow, + this.minSize = const Size(330, 230), + this.maxSize = const Size(330, 530), + this.shadow = const BoxShadow( + blurRadius: 30, + offset: Offset(0, 5), + color: Color.fromRGBO(0, 0, 0, 0.05), + ), this.background, super.key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart index 614729a2..611586b5 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/information_card_component.dart @@ -30,17 +30,13 @@ abstract class InformationCardComponent extends CardComponent this.subtitle, this.body, this.axis = Axis.vertical, - super.radius = 12, - super.padding = 25, + super.radius, + super.padding, super.borderColors, super.backgroundColor, - super.minSize = const Size(330, 230), - super.maxSize = const Size(330, 530), - super.shadow = const BoxShadow( - blurRadius: 30, - offset: Offset(0, 5), - color: Color.fromRGBO(0, 0, 0, 0.05), - ), + super.minSize, + super.maxSize, + super.shadow, super.background, super.key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.dart new file mode 100644 index 00000000..80399b90 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.dart @@ -0,0 +1,55 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; + +part 'portfolio_card_component.g.dart'; + +@ComponentProxyExtension() +abstract class PortfolioCardComponent extends CardComponent + with CopyWithMixin<$PortfolioCardComponentCWProxy> { + const PortfolioCardComponent({ + this.showImagesOnTop, + this.keyword, + this.description, + this.logo, + this.projectName, + this.subtitle, + this.ctas, + this.assets, + super.radius, + super.padding, + super.borderColors, + super.backgroundColor, + super.minSize, + super.maxSize, + super.shadow, + super.background, + super.key, + }); + + final bool? showImagesOnTop; + final List? keyword; + final List? assets; + final TextWrapper? description; + final String? logo; + final TextWrapper? projectName; + final TextWrapper? subtitle; + final List? ctas; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.g.dart new file mode 100644 index 00000000..1601c1ee --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/portfolio_card_component.g.dart @@ -0,0 +1,46 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'portfolio_card_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $PortfolioCardComponentCWProxy { + PortfolioCardComponent showImagesOnTop(bool? showImagesOnTop); + PortfolioCardComponent keyword(List? keyword); + PortfolioCardComponent description(TextWrapper? description); + PortfolioCardComponent logo(String? logo); + PortfolioCardComponent projectName(TextWrapper? projectName); + PortfolioCardComponent subtitle(TextWrapper? subtitle); + PortfolioCardComponent ctas(List? ctas); + PortfolioCardComponent assets(List? assets); + PortfolioCardComponent radius(double? radius); + PortfolioCardComponent padding(double? padding); + PortfolioCardComponent borderColors(List? borderColors); + PortfolioCardComponent backgroundColor(Color? backgroundColor); + PortfolioCardComponent minSize(Size? minSize); + PortfolioCardComponent maxSize(Size? maxSize); + PortfolioCardComponent shadow(BoxShadow? shadow); + PortfolioCardComponent background(Widget? background); + PortfolioCardComponent key(Key? key); + PortfolioCardComponent call({ + bool? showImagesOnTop, + List? keyword, + TextWrapper? description, + String? logo, + TextWrapper? projectName, + TextWrapper? subtitle, + List? ctas, + List? assets, + double? radius, + double? padding, + List? borderColors, + Color? backgroundColor, + Size? minSize, + Size? maxSize, + BoxShadow? shadow, + Widget? background, + Key? key, + }); +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart index e11f3502..d6ea327c 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/quote_card_component.dart @@ -32,17 +32,13 @@ abstract class QuoteCardComponent extends CardComponent this.quote, this.leftQuote, this.rightQuote, - super.radius = 12, - super.padding = 25, + super.radius, + super.padding, super.borderColors, super.backgroundColor, - super.minSize = const Size(330, 230), - super.maxSize = const Size(330, 530), - super.shadow = const BoxShadow( - blurRadius: 30, - offset: Offset(0, 5), - color: Color.fromRGBO(0, 0, 0, 0.05), - ), + super.minSize, + super.maxSize, + super.shadow, super.background, super.key, }); diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.dart new file mode 100644 index 00000000..2a04a30b --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.dart @@ -0,0 +1,51 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; + +part 'skill_card_component.g.dart'; + +@ComponentProxyExtension() +abstract class SkillCardComponent extends CardComponent + with CopyWithMixin<$SkillCardComponentCWProxy> { + const SkillCardComponent({ + this.icon, + this.gradient, + this.title, + this.description, + this.skills, + this.leadingIcon, + super.radius, + super.padding, + super.borderColors, + super.backgroundColor, + super.minSize, + super.maxSize, + super.shadow, + super.background, + super.key, + }); + + final IconData? icon; + final List? gradient; + final TextWrapper? title; + final TextWrapper? description; + final List? skills; + final IconData? leadingIcon; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.g.dart new file mode 100644 index 00000000..525b8bd7 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/skill_card_component.g.dart @@ -0,0 +1,42 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'skill_card_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $SkillCardComponentCWProxy { + SkillCardComponent icon(IconData? icon); + SkillCardComponent gradient(List? gradient); + SkillCardComponent title(TextWrapper? title); + SkillCardComponent description(TextWrapper? description); + SkillCardComponent skills(List? skills); + SkillCardComponent leadingIcon(IconData? leadingIcon); + SkillCardComponent radius(double? radius); + SkillCardComponent padding(double? padding); + SkillCardComponent borderColors(List? borderColors); + SkillCardComponent backgroundColor(Color? backgroundColor); + SkillCardComponent minSize(Size? minSize); + SkillCardComponent maxSize(Size? maxSize); + SkillCardComponent shadow(BoxShadow? shadow); + SkillCardComponent background(Widget? background); + SkillCardComponent key(Key? key); + SkillCardComponent call({ + IconData? icon, + List? gradient, + TextWrapper? title, + TextWrapper? description, + List? skills, + IconData? leadingIcon, + double? radius, + double? padding, + List? borderColors, + Color? backgroundColor, + Size? minSize, + Size? maxSize, + BoxShadow? shadow, + Widget? background, + Key? key, + }); +} -- 2.47.2 From 931c40a5a432dae984c0775bb3868758746a3d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Thu, 9 Feb 2023 15:21:23 +0100 Subject: [PATCH 9/9] feat(ui_components): export cards #126 --- .../lib/src/domain/entities/cards/cards.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart b/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart index 62d4b88e..e9240b4f 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/cards/cards.dart @@ -15,4 +15,6 @@ // along with this program. If not, see . export './information_card_component.dart'; +export './portfolio_card_component.dart'; export './quote_card_component.dart'; +export './skill_card_component.dart'; -- 2.47.2