Compare commits

..
Author SHA1 Message Date
hugo d098d9a6bf feat(analysis): add latest version persistence between script executions
continuous-integration/drone/push Build is passing
2023-02-23 18:53:03 +01:00
hugo 0f8c5bb983 ci(analysis): ignore script in publish (closes #124) 2023-02-23 18:52:27 +01:00
hugo 20f07a177b feat(analysis): ignore todo's 2023-02-23 18:50:17 +01:00
hugo 1a48b606a4 refactor(ui): replace ThemeResolver by ThemeHelper in Loader / RichTextBuilder (closes #148) 2023-02-23 18:27:17 +01:00
hugo 6c54689393 refactor(ui)!: remove bloc export in buttons to be state management solution agnostic (closes #147) 2023-02-23 16:59:56 +01:00
hugo d6c9dfd8a7 feat(ui_components): add extra state 2023-02-23 16:57:18 +01:00
hugo 881cbc5bef fix(ui): change example to be compatible with new AppTopBar and TextWrapper 2023-02-23 11:50:13 +01:00
malo 81c8851ac8 style(ui_components): remove useless comment
continuous-integration/drone/push Build is passing
2023-02-23 10:40:05 +01:00
malo 0c176ba0fa feat(ui_kit-ui_components): Modify the theme resolver to utilize the theme helper and streamline the logic 2023-02-23 10:24:54 +01:00
malo 970dde2ef1 feat(ui_kit): remove .raw call 2023-02-23 09:33:05 +01:00
malo 2e187b26eb feat(ui_kit): export ui kit as component theme data 2023-02-23 09:30:11 +01:00
malo 0337d4f97a feat(ui_components): make component theme data copyable 2023-02-23 09:29:46 +01:00
malo 3c3545abfe style(ui_kit): remove test style
continuous-integration/drone/push Build is passing
2023-02-22 19:29:39 +01:00
malo 2dfbd59773 feat(ui_kit): allow to cascade styles in ThemeHelper 2023-02-22 19:28:09 +01:00
malo 4a3fde3a1e feat(ui_kit): implement top nav bar
continuous-integration/drone/push Build is passing
2023-02-22 17:43:42 +01:00
malo 317eb56d66 refactor(ui_kit): adapt ui_kit 2023-02-22 16:13:07 +01:00
malo b9dac32143 refactor(ui_components): migrate top nav bar using generify top bar 2023-02-22 16:10:25 +01:00
malo 8955788fa5 feat(ui_components): generify bars 2023-02-22 16:05:40 +01:00
malo ca6af3ccc3 style(ui_components): clean folders and gather bars 2023-02-22 16:01:51 +01:00
malo ad0f1ec1c5 feat(ui_kit): implement top app bar and update example 2023-02-22 15:50:46 +01:00
malo 41a484c013 feat(ui_components): update attributs and proxy most of appbar attributs 2023-02-22 15:50:21 +01:00
malo 4811ed8998 feat(ui_components): add centerTitle property to app bar component 2023-02-22 11:37:29 +01:00
malo dba14088b0 style(ui_components): format imports 2023-02-22 11:25:22 +01:00
malo b2fe14a123 feat(ui_components): add top navigation bar component to theme data 2023-02-22 11:24:30 +01:00
malo bbd3f0a02d feat(ui_components): add Top Navigation Bar Component 2023-02-22 11:23:08 +01:00
malo 79dc34414c fix(ui_components): add loader to theme data (close #152)
continuous-integration/drone/push Build is passing
2023-02-22 00:02:26 +00:00
malo 349d1ae288 feat(ui_components): add new components to theme data (close #152) 2023-02-22 00:02:26 +00:00
malo 49b534d145 fix(ui_kit): fix tab action focus on textinputs
continuous-integration/drone/push Build is passing
2023-02-21 18:44:11 +01:00
hugo a68da15cdc feat(ui): add some useful text customization in TextWrapper (closes #149)
continuous-integration/drone/push Build is passing
2023-02-21 18:05:56 +01:00
hugo 6037e13f50 fix(ui_component): inverse merge in TextInputStyle
continuous-integration/drone/push Build is passing
2023-02-21 16:08:23 +01:00
hugo 93cc5058d1 refactor(ui_kit): use ThemeHelper in cards 2023-02-21 15:37:42 +01:00
hugo 12d04c91ed fix(ui): use multicolor in cards 2023-02-21 15:17:05 +01:00
hugo 5906d54aad build(ui_component): remove freezed 2023-02-21 15:08:24 +01:00
hugo b077f4baf0 refactor(ui_kit): rename GradientBoxBorder 2023-02-21 15:07:56 +01:00
malo 133e0e910b fix(ui_kit): make card core stateless 2023-02-21 13:34:04 +01:00
malo 25224469b5 fix(ui_components): fix MultiColor lerp method 2023-02-21 13:27:19 +01:00
malo 6537945946 fix(ui_kit): remove null check operator in RichTextBuilder component 2023-02-21 13:23:51 +01:00
malo 702164082a fix(ui_kit): remove null check operator in Loader component 2023-02-21 13:19:11 +01:00
malo f2b8c03dd7 refactor(ui_kit): update textinput component using borderColors as Color 2023-02-21 13:15:47 +01:00
malo 51672cc95a refactor(ui_components): move borderColors type 2023-02-21 13:13:01 +01:00
malo eda643e9b4 chore(ui_components): remove g files and copy with deps 2023-02-21 13:09:20 +01:00
malo cae4b68046 refactor(ui_components): add CopyWith method in ThemeStyle 2023-02-21 12:10:17 +01:00
malo 4030511f4a fix(ui_components-ui_kit): fix, clean and unify logic and code after rebase 2023-02-21 09:54:19 +01:00
malo 8ed8a71c7c fix(ui_kit): fix conflicts in card component after rebase 2023-02-21 08:53:38 +01:00
malo b6d22002ee fix(ui_kit): fix export theme file 2023-02-21 08:52:18 +01:00
malo 9b9339cb56 chore(ui_components): add copywith deps 2023-02-21 08:49:52 +01:00
malo b57500b854 feat(ui_kit): update example (#138) 2023-02-21 08:46:14 +01:00
malo 1edb1f7324 feat(ui_kit): implemement text inputs (#138) 2023-02-21 08:37:36 +01:00
malo edf72cf4c2 feat(ui_components):add text input components, theme extension and worked on utils (#138) 2023-02-21 08:36:58 +01:00
malo f6c16c5dc4 feat(ui_components): add isColor getter in multicolor helper 2023-02-21 08:35:12 +01:00
malo c6beae597b refactor(ui_components): update colors using Multicolor class (#138) 2023-02-21 08:35:12 +01:00
malo c2b60f2d79 feat(ui_kit): add text input theme extension (#138) 2023-02-21 08:35:12 +01:00
malo 1e8d5d088e chore(ui_components): export text inputs (#138) 2023-02-21 08:35:04 +01:00
malo 419c99c103 feat(ui_components): add text input abstract class (#138) 2023-02-21 08:32:38 +01:00
hugo 5387dd6eed build(ui_kit): use hosted version of bloc_helper
continuous-integration/drone/push Build is passing
2023-02-17 17:26:23 +01:00
hugo f67e4aa112 ci: use latest dart version in ci container
continuous-integration/drone/push Build is passing
2023-02-17 16:28:22 +01:00
hugo 2769d45e20 fix(ui_kit): fix text align, add selection and update example for rich text builder
continuous-integration/drone/push Build is failing
2023-02-17 15:57:54 +01:00
hugo 66719732f7 feat(ui_kit): implement rich text builder (closes #141) 2023-02-17 14:49:41 +01:00
hugo 25018dc78a feat(ui_component): add rich text builder / parser 2023-02-17 14:48:49 +01:00
hugo efeb3acff3 build(ui): optimize build runner 2023-02-17 14:48:23 +01:00
hugo ef52015372 refactor(ui): rework text gradient and text wrapper 2023-02-17 14:47:56 +01:00
hugo c5f8b69184 style(ui_kit): add example demo-page auto-generation
continuous-integration/drone/push Build is failing
2023-02-16 15:13:55 +01:00
hugo 33984b1733 feat(ui_kit): add loader implementation 2023-02-16 15:13:21 +01:00
hugo a47c28a4d6 feat(ui_component): add loader component and style 2023-02-16 15:12:40 +01:00
hugo 63bbde8213 refactor(ui_component): remove CopyWith extension 2023-02-16 15:12:18 +01:00
hugo 8070623e88 fix(ui_component): add generated component with theme resolver 2023-02-16 15:11:34 +01:00
hugo 4c08a692d2 refactor(ui_kit): move exportable bloc from mixin to widget
continuous-integration/drone/push Build is failing
2023-02-16 11:55:11 +01:00
hugo 8044d07413 fix(ui_component): add style merge in Theme Resolver 2023-02-16 11:54:42 +01:00
hugo 1af9b0b1f1 refactor(ui_kit): make resolve private and dotter child a widget 2023-02-16 10:23:48 +01:00
hugo 3a7b0abc58 style(ui_kit): fix padding file selection
continuous-integration/drone/push Build is failing
2023-02-15 22:40:19 +01:00
hugo dd198b0e51 feat(ui_kit): update example with full studio button theme 2023-02-15 22:36:26 +01:00
hugo a595183107 fix(ui_component): fix extra value in compute extension function 2023-02-15 22:35:31 +01:00
hugo c786c153e0 feat(ui_kit): add theme control in example 2023-02-15 21:45:46 +01:00
hugo cc71bf7abd feat(ui_kit): finalize material ready buttons 2023-02-15 21:07:53 +01:00
hugo ed06e18043 fix(ui): move theme_resolver in compnoent to fix code generation 2023-02-15 20:35:25 +01:00
hugo 96781880f4 feat(ui): move style implementation from component to ui_kit with theme resolver 2023-02-15 20:14:32 +01:00
hugo c331bc6056 feat(ui_kit): add theme extension support in buttons + theme negociation 2023-02-15 15:57:36 +01:00
hugo 77ce4e33ab feat(ui_kit): add theme extension shortcut 2023-02-15 15:57:04 +01:00
hugo 2806ac5923 feat(ui_component): add copyWith gen and make button style lerping 2023-02-15 15:56:35 +01:00
hugo ed29f39673 refactor(ui_component): move extensions 2023-02-15 15:55:46 +01:00
hugo 7880293723 feat(ui_component): add lerp on multicolor 2023-02-15 15:55:27 +01:00
hugo 5c34528b3d fix(ui_kit): add cacheExtend as a trade-off in listview example 2023-02-14 14:49:39 +01:00
hugo 198d83b663 fix(ui_kit): add local font assets + compress images 2023-02-14 14:48:11 +01:00
hugo bd636e9d24 docs(ui_kit): add theme negociation explaination 2023-02-14 14:20:00 +01:00
hugo c942e2aacf feat(ui_kit): update example with drawer and custom launch parameters 2023-02-14 12:50:46 +01:00
hugo 82eeba4d7d feat(ui_kit): add multicolor support in linear gradient helper 2023-02-14 12:50:17 +01:00
hugo 4695cf0618 feat(ui_kit): implement file selection button with invalid cubit and dotted package 2023-02-14 11:55:34 +01:00
hugo d49a4cad31 feat(ui_component): add file selection component 2023-02-14 11:55:34 +01:00
hugo e4d904eb8d feat(ui_kit): implement simple icon button and use dimension style 2023-02-14 11:55:34 +01:00
hugo 4f1a064298 feat(ui_component): add simple icon button and dimension style 2023-02-14 11:55:34 +01:00
hugo 168d840b87 feat(ui_kit): add symbol button + enhance bloc control over state 2023-02-14 11:55:34 +01:00
hugo aea71fa32c feat(ui_kit): add symbol button 2023-02-14 11:55:34 +01:00
hugo b6f25dd5b5 refactor(ui_kit): use tapped state and merged styles 2023-02-14 11:55:34 +01:00
hugo 61e28ce5e7 refactor(ui_component): merge flat and outline buttons in only one style 2023-02-14 11:55:34 +01:00
hugo 5050e2c2bb feat(ui_component): add tapped control state 2023-02-14 11:55:34 +01:00
hugo 9e1b76e07b feat(ui_kit): use MultiColor in button style 2023-02-14 11:55:34 +01:00
hugo 442baa6882 feat(ui_component): add MultiColor util class 2023-02-14 11:55:34 +01:00
hugo 60126fffc4 feat(ui_kit): implement flat/outlined button 2023-02-14 11:55:34 +01:00
hugo 07572aeca2 feat(ui_component): add flat/outlined button styles 2023-02-14 11:55:34 +01:00
hugo 4332eafda0 feat(ui_kit): implement flat button 2023-02-14 11:55:34 +01:00
hugo 160b30d21b feat(ui_component): add button components 2023-02-14 11:54:48 +01:00
hugo 602a372d7c fix(uikit): remove useless file 2023-02-14 11:54:48 +01:00
hugo 43df087319 chore: update repo bricks 2023-02-14 11:54:48 +01:00
hugo 4f71118a65 chore(uikit): create package with mason 2023-02-14 11:54:48 +01:00
malo 4b37175d17 feat(ui_kit): add card theme extension, fix bugs & update example (close #126)
continuous-integration/drone/push Build is failing
2023-02-14 11:34:45 +01:00
malo ea18d39c44 style(ui_kit): remove cache files
continuous-integration/drone/push Build is failing
2023-02-10 16:23:08 +01:00
malo b9f2305bca build(ui_kit): add firebase config 2023-02-10 16:17:35 +01:00
malo 55822ad870 feat(ui_kit): add quote / skill / portfolio cards (#126)
continuous-integration/drone/push Build is failing
2023-02-10 16:01:07 +01:00
malo a563bd1fe3 style(ui_kit): add macos platform in example
continuous-integration/drone/push Build is failing
2023-02-10 14:19:32 +01:00
malo 5464cd1d40 feat(ui_kit): implement information card (#126)
continuous-integration/drone/push Build is failing
2023-02-10 14:08:04 +01:00
malo ba1c1016e5 style(ui_kit): remove default files 2023-02-10 11:35:51 +01:00
malo 23b608ed10 feat(ui_components): add gradient attribut to text wrapper
continuous-integration/drone/push Build is failing
2023-02-10 11:25:39 +01:00
hugo 44b2b7c27d chore(ui_kit): create package template
continuous-integration/drone/push Build is failing
2023-02-09 18:10:11 +01:00
hugo 6bad9a8a05 fix(ui_layout): fix textwrapper 2023-02-09 18:09:45 +01:00
hugo 5d8f94bee8 fix(cw_gen): fix textwrapper 2023-02-09 18:09:14 +01:00
hugo 75cb341447 fix(bloc_layout): fix textwrapper 2023-02-09 18:08:49 +01:00
hugo efa7ca09dd feat(ui_component): add string extension to easely wrap text 2023-02-09 18:08:03 +01:00
malo ac432f6dc8 feat(ui_components): export cards #126
continuous-integration/drone/push Build is failing
2023-02-09 16:50:48 +00:00
malo 6c85faba82 feat(ui_components): add portfolio & skill cards #126 2023-02-09 16:50:48 +00:00
malo dd75ecfc7a feat: make text wrapper constructor constant 2023-02-09 16:50:48 +00:00
malo 0132771e17 feat(ui_components): add text wrapper instead of String/Widget for Texts 2023-02-09 16:50:48 +00:00
malo 5d5ae145aa feat(ui_components): make fields nullable and not required in quote card 2023-02-09 16:50:48 +00:00
malo 07428a5215 fix(ui_components): remove darkmode enable field in cards 2023-02-09 16:50:48 +00:00
malo c994c822b0 feat(ui_components): export components and add license header 2023-02-09 16:50:48 +00:00
malo bde54e0cf5 feat(ui_components): add information_card & quote_card (#126) 2023-02-09 16:50:48 +00:00
malo f3c3939ba1 docs: update readme
continuous-integration/drone/push Build is failing
2023-02-07 14:26:53 +00:00
294 changed files with 16398 additions and 248 deletions
+2 -2
View File
@@ -20,12 +20,12 @@ name: default
steps:
- name: quality-check
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0-1
commands:
- melos run quality-check
- melos run publish:validate
- name: publish
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0-1
commands:
- melos run publish:validate
+44 -50
View File
@@ -17,11 +17,7 @@
-->
<p align="center">
<a href="https://wyattapp.io">
<img width="150px" src="resources/wyatt-campus-logo.png">
</a>
<a href="https://wyatt-studio.fr">
<a href="https://wyatt-studio.fr">
<img width="150px" src="resources/wyatt-studio-logo.png">
</a>
<h1 align="center">Wyatt Packages</h1>
@@ -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_<name> --description A new Wyatt package --flutter_only false
```
Then bootstrap project with `melos bs` command.
The <name> 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 `<name>` 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.
+1 -1
View File
@@ -1 +1 @@
{"bricks":{"wyatt_clean_code":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_clean_code","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}},"wyatt_feature_brick":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_feature_brick","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}},"wyatt_package_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package_template","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}}}}
{"bricks":{"wyatt_component_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_component_template","ref":"7cea909470ce75b91840f479649b93f953ded596"}}}}
+21 -9
View File
@@ -1,13 +1,25 @@
# 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 <https://www.gnu.org/licenses/>.
bricks:
wyatt_clean_code:
git:
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
path: bricks/wyatt_clean_code
wyatt_feature_brick:
git:
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
path: bricks/wyatt_feature_brick
wyatt_package_template:
git:
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
path: bricks/wyatt_package_template
path: bricks/wyatt_package_template
wyatt_component_template:
git:
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
path: bricks/wyatt_component_template
+1
View File
@@ -0,0 +1 @@
2.4.1
+2
View File
@@ -0,0 +1,2 @@
new_version.sh
.latest_version
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 WYATT GROUP
* Copyright (C) 2023 WYATT GROUP
* Please see the AUTHORS file for details.
*
* This program is free software: you can redistribute it and/or modify
+15 -6
View File
@@ -20,10 +20,18 @@
![SDK: Dart & Flutter](https://img.shields.io/badge/SDK-Dart%20%7C%20Flutter-blue?style=flat-square)
This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.0.yaml**.
This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.1.yaml**.
**Note**: This package was heavily inspired by [pedantic](https://github.com/dart-lang/pedantic), [Very Good Analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) and the official [flutter_lints](https://pub.dev/packages/flutter_lints).
## Adding Wyatt Analysis to your project
Using CLI:
```sh
dart pub add wyatt_analysis:2.4.1 --dev --hosted-url=https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
```
## Usage
To use the lints, add a dependency in your `pubspec.yaml` :
@@ -31,7 +39,7 @@ To use the lints, add a dependency in your `pubspec.yaml` :
```yaml
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: 2.4.0
version: 2.4.1
```
Then, add an include in `analysis_options.yaml` :
@@ -49,13 +57,13 @@ include: package:wyatt_analysis/analysis_options.flutter.yaml
If you wish to restrict the lint version, specify a version of `analysis_options.yaml` instead:
```yaml
include: package:wyatt_analysis/analysis_options.flutter.2.4.0.yaml
include: package:wyatt_analysis/analysis_options.flutter.2.4.1.yaml
```
If you just want **Dart** version:
```yaml
include: package:wyatt_analysis/analysis_options.2.4.0.yaml
include: package:wyatt_analysis/analysis_options.2.4.1.yaml
```
## Suppressing Lints
@@ -109,10 +117,11 @@ To indicate your project is using `wyatt_analysis` → [![style: wyatt analysis]
When you want to create a new version of the plugin. Before any modification, execute the following command to create new files:
```sh
./new_version.sh <previous_version> <new_version>
./new_version.sh <new_version>
```
> Where `<previous_version>` is 2.4.0
The previous version is automatically detected thanks to the `.latest_version` file.
So `.latest_version` needs to be versioned!
## Notes
@@ -0,0 +1,217 @@
# 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 <https://www.gnu.org/licenses/>.
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
todo: ignore
close_sinks: ignore
missing_required_param: error
missing_return: error
exclude:
- lib/l10n/**
- lib/generated/**
- lib/gen/**
- lib/generated_plugin_registrant.dart
- test/.test_coverage.dart
- "**/*.g.dart"
- "**/*.freezed.dart"
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_use_package_imports
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_multiple_declarations_per_line
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
- avoid_types_on_closure_parameters
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- cast_nullable_to_non_nullable
- collection_methods_unrelated_type
- combinators_ordering
- comment_references
- conditional_uri_does_not_exist
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- implicit_call_tearoffs
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_runtimeType_toString
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
- prefer_null_aware_method_calls
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- recursive_getters
- require_trailing_commas
- slash_for_doc_comments
- sort_constructors_first
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- unsafe_html
- use_enums
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_string_in_part_of_directives
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
@@ -0,0 +1,32 @@
# 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 <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.2.4.1.yaml
linter:
rules:
- avoid_print
- avoid_unnecessary_containers
- avoid_web_libraries_in_flutter
- no_logic_in_create_state
- sized_box_for_whitespace
- sized_box_shrink_expand
- sort_child_properties_last
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_full_hex_values_for_flutter_colors
- use_key_in_widget_constructors
@@ -14,5 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.flutter.2.4.0.yaml
include: package:wyatt_analysis/analysis_options.flutter.2.4.1.yaml
@@ -14,5 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.2.4.0.yaml
include: package:wyatt_analysis/analysis_options.2.4.1.yaml
@@ -18,4 +18,4 @@
/// used internally at [Wyatt Studio](https://wyatt-studio.fr).
library wyatt_analysis;
const String wyattAnalysisVersion = '2.4.0';
const String wyattAnalysisVersion = '2.4.1';
+21 -12
View File
@@ -18,20 +18,12 @@
usage="
usage:
$(basename "$0") <previous_version> <new_version> -- create new analyzer files.
$(basename "$0") <new_version> -- create new analyzer files.
where:
previous_version: last version, for example \`2.3.0\`
new_version: new version, for example \`2.4.0\`"
old=$1
new=$2
if [ -z "$old" ]; then
echo "previous_version cannot be null"
echo "${usage}"
exit 1
fi
new=$1
if [ -z "$new" ]; then
echo "new_version cannot be null"
@@ -43,6 +35,19 @@ SCRIPT_PATH="${BASH_SOURCE:-$0}"
ABS_SCRIPT_PATH="$(realpath "${SCRIPT_PATH}")"
ABS_DIRECTORY="$(dirname "${ABS_SCRIPT_PATH}")"
LATEST_VERSION="${ABS_DIRECTORY}/.latest_version"
# Read latest version
if [ -e "$LATEST_VERSION" ]; then
old=$(cat "$LATEST_VERSION")
echo "> latest package version is: $old"
echo "> new package version is: $new"
else
echo "latest version is not set"
echo "create a file named \`.latest_version\` in the root of the project"
exit 1
fi
LIB="${ABS_DIRECTORY}/lib/wyatt_analysis.dart"
OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.yaml"
OLD_OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.${old}.yaml"
@@ -52,6 +57,7 @@ OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.yaml"
OLD_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${old}.yaml"
NEW_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${new}.yaml"
if [ ! -e "$OLD_OPTIONS" ]; then
echo "analysis_options.${old}.yaml doesn't exists"
echo "${usage}"
@@ -91,7 +97,7 @@ sed -e "s/${old}/${new}/g" "README.md" > tempfile.tmp
mv -f tempfile.tmp "README.md"
echo "
# Copyright (C) 2022 WYATT GROUP
# Copyright (C) 2023 WYATT GROUP
# Please see the AUTHORS file for details.
#
# This program is free software: you can redistribute it and/or modify
@@ -111,7 +117,7 @@ include: package:wyatt_analysis/analysis_options.${new}.yaml
" > "${OPTIONS}"
echo "
# Copyright (C) 2022 WYATT GROUP
# Copyright (C) 2023 WYATT GROUP
# Please see the AUTHORS file for details.
#
# This program is free software: you can redistribute it and/or modify
@@ -130,4 +136,7 @@ echo "
include: package:wyatt_analysis/analysis_options.flutter.${new}.yaml
" > "${OPTIONS_FLUTTER}"
# Update latest version
echo "${new}" > "$LATEST_VERSION"
exit 0
+4 -4
View File
@@ -1,16 +1,16 @@
# 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 <https://www.gnu.org/licenses/>.
@@ -22,4 +22,4 @@ version: 2.4.0
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"
@@ -1,14 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
part 'custom_app_bar.g.dart';
@ComponentCopyWithExtension()
class CustomAppBar extends AppBarComponent with $CustomAppBarCWMixin {
class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin {
const CustomAppBar({super.title});
@override
Widget build(BuildContext context) => AppBar(
title: Text(title ?? 'Title'),
title: Text(title?.data ?? 'Title'),
);
}
@@ -6,22 +6,85 @@ part of 'custom_app_bar.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy {
class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
const $CustomAppBarCWProxyImpl(this._value);
final CustomAppBar _value;
@override
CustomAppBar title(String? title) => this(title: title);
CustomAppBar title(TextWrapper? title) => this(title: title);
@override
CustomAppBar centerTitle(bool? centerTitle) => this(centerTitle: centerTitle);
@override
CustomAppBar shape(ShapeBorder? shape) => this(shape: shape);
@override
CustomAppBar systemOverlayStyle(SystemUiOverlayStyle? systemOverlayStyle) =>
this(systemOverlayStyle: systemOverlayStyle);
@override
CustomAppBar automaticallyImplyLeading(bool? automaticallyImplyLeading) =>
this(automaticallyImplyLeading: automaticallyImplyLeading);
@override
CustomAppBar flexibleSpace(Widget? flexibleSpace) =>
this(flexibleSpace: flexibleSpace);
@override
CustomAppBar bottom(PreferredSizeWidget? bottom) => this(bottom: bottom);
@override
CustomAppBar elevation(double? elevation) => this(elevation: elevation);
@override
CustomAppBar scrolledUnderElevation(double? scrolledUnderElevation) =>
this(scrolledUnderElevation: scrolledUnderElevation);
@override
CustomAppBar shadowColor(Color? shadowColor) =>
this(shadowColor: shadowColor);
@override
CustomAppBar surfaceTintColor(Color? surfaceTintColor) =>
this(surfaceTintColor: surfaceTintColor);
@override
CustomAppBar backgroundColor(MultiColor? backgroundColor) =>
this(backgroundColor: backgroundColor);
@override
CustomAppBar iconTheme(IconThemeData? iconTheme) =>
this(iconTheme: iconTheme);
@override
CustomAppBar primary(bool? primary) => this(primary: primary);
@override
CustomAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) =>
this(excludeHeaderSemantics: excludeHeaderSemantics);
@override
CustomAppBar toolbarHeight(double? toolbarHeight) =>
this(toolbarHeight: toolbarHeight);
@override
CustomAppBar leadingWidth(double? leadingWidth) =>
this(leadingWidth: leadingWidth);
@override
CustomAppBar leading(Widget? leading) => this(leading: leading);
@override
CustomAppBar actions(List<Widget>? actions) => this(actions: actions);
@override
CustomAppBar expandedWidget(List<Widget>? expandedWidget) =>
this(expandedWidget: expandedWidget);
@override
CustomAppBar key(Key? key) => this(key: key);
@override
CustomAppBar call({
String? title,
TextWrapper? title,
bool? centerTitle,
ShapeBorder? shape,
SystemUiOverlayStyle? systemOverlayStyle,
bool? automaticallyImplyLeading,
Widget? flexibleSpace,
PreferredSizeWidget? bottom,
double? elevation,
double? scrolledUnderElevation,
Color? shadowColor,
Color? surfaceTintColor,
MultiColor? backgroundColor,
IconThemeData? iconTheme,
bool? primary,
bool? excludeHeaderSemantics,
double? toolbarHeight,
double? leadingWidth,
Widget? leading,
List<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomAppBar(
@@ -30,6 +93,6 @@ class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy {
}
mixin $CustomAppBarCWMixin on Component {
$AppBarComponentCWProxy get copyWith =>
$TopAppBarComponentCWProxy get copyWith =>
$CustomAppBarCWProxyImpl(this as CustomAppBar);
}
@@ -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?.data ?? 'Error')),
);
}
@@ -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(
@@ -23,7 +23,7 @@ import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
mixin CrudMixin<Cubit extends bloc_base.Cubit,
SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorWidget?.copyWith(error: state.message) ??
context.components.errorWidget?.copyWith(error: state.message.wrap()) ??
const SizedBox.shrink();
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
@@ -1,36 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_app_bar_example.dart';
// **************************************************************************
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomAppBarExampleCWProxyImpl implements $AppBarComponentCWProxy {
const $CustomAppBarExampleCWProxyImpl(this._value);
final CustomAppBarExample _value;
@override
CustomAppBarExample title(String? title) => this(title: title);
@override
CustomAppBarExample leading(Widget? leading) => this(leading: leading);
@override
CustomAppBarExample actions(List<Widget>? actions) => this(actions: actions);
@override
CustomAppBarExample key(Key? key) => this(key: key);
@override
CustomAppBarExample call({
String? title,
Widget? leading,
List<Widget>? actions,
Key? key,
}) =>
CustomAppBarExample(
title: title ?? _value.title,
key: key ?? _value.key,
);
}
mixin $CustomAppBarExampleCWMixin on Component {
$AppBarComponentCWProxy get copyWith =>
$CustomAppBarExampleCWProxyImpl(this as CustomAppBarExample);
}
@@ -15,18 +15,19 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'custom_app_bar_example.g.dart';
part 'custom_top_bar_example.g.dart';
@ComponentCopyWithExtension()
class CustomAppBarExample extends AppBarComponent
with $CustomAppBarExampleCWMixin {
const CustomAppBarExample({super.title, super.key});
class CustomTopAppBarExample extends TopAppBarComponent
with $CustomTopAppBarExampleCWMixin {
const CustomTopAppBarExample({super.title, super.key});
@override
Widget build(BuildContext context) => AppBar(
title: Text(super.title ?? ''),
title: Text(super.title?.data ?? ''),
);
}
@@ -0,0 +1,106 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_top_bar_example.dart';
// **************************************************************************
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomTopAppBarExampleCWProxyImpl implements $TopAppBarComponentCWProxy {
const $CustomTopAppBarExampleCWProxyImpl(this._value);
final CustomTopAppBarExample _value;
@override
CustomTopAppBarExample title(TextWrapper? title) => this(title: title);
@override
CustomTopAppBarExample centerTitle(bool? centerTitle) =>
this(centerTitle: centerTitle);
@override
CustomTopAppBarExample shape(ShapeBorder? shape) => this(shape: shape);
@override
CustomTopAppBarExample systemOverlayStyle(
SystemUiOverlayStyle? systemOverlayStyle) =>
this(systemOverlayStyle: systemOverlayStyle);
@override
CustomTopAppBarExample automaticallyImplyLeading(
bool? automaticallyImplyLeading) =>
this(automaticallyImplyLeading: automaticallyImplyLeading);
@override
CustomTopAppBarExample flexibleSpace(Widget? flexibleSpace) =>
this(flexibleSpace: flexibleSpace);
@override
CustomTopAppBarExample bottom(PreferredSizeWidget? bottom) =>
this(bottom: bottom);
@override
CustomTopAppBarExample elevation(double? elevation) =>
this(elevation: elevation);
@override
CustomTopAppBarExample scrolledUnderElevation(
double? scrolledUnderElevation) =>
this(scrolledUnderElevation: scrolledUnderElevation);
@override
CustomTopAppBarExample shadowColor(Color? shadowColor) =>
this(shadowColor: shadowColor);
@override
CustomTopAppBarExample surfaceTintColor(Color? surfaceTintColor) =>
this(surfaceTintColor: surfaceTintColor);
@override
CustomTopAppBarExample backgroundColor(MultiColor? backgroundColor) =>
this(backgroundColor: backgroundColor);
@override
CustomTopAppBarExample iconTheme(IconThemeData? iconTheme) =>
this(iconTheme: iconTheme);
@override
CustomTopAppBarExample primary(bool? primary) => this(primary: primary);
@override
CustomTopAppBarExample excludeHeaderSemantics(bool? excludeHeaderSemantics) =>
this(excludeHeaderSemantics: excludeHeaderSemantics);
@override
CustomTopAppBarExample toolbarHeight(double? toolbarHeight) =>
this(toolbarHeight: toolbarHeight);
@override
CustomTopAppBarExample leadingWidth(double? leadingWidth) =>
this(leadingWidth: leadingWidth);
@override
CustomTopAppBarExample leading(Widget? leading) => this(leading: leading);
@override
CustomTopAppBarExample actions(List<Widget>? actions) =>
this(actions: actions);
@override
CustomTopAppBarExample expandedWidget(List<Widget>? expandedWidget) =>
this(expandedWidget: expandedWidget);
@override
CustomTopAppBarExample key(Key? key) => this(key: key);
@override
CustomTopAppBarExample call({
TextWrapper? title,
bool? centerTitle,
ShapeBorder? shape,
SystemUiOverlayStyle? systemOverlayStyle,
bool? automaticallyImplyLeading,
Widget? flexibleSpace,
PreferredSizeWidget? bottom,
double? elevation,
double? scrolledUnderElevation,
Color? shadowColor,
Color? surfaceTintColor,
MultiColor? backgroundColor,
IconThemeData? iconTheme,
bool? primary,
bool? excludeHeaderSemantics,
double? toolbarHeight,
double? leadingWidth,
Widget? leading,
List<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomTopAppBarExample(
title: title ?? _value.title,
key: key ?? _value.key,
);
}
mixin $CustomTopAppBarExampleCWMixin on Component {
$TopAppBarComponentCWProxy get copyWith =>
$CustomTopAppBarExampleCWProxyImpl(this as CustomTopAppBarExample);
}
@@ -14,4 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml
include: package:wyatt_analysis/analysis_options.flutter.yaml
+9
View File
@@ -0,0 +1,9 @@
targets:
$default:
builders:
# Typically the builder key is just the package name, run `pub run build_runner doctor` to check your config.
wyatt_component_copy_with_gen:component_copy_with_gen:
generate_for:
# Example glob for only the Dart files under `lib/models`
- lib/**/*.dart
- example/lib/**/*.dart
@@ -5,11 +5,13 @@ import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'custom_app_bar.g.dart';
@ComponentCopyWithExtension()
class CustomAppBar extends AppBarComponent with $CustomAppBarCWMixin {
class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin {
const CustomAppBar({super.title, super.key});
@override
Widget build(BuildContext context) => AppBar(
title: Text(super.title ?? ''),
title: Text(
super.title?.data ?? '',
),
);
}
@@ -6,22 +6,85 @@ part of 'custom_app_bar.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy {
class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
const $CustomAppBarCWProxyImpl(this._value);
final CustomAppBar _value;
@override
CustomAppBar title(String? title) => this(title: title);
CustomAppBar title(TextWrapper? title) => this(title: title);
@override
CustomAppBar centerTitle(bool? centerTitle) => this(centerTitle: centerTitle);
@override
CustomAppBar shape(ShapeBorder? shape) => this(shape: shape);
@override
CustomAppBar systemOverlayStyle(SystemUiOverlayStyle? systemOverlayStyle) =>
this(systemOverlayStyle: systemOverlayStyle);
@override
CustomAppBar automaticallyImplyLeading(bool? automaticallyImplyLeading) =>
this(automaticallyImplyLeading: automaticallyImplyLeading);
@override
CustomAppBar flexibleSpace(Widget? flexibleSpace) =>
this(flexibleSpace: flexibleSpace);
@override
CustomAppBar bottom(PreferredSizeWidget? bottom) => this(bottom: bottom);
@override
CustomAppBar elevation(double? elevation) => this(elevation: elevation);
@override
CustomAppBar scrolledUnderElevation(double? scrolledUnderElevation) =>
this(scrolledUnderElevation: scrolledUnderElevation);
@override
CustomAppBar shadowColor(Color? shadowColor) =>
this(shadowColor: shadowColor);
@override
CustomAppBar surfaceTintColor(Color? surfaceTintColor) =>
this(surfaceTintColor: surfaceTintColor);
@override
CustomAppBar backgroundColor(MultiColor? backgroundColor) =>
this(backgroundColor: backgroundColor);
@override
CustomAppBar iconTheme(IconThemeData? iconTheme) =>
this(iconTheme: iconTheme);
@override
CustomAppBar primary(bool? primary) => this(primary: primary);
@override
CustomAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) =>
this(excludeHeaderSemantics: excludeHeaderSemantics);
@override
CustomAppBar toolbarHeight(double? toolbarHeight) =>
this(toolbarHeight: toolbarHeight);
@override
CustomAppBar leadingWidth(double? leadingWidth) =>
this(leadingWidth: leadingWidth);
@override
CustomAppBar leading(Widget? leading) => this(leading: leading);
@override
CustomAppBar actions(List<Widget>? actions) => this(actions: actions);
@override
CustomAppBar expandedWidget(List<Widget>? expandedWidget) =>
this(expandedWidget: expandedWidget);
@override
CustomAppBar key(Key? key) => this(key: key);
@override
CustomAppBar call({
String? title,
TextWrapper? title,
bool? centerTitle,
ShapeBorder? shape,
SystemUiOverlayStyle? systemOverlayStyle,
bool? automaticallyImplyLeading,
Widget? flexibleSpace,
PreferredSizeWidget? bottom,
double? elevation,
double? scrolledUnderElevation,
Color? shadowColor,
Color? surfaceTintColor,
MultiColor? backgroundColor,
IconThemeData? iconTheme,
bool? primary,
bool? excludeHeaderSemantics,
double? toolbarHeight,
double? leadingWidth,
Widget? leading,
List<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomAppBar(
@@ -31,6 +94,6 @@ class $CustomAppBarCWProxyImpl implements $AppBarComponentCWProxy {
}
mixin $CustomAppBarCWMixin on Component {
$AppBarComponentCWProxy get copyWith =>
$TopAppBarComponentCWProxy get copyWith =>
$CustomAppBarCWProxyImpl(this as CustomAppBar);
}
@@ -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?.data ?? 'Error')),
);
}
@@ -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(
@@ -27,20 +27,18 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Components Example',
theme: ThemeData(
primarySwatch: Colors.blue,
Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Components Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Scaffold(
body: Home(),
),
),
home: const Scaffold(
body: Home(),
),
),
);
}
);
}
class Home extends StatelessWidget {
@@ -50,14 +48,15 @@ class Home extends StatelessWidget {
Widget build(BuildContext context) => Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: context.components.appBar?.copyWith.title('Example title') ??
child: context.components.appBar?.copyWith
.title('Example title'.wrap()) ??
const SizedBox.shrink(),
),
body: Column(
children: [
Expanded(
child: context.components.errorWidget
?.copyWith(error: 'Example erreur') ??
?.copyWith(error: 'Example erreur'.wrap()) ??
const SizedBox.shrink(),
),
const SizedBox(
@@ -14,4 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'enums/enums.dart';
export 'extensions/build_context_extensions.dart';
export 'extensions/string_extension.dart';
export 'mixins/copy_with_mixin.dart';
export 'utils/utils.dart';
@@ -0,0 +1,39 @@
// 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 <https://www.gnu.org/licenses/>.
/// Defines standard UI control states
enum ControlState {
/// When the control is disabled and un-clickable
disabled,
/// Default state of a control
normal,
/// When the mouse cursor is hover the control
hovered,
/// When the control is clicked
tapped,
/// When the control is focused (like pressing tab)
focused;
bool isDisabled() => this == ControlState.disabled;
bool isEnabled() => this != ControlState.disabled;
bool isHovered() => this == ControlState.hovered;
bool isTapped() => this == ControlState.tapped;
bool isFocused() => this == ControlState.focused;
}
@@ -0,0 +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 <https://www.gnu.org/licenses/>.
export './control_state.dart';
export './extra_state.dart';
export './status_state.dart';
@@ -0,0 +1,35 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
/// Defines extra UI control states that can
/// be combined with [ControlState]
enum ExtraState {
/// When the control is selected
selected,
/// When the control is invalid
invalid,
/// When the control is freezed
/// Useful to prevent user from changing the control state
freezed;
bool isSelected() => this == ExtraState.selected;
bool isInvalid() => this == ExtraState.invalid;
bool isFreezed() => this == ExtraState.freezed;
}
@@ -0,0 +1,22 @@
// 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 <https://www.gnu.org/licenses/>.
enum StatusState {
initial,
success,
loading,
error;
}
@@ -0,0 +1,25 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
extension StringExtension on String? {
TextWrapper? wrap({TextStyle? style, MultiColor? gradientColors}) =>
this != null
? TextWrapper(this!, style: style, gradientColors: gradientColors)
: null;
}
@@ -0,0 +1,82 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
class MultiColor {
const MultiColor(this._colors) : _color = null;
const MultiColor.single(this._color) : _colors = null;
final List<Color>? _colors;
final Color? _color;
Color get color => _color != null
? _color!
: _colors?.isNotEmpty ?? false
? _colors!.first
: throw IndexError.withLength(
0,
_colors?.length ?? 0,
message: '_color is not defined or _colors is empty.',
);
List<Color> get colors => _colors ?? [];
bool get isGradient => (_colors?.length ?? 0) > 1;
bool get isColor => _color != null || isGradient;
static MultiColor? lerp(MultiColor? a, MultiColor? b, double t) {
if (a == null && b == null) {
return null;
} else if (a == null) {
return b;
} else if (b == null) {
return a;
}
if (a.isColor && b.isColor) {
return MultiColor.single(Color.lerp(a.color, b.color, t));
} else if (a.isColor && b.isGradient) {
return MultiColor(
b.colors
.map((e) => Color.lerp(a.color, e, t))
.whereType<Color>()
.toList(),
);
} else if (a.isGradient && b.isColor) {
return MultiColor(
a.colors
.map((e) => Color.lerp(b.color, e, t))
.whereType<Color>()
.toList(),
);
} else if (a.isGradient && b.isGradient) {
final colors = List<Color>.empty(growable: true);
final shortestList =
(a.colors.length > b.colors.length) ? b.colors : a.colors;
for (int i = 0; i < shortestList.length; i++) {
final lerpColor = Color.lerp(a.colors[i], b.colors[i], t);
if (lerpColor != null) {
colors.add(lerpColor);
}
}
return MultiColor(colors);
}
return b;
}
@override
String toString() => 'MultiColor(_colors: $_colors, _color: $_color)';
}
@@ -0,0 +1,107 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
/// Wraps [String] and [TextStyle] into one object that can be
/// a [Text] or a [RichText].
class TextWrapper {
const TextWrapper(
this.data, {
this.style,
this.gradientColors,
this.textAlign,
this.textDirection,
this.softWrap,
this.overflow,
this.maxLines,
this.selectionColor,
});
const TextWrapper.text(this.data)
: style = null,
gradientColors = null,
textAlign = null,
textDirection = null,
softWrap = null,
overflow = null,
maxLines = null,
selectionColor = null;
/// Text to be displayed
final String data;
/// Style of the text
final TextStyle? style;
/// Colors of the gradient, if any
final MultiColor? gradientColors;
/// How the text should be aligned horizontally.
final TextAlign? textAlign;
/// The directionality of the text.
///
/// This decides how [textAlign] values like [TextAlign.start] and
/// [TextAlign.end] are interpreted.
///
/// This is also used to disambiguate how to render bidirectional text. For
/// example, if the [data] is an English phrase followed by a Hebrew phrase,
/// in a [TextDirection.ltr] context the English phrase will be on the left
/// and the Hebrew phrase to its right, while in a [TextDirection.rtl]
/// context, the English phrase will be on the right and the Hebrew phrase on
/// its left.
///
/// Defaults to the ambient [Directionality], if any.
final TextDirection? textDirection;
/// Whether the text should break at soft line breaks.
///
/// If false, the glyphs in the text will be positioned as if there was
/// unlimited horizontal space.
final bool? softWrap;
/// How visual overflow should be handled.
///
/// If this is null [TextStyle.overflow] will be used, otherwise the value
/// from the nearest [DefaultTextStyle] ancestor will be used.
final TextOverflow? overflow;
/// An optional maximum number of lines for the text to span, wrapping if
/// necessary.
/// If the text exceeds the given number of lines, it will be truncated
/// according to [overflow].
///
/// If this is 1, text will not wrap. Otherwise, text will be wrapped at the
/// edge of the box.
///
/// If this is null, but there is an ambient [DefaultTextStyle] that specifies
/// an explicit number for its [DefaultTextStyle.maxLines], then the
/// [DefaultTextStyle] value will take precedence. You can use a [RichText]
/// widget directly to entirely override the [DefaultTextStyle].
final int? maxLines;
/// The color to use when painting the selection.
///
/// This is ignored if [SelectionContainer.maybeOf] returns null
/// in the [BuildContext] of the [Text] widget.
///
/// If null, the ambient [DefaultSelectionStyle] is used (if any); failing
/// that, the selection color defaults to [DefaultSelectionStyle.defaultColor]
/// (semi-transparent grey).
final Color? selectionColor;
}
@@ -0,0 +1,49 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// super 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.
//
// super 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 super program. If not, see <https://www.gnu.org/licenses/>.
/// A helper class for getting theme elements.
abstract class ThemeHelper {
/// Gets a theme element from a list of styles.
/// Styles are checked in order, and the first one that passes the
/// [valueValidator] is returned.
/// Style elements are transformed using the [transform] function.
///
/// [styles]: A list of styles that need to be checked.
/// [transform]: A function that transforms each style element
/// to a [T] type.
/// [valueValidator]: An optional validation function that
/// determines if a style element is valid.
/// [combine]: A function that combines two [P] type objects to create
/// a new object.
static T? getThemeElement<P, T>(
List<P?>? styles, {
required T? Function(P?)? transform,
bool? Function(P?)? valueValidator,
P? Function(P?, P?)? combine,
}) {
final Iterable<P?>? validStyles = styles?.where(
(element) => valueValidator?.call(element) ?? (element != null),
);
return (validStyles?.isNotEmpty ?? false)
? transform?.call(
validStyles?.reduce(
(value, element) => combine?.call(value, element) ?? value,
),
)
: null;
}
}
@@ -0,0 +1,72 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/src/core/utils/theme_helper.dart';
import 'package:wyatt_ui_components/src/domain/entities/theme_style.dart';
/// {@template theme_resolver}
/// In charge of theme negotiation and merge.
///
/// When you build a component `Component({double? radius})`.
/// You have several possibilities:
/// 1) Pass the "radius" into the constructor, `Component(radius: 12)`.
/// 2) Set up a theme extension `ComponentThemeExtension(radius: 15)`.
/// 3) Let `wyatt_ui_kit` "negotiate" and try to find a suitable style in the
/// flutter theme.
///
/// If this negotiation phase fails, then:
/// - If the value is mandatory: a hardcoded value in "wyatt_ui_kit" is chosen.
/// - If not, the style is simply not applied.
/// {@endtemplate}
abstract class ThemeResolver<S extends ThemeStyle<S>, T, E> {
/// {@macro theme_resolver}
const ThemeResolver();
S? Function(BuildContext context, {E? extra}) get customStyleFn;
/// Compute default value from Flutter Theme or with hardcoded values.
S computeDefaultValue(
BuildContext context, {
E? extra,
});
/// Compute extension value from custom component extension.
S? computeExtensionValueFn(
BuildContext context,
T? themeExtension, {
E? extra,
});
/// Choose most suitable style for a given context.
S negotiate(BuildContext context, {E? extra}) {
final style = computeDefaultValue(context, extra: extra);
return ThemeHelper.getThemeElement<S, S>(
[
style,
computeExtensionValueFn(
context,
Theme.of(context).extension<T>(),
extra: extra,
),
customStyleFn(context, extra: extra)
],
transform: (value) => value,
combine: (value, element) => value?.mergeWith(element),
) ??
style;
}
}
@@ -0,0 +1,20 @@
// 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 <https://www.gnu.org/licenses/>.
export 'multi_color.dart';
export 'text_wrapper.dart';
export 'theme_helper.dart';
export 'theme_resolver.dart';
@@ -1,20 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'app_bar_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $AppBarComponentCWProxy {
AppBarComponent title(String? title);
AppBarComponent leading(Widget? leading);
AppBarComponent actions(List<Widget>? actions);
AppBarComponent key(Key? key);
AppBarComponent call({
String? title,
Widget? leading,
List<Widget>? actions,
Key? key,
});
}
@@ -0,0 +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 <https://www.gnu.org/licenses/>.
export './bottom_navigation_bar_component.dart';
export './top_navigation_bar_component.dart';
export 'top_app_bar_component.dart';
@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
@@ -15,20 +14,21 @@ import 'package:flutter/material.dart';
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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 '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;
}
@@ -0,0 +1,53 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// super 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.
//
// super 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 super program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/src/domain/entities/bars/top_bar_component.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'top_app_bar_component.g.dart';
@ComponentProxyExtension()
abstract class TopAppBarComponent extends TopBarComponent
with CopyWithMixin<$TopAppBarComponentCWProxy> {
const TopAppBarComponent({
this.title,
this.centerTitle,
super.shape,
super.systemOverlayStyle,
super.automaticallyImplyLeading,
super.flexibleSpace,
super.bottom,
super.elevation,
super.scrolledUnderElevation,
super.shadowColor,
super.surfaceTintColor,
super.backgroundColor,
super.iconTheme,
super.primary,
super.excludeHeaderSemantics,
super.toolbarHeight,
super.leadingWidth,
super.leading,
super.actions,
super.expandedWidget,
super.key,
});
final TextWrapper? title;
final bool? centerTitle;
}
@@ -0,0 +1,55 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'top_app_bar_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $TopAppBarComponentCWProxy {
TopAppBarComponent title(TextWrapper? title);
TopAppBarComponent centerTitle(bool? centerTitle);
TopAppBarComponent shape(ShapeBorder? shape);
TopAppBarComponent systemOverlayStyle(
SystemUiOverlayStyle? systemOverlayStyle);
TopAppBarComponent automaticallyImplyLeading(bool? automaticallyImplyLeading);
TopAppBarComponent flexibleSpace(Widget? flexibleSpace);
TopAppBarComponent bottom(PreferredSizeWidget? bottom);
TopAppBarComponent elevation(double? elevation);
TopAppBarComponent scrolledUnderElevation(double? scrolledUnderElevation);
TopAppBarComponent shadowColor(Color? shadowColor);
TopAppBarComponent surfaceTintColor(Color? surfaceTintColor);
TopAppBarComponent backgroundColor(MultiColor? backgroundColor);
TopAppBarComponent iconTheme(IconThemeData? iconTheme);
TopAppBarComponent primary(bool? primary);
TopAppBarComponent excludeHeaderSemantics(bool? excludeHeaderSemantics);
TopAppBarComponent toolbarHeight(double? toolbarHeight);
TopAppBarComponent leadingWidth(double? leadingWidth);
TopAppBarComponent leading(Widget? leading);
TopAppBarComponent actions(List<Widget>? actions);
TopAppBarComponent expandedWidget(List<Widget>? expandedWidget);
TopAppBarComponent key(Key? key);
TopAppBarComponent call({
TextWrapper? title,
bool? centerTitle,
ShapeBorder? shape,
SystemUiOverlayStyle? systemOverlayStyle,
bool? automaticallyImplyLeading,
Widget? flexibleSpace,
PreferredSizeWidget? bottom,
double? elevation,
double? scrolledUnderElevation,
Color? shadowColor,
Color? surfaceTintColor,
MultiColor? backgroundColor,
IconThemeData? iconTheme,
bool? primary,
bool? excludeHeaderSemantics,
double? toolbarHeight,
double? leadingWidth,
Widget? leading,
List<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
});
}
@@ -0,0 +1,62 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
abstract class TopBarComponent extends Component {
const TopBarComponent({
this.leading,
this.actions,
this.automaticallyImplyLeading,
this.flexibleSpace,
this.bottom,
this.elevation,
this.scrolledUnderElevation,
this.shadowColor,
this.surfaceTintColor,
this.backgroundColor,
this.iconTheme,
this.primary,
this.excludeHeaderSemantics,
this.toolbarHeight,
this.leadingWidth,
this.systemOverlayStyle,
this.shape,
this.expandedWidget,
super.key,
});
final Widget? leading;
final List<Widget>? actions;
final bool? automaticallyImplyLeading;
final Widget? flexibleSpace;
final PreferredSizeWidget? bottom;
final double? elevation;
final double? scrolledUnderElevation;
final Color? shadowColor;
final Color? surfaceTintColor;
final MultiColor? backgroundColor;
final IconThemeData? iconTheme;
final bool? primary;
final bool? excludeHeaderSemantics;
final double? toolbarHeight;
final double? leadingWidth;
final SystemUiOverlayStyle? systemOverlayStyle;
final ShapeBorder? shape;
final List<Widget>? expandedWidget;
}
@@ -0,0 +1,56 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/src/domain/entities/bars/top_bar_component.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'top_navigation_bar_component.g.dart';
@ComponentProxyExtension()
abstract class TopNavigationBarComponent extends TopBarComponent
with CopyWithMixin<$TopNavigationBarComponentCWProxy> {
const TopNavigationBarComponent({
this.navigationItems,
this.onTap,
this.currentIndex = 0,
super.shape,
super.systemOverlayStyle,
super.automaticallyImplyLeading,
super.flexibleSpace,
super.bottom,
super.elevation,
super.scrolledUnderElevation,
super.shadowColor,
super.surfaceTintColor,
super.backgroundColor,
super.iconTheme,
super.primary,
super.excludeHeaderSemantics,
super.toolbarHeight,
super.leadingWidth,
super.leading,
super.actions,
super.expandedWidget,
super.key,
});
final List<TextWrapper>? navigationItems;
final int currentIndex;
final void Function(BuildContext, int)? onTap;
}
@@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'top_navigation_bar_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $TopNavigationBarComponentCWProxy {
TopNavigationBarComponent navigationItems(List<TextWrapper>? navigationItems);
TopNavigationBarComponent onTap(void Function(BuildContext, int)? onTap);
TopNavigationBarComponent currentIndex(int? currentIndex);
TopNavigationBarComponent shape(ShapeBorder? shape);
TopNavigationBarComponent systemOverlayStyle(
SystemUiOverlayStyle? systemOverlayStyle);
TopNavigationBarComponent automaticallyImplyLeading(
bool? automaticallyImplyLeading);
TopNavigationBarComponent flexibleSpace(Widget? flexibleSpace);
TopNavigationBarComponent bottom(PreferredSizeWidget? bottom);
TopNavigationBarComponent elevation(double? elevation);
TopNavigationBarComponent scrolledUnderElevation(
double? scrolledUnderElevation);
TopNavigationBarComponent shadowColor(Color? shadowColor);
TopNavigationBarComponent surfaceTintColor(Color? surfaceTintColor);
TopNavigationBarComponent backgroundColor(MultiColor? backgroundColor);
TopNavigationBarComponent iconTheme(IconThemeData? iconTheme);
TopNavigationBarComponent primary(bool? primary);
TopNavigationBarComponent excludeHeaderSemantics(
bool? excludeHeaderSemantics);
TopNavigationBarComponent toolbarHeight(double? toolbarHeight);
TopNavigationBarComponent leadingWidth(double? leadingWidth);
TopNavigationBarComponent leading(Widget? leading);
TopNavigationBarComponent actions(List<Widget>? actions);
TopNavigationBarComponent expandedWidget(List<Widget>? expandedWidget);
TopNavigationBarComponent key(Key? key);
TopNavigationBarComponent call({
List<TextWrapper>? navigationItems,
void Function(BuildContext, int)? onTap,
int? currentIndex,
ShapeBorder? shape,
SystemUiOverlayStyle? systemOverlayStyle,
bool? automaticallyImplyLeading,
Widget? flexibleSpace,
PreferredSizeWidget? bottom,
double? elevation,
double? scrolledUnderElevation,
Color? shadowColor,
Color? surfaceTintColor,
MultiColor? backgroundColor,
IconThemeData? iconTheme,
bool? primary,
bool? excludeHeaderSemantics,
double? toolbarHeight,
double? leadingWidth,
Widget? leading,
List<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
});
}
@@ -0,0 +1,64 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/foundation.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
abstract class ButtonComponent extends Component {
const ButtonComponent({
this.disabledStyle,
this.normalStyle,
this.hoveredStyle,
this.focusedStyle,
this.tappedStyle,
this.selectedStyle,
this.invalidStyle,
this.onPressed,
this.disabled,
super.themeResolver,
super.key,
});
/// Style of this button in disabled state
final ButtonStyle<dynamic>? disabledStyle;
/// Style of this button in normal state
final ButtonStyle<dynamic>? normalStyle;
/// Style of this button in hovered state
final ButtonStyle<dynamic>? hoveredStyle;
/// Style of this button in focused state
final ButtonStyle<dynamic>? focusedStyle;
/// Style of this button in tapped state
final ButtonStyle<dynamic>? tappedStyle;
/// Style of this button in selected state
final ButtonStyle<dynamic>? selectedStyle;
/// Style of this button in invalid state
final ButtonStyle<dynamic>? invalidStyle;
/// Callback on button press,
///
/// [ControlState] is passed as argument and can be used to determine if the
/// button was pressed in disabled state or not.
final void Function(ControlState state)? onPressed;
/// Current state of this button
final ValueNotifier<bool>? disabled;
}
@@ -0,0 +1,72 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/theme_style.dart';
abstract class ButtonStyle<T> extends ThemeStyle<T> {
const ButtonStyle({
this.radius,
this.padding,
this.foregroundColors,
this.backgroundColors,
this.borderColors,
this.stroke,
this.shadow,
});
/// Button radius
///
/// Default to `BorderRadius.all(Radius.circular(4.0))`
final BorderRadiusGeometry? radius;
/// Padding and gaps of this button
///
/// Default to `ButtonTheme.padding`
final EdgeInsetsGeometry? padding;
/// Button foreground gradient colors (from left to right)
///
/// Default to `Theme.colorScheme.onPrimary`
final MultiColor? foregroundColors;
/// Button background gradient colors (from left to right)
///
/// Default to `Theme.colorScheme.primary`
final MultiColor? backgroundColors;
/// Border colors (from left to right).
///
/// Default to `null`
final MultiColor? borderColors;
/// Stroke of the border
///
/// Default to `null`
final double? stroke;
/// Drop shadow
///
/// Default to `null`
final BoxShadow? shadow;
@override
String toString() =>
'ButtonStyle(radius: $radius, padding: $padding, foregroundColors: '
'$foregroundColors, backgroundColors: $backgroundColors, borderColors: '
'$borderColors, stroke: $stroke, shadow: $shadow)';
}
@@ -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 <https://www.gnu.org/licenses/>.
export './button_component.dart';
export './button_style.dart';
export './file_selection_button_component.dart';
export './file_selection_button_style.dart';
export './flat_button_component.dart';
export './flat_button_style.dart';
export './simple_icon_button_component.dart';
export './simple_icon_button_style.dart';
export './symbol_button_component.dart';
export './symbol_button_style.dart';
@@ -0,0 +1,71 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'file_selection_button_component.g.dart';
@ComponentProxyExtension()
abstract class FileSelectionButtonComponent extends ButtonComponent
with CopyWithMixin<$FileSelectionButtonComponentCWProxy> {
const FileSelectionButtonComponent({
this.mainAxisSize = MainAxisSize.min,
this.leading,
this.title,
this.subTitle,
super.disabledStyle,
super.normalStyle,
super.hoveredStyle,
super.focusedStyle,
super.tappedStyle,
super.selectedStyle,
super.invalidStyle,
super.onPressed,
super.disabled,
super.themeResolver,
super.key,
});
@override
FileSelectionButtonStyle? get disabledStyle;
@override
FileSelectionButtonStyle? get normalStyle;
@override
FileSelectionButtonStyle? get hoveredStyle;
@override
FileSelectionButtonStyle? get focusedStyle;
@override
FileSelectionButtonStyle? get tappedStyle;
// When a file is selected
@override
FileSelectionButtonStyle? get selectedStyle;
// When the input file is invalid (too large, not supported format... etc)
@override
FileSelectionButtonStyle? get invalidStyle;
final MainAxisSize? mainAxisSize;
final Widget? leading;
final TextWrapper? title;
final TextWrapper? subTitle;
}
@@ -0,0 +1,46 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'file_selection_button_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $FileSelectionButtonComponentCWProxy {
FileSelectionButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
FileSelectionButtonComponent leading(Widget? leading);
FileSelectionButtonComponent title(TextWrapper? title);
FileSelectionButtonComponent subTitle(TextWrapper? subTitle);
FileSelectionButtonComponent disabledStyle(
ButtonStyle<dynamic>? disabledStyle);
FileSelectionButtonComponent normalStyle(ButtonStyle<dynamic>? normalStyle);
FileSelectionButtonComponent hoveredStyle(ButtonStyle<dynamic>? hoveredStyle);
FileSelectionButtonComponent focusedStyle(ButtonStyle<dynamic>? focusedStyle);
FileSelectionButtonComponent tappedStyle(ButtonStyle<dynamic>? tappedStyle);
FileSelectionButtonComponent selectedStyle(
ButtonStyle<dynamic>? selectedStyle);
FileSelectionButtonComponent invalidStyle(ButtonStyle<dynamic>? invalidStyle);
FileSelectionButtonComponent onPressed(
void Function(ControlState)? onPressed);
FileSelectionButtonComponent disabled(ValueNotifier<bool>? disabled);
FileSelectionButtonComponent themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver);
FileSelectionButtonComponent key(Key? key);
FileSelectionButtonComponent call({
MainAxisSize? mainAxisSize,
Widget? leading,
TextWrapper? title,
TextWrapper? subTitle,
ButtonStyle<dynamic>? disabledStyle,
ButtonStyle<dynamic>? normalStyle,
ButtonStyle<dynamic>? hoveredStyle,
ButtonStyle<dynamic>? focusedStyle,
ButtonStyle<dynamic>? tappedStyle,
ButtonStyle<dynamic>? selectedStyle,
ButtonStyle<dynamic>? invalidStyle,
void Function(ControlState)? onPressed,
ValueNotifier<bool>? disabled,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
});
}
@@ -0,0 +1,133 @@
// 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 <https://www.gnu.org/licenses/>.
import 'dart:ui';
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
const FileSelectionButtonStyle({
this.title,
this.subTitle,
super.radius,
super.padding,
super.foregroundColors,
super.backgroundColors,
super.borderColors,
super.stroke,
super.shadow,
});
/// Merges non-null `b` attributes in `a`
static FileSelectionButtonStyle? merge(
FileSelectionButtonStyle? a,
FileSelectionButtonStyle? b,
) {
if (b == null) {
return a?.copyWith();
}
if (a == null) {
return b.copyWith();
}
return a.copyWith(
title: b.title,
subTitle: b.subTitle,
radius: b.radius,
padding: b.padding,
foregroundColors: b.foregroundColors,
backgroundColors: b.backgroundColors,
borderColors: b.borderColors,
stroke: b.stroke,
shadow: b.shadow,
);
}
/// Used for interpolation.
static FileSelectionButtonStyle? lerp(
FileSelectionButtonStyle? a,
FileSelectionButtonStyle? b,
double t,
) {
if (a == null || b == null) {
return null;
}
// b.copyWith to return b attributes even if they are not lerped
return b.copyWith(
title: TextStyle.lerp(a.title, b.title, t),
subTitle: TextStyle.lerp(a.title, b.title, t),
foregroundColors: MultiColor.lerp(
a.foregroundColors,
b.foregroundColors,
t,
),
backgroundColors: MultiColor.lerp(
a.backgroundColors,
b.backgroundColors,
t,
),
borderColors: MultiColor.lerp(
a.borderColors,
b.borderColors,
t,
),
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
stroke: lerpDouble(a.stroke, b.stroke, t),
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
);
}
/// Title text style
///
/// Default to `TextTheme.labelLarge`
final TextStyle? title;
/// Sub title text style
///
/// Default to `TextTheme.labelSmall`
final TextStyle? subTitle;
@override
FileSelectionButtonStyle? mergeWith(FileSelectionButtonStyle? other) =>
FileSelectionButtonStyle.merge(this, other);
@override
FileSelectionButtonStyle? copyWith({
TextStyle? title,
TextStyle? subTitle,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
FileSelectionButtonStyle(
title: title ?? this.title,
subTitle: subTitle ?? this.subTitle,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
}
@@ -0,0 +1,61 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'flat_button_component.g.dart';
@ComponentProxyExtension()
abstract class FlatButtonComponent extends ButtonComponent
with CopyWithMixin<$FlatButtonComponentCWProxy> {
const FlatButtonComponent({
this.mainAxisSize,
this.prefix,
this.suffix,
this.label,
super.disabledStyle,
super.normalStyle,
super.hoveredStyle,
super.focusedStyle,
super.tappedStyle,
super.onPressed,
super.disabled,
super.themeResolver,
super.key,
});
@override
FlatButtonStyle? get disabledStyle;
@override
FlatButtonStyle? get normalStyle;
@override
FlatButtonStyle? get hoveredStyle;
@override
FlatButtonStyle? get focusedStyle;
@override
FlatButtonStyle? get tappedStyle;
final MainAxisSize? mainAxisSize;
final Widget? prefix;
final Widget? suffix;
final TextWrapper? label;
}
@@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flat_button_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $FlatButtonComponentCWProxy {
FlatButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
FlatButtonComponent prefix(Widget? prefix);
FlatButtonComponent suffix(Widget? suffix);
FlatButtonComponent label(TextWrapper? label);
FlatButtonComponent disabledStyle(ButtonStyle<dynamic>? disabledStyle);
FlatButtonComponent normalStyle(ButtonStyle<dynamic>? normalStyle);
FlatButtonComponent hoveredStyle(ButtonStyle<dynamic>? hoveredStyle);
FlatButtonComponent focusedStyle(ButtonStyle<dynamic>? focusedStyle);
FlatButtonComponent tappedStyle(ButtonStyle<dynamic>? tappedStyle);
FlatButtonComponent onPressed(void Function(ControlState)? onPressed);
FlatButtonComponent disabled(ValueNotifier<bool>? disabled);
FlatButtonComponent themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver);
FlatButtonComponent key(Key? key);
FlatButtonComponent call({
MainAxisSize? mainAxisSize,
Widget? prefix,
Widget? suffix,
TextWrapper? label,
ButtonStyle<dynamic>? disabledStyle,
ButtonStyle<dynamic>? normalStyle,
ButtonStyle<dynamic>? hoveredStyle,
ButtonStyle<dynamic>? focusedStyle,
ButtonStyle<dynamic>? tappedStyle,
void Function(ControlState)? onPressed,
ValueNotifier<bool>? disabled,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
});
}
@@ -0,0 +1,123 @@
// 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 <https://www.gnu.org/licenses/>.
import 'dart:ui';
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> {
const FlatButtonStyle({
this.label,
super.radius,
super.padding,
super.foregroundColors,
super.backgroundColors,
super.borderColors,
super.stroke,
super.shadow,
});
/// Merges non-null `b` attributes in `a`
static FlatButtonStyle? merge(
FlatButtonStyle? a,
FlatButtonStyle? b,
) {
if (b == null) {
return a?.copyWith();
}
if (a == null) {
return b.copyWith();
}
return a.copyWith(
label: b.label,
radius: b.radius,
padding: b.padding,
foregroundColors: b.foregroundColors,
backgroundColors: b.backgroundColors,
borderColors: b.borderColors,
stroke: b.stroke,
shadow: b.shadow,
);
}
/// Used for interpolation.
static FlatButtonStyle? lerp(
FlatButtonStyle? a,
FlatButtonStyle? b,
double t,
) {
if (a == null || b == null) {
return null;
}
// b.copyWith to return b attributes even if they are not lerped
return b.copyWith(
label: TextStyle.lerp(a.label, b.label, t),
foregroundColors: MultiColor.lerp(
a.foregroundColors,
b.foregroundColors,
t,
),
backgroundColors: MultiColor.lerp(
a.backgroundColors,
b.backgroundColors,
t,
),
borderColors: MultiColor.lerp(
a.borderColors,
b.borderColors,
t,
),
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
stroke: lerpDouble(a.stroke, b.stroke, t),
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
);
}
/// Label text style
///
/// Default to `TextTheme.labelLarge`
final TextStyle? label;
@override
FlatButtonStyle? mergeWith(FlatButtonStyle? other) =>
FlatButtonStyle.merge(this, other);
@override
FlatButtonStyle? copyWith({
TextStyle? label,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
FlatButtonStyle(
label: label ?? this.label,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
}
@@ -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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'simple_icon_button_component.g.dart';
@ComponentProxyExtension()
abstract class SimpleIconButtonComponent extends ButtonComponent
with CopyWithMixin<$SimpleIconButtonComponentCWProxy> {
const SimpleIconButtonComponent({
this.icon,
super.disabledStyle,
super.normalStyle,
super.hoveredStyle,
super.focusedStyle,
super.tappedStyle,
super.onPressed,
super.disabled,
super.themeResolver,
super.key,
});
@override
SimpleIconButtonStyle? get disabledStyle;
@override
SimpleIconButtonStyle? get normalStyle;
@override
SimpleIconButtonStyle? get hoveredStyle;
@override
SimpleIconButtonStyle? get focusedStyle;
@override
SimpleIconButtonStyle? get tappedStyle;
final Icon? icon;
}
@@ -0,0 +1,33 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'simple_icon_button_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $SimpleIconButtonComponentCWProxy {
SimpleIconButtonComponent icon(Icon? icon);
SimpleIconButtonComponent disabledStyle(ButtonStyle<dynamic>? disabledStyle);
SimpleIconButtonComponent normalStyle(ButtonStyle<dynamic>? normalStyle);
SimpleIconButtonComponent hoveredStyle(ButtonStyle<dynamic>? hoveredStyle);
SimpleIconButtonComponent focusedStyle(ButtonStyle<dynamic>? focusedStyle);
SimpleIconButtonComponent tappedStyle(ButtonStyle<dynamic>? tappedStyle);
SimpleIconButtonComponent onPressed(void Function(ControlState)? onPressed);
SimpleIconButtonComponent disabled(ValueNotifier<bool>? disabled);
SimpleIconButtonComponent themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver);
SimpleIconButtonComponent key(Key? key);
SimpleIconButtonComponent call({
Icon? icon,
ButtonStyle<dynamic>? disabledStyle,
ButtonStyle<dynamic>? normalStyle,
ButtonStyle<dynamic>? hoveredStyle,
ButtonStyle<dynamic>? focusedStyle,
ButtonStyle<dynamic>? tappedStyle,
void Function(ControlState)? onPressed,
ValueNotifier<bool>? disabled,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
});
}
@@ -0,0 +1,123 @@
// 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 <https://www.gnu.org/licenses/>.
import 'dart:ui';
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> {
const SimpleIconButtonStyle({
this.dimension,
super.radius,
super.padding,
super.foregroundColors,
super.backgroundColors,
super.borderColors,
super.stroke,
super.shadow,
});
/// Merges non-null `b` attributes in `a`
static SimpleIconButtonStyle? merge(
SimpleIconButtonStyle? a,
SimpleIconButtonStyle? b,
) {
if (b == null) {
return a?.copyWith();
}
if (a == null) {
return b.copyWith();
}
return a.copyWith(
dimension: b.dimension,
radius: b.radius,
padding: b.padding,
foregroundColors: b.foregroundColors,
backgroundColors: b.backgroundColors,
borderColors: b.borderColors,
stroke: b.stroke,
shadow: b.shadow,
);
}
/// Used for interpolation.
static SimpleIconButtonStyle? lerp(
SimpleIconButtonStyle? a,
SimpleIconButtonStyle? b,
double t,
) {
if (a == null || b == null) {
return null;
}
// b.copyWith to return b attributes even if they are not lerped
return b.copyWith(
dimension: lerpDouble(a.dimension, b.dimension, t),
foregroundColors: MultiColor.lerp(
a.foregroundColors,
b.foregroundColors,
t,
),
backgroundColors: MultiColor.lerp(
a.backgroundColors,
b.backgroundColors,
t,
),
borderColors: MultiColor.lerp(
a.borderColors,
b.borderColors,
t,
),
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
stroke: lerpDouble(a.stroke, b.stroke, t),
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
);
}
/// Dimension of this button (as a square)
///
/// Default to `context.buttonTheme.height`
final double? dimension;
@override
SimpleIconButtonStyle? mergeWith(SimpleIconButtonStyle? other) =>
SimpleIconButtonStyle.merge(this, other);
@override
SimpleIconButtonStyle copyWith({
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
SimpleIconButtonStyle(
dimension: dimension ?? this.dimension,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
}
@@ -0,0 +1,63 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'symbol_button_component.g.dart';
@ComponentProxyExtension()
abstract class SymbolButtonComponent extends ButtonComponent
with CopyWithMixin<$SymbolButtonComponentCWProxy> {
const SymbolButtonComponent({
this.mainAxisSize = MainAxisSize.min,
this.label,
this.icon,
super.disabledStyle,
super.normalStyle,
super.hoveredStyle,
super.focusedStyle,
super.tappedStyle,
super.selectedStyle,
super.onPressed,
super.disabled,
super.themeResolver,
super.key,
});
@override
SymbolButtonStyle? get disabledStyle;
@override
SymbolButtonStyle? get normalStyle;
@override
SymbolButtonStyle? get hoveredStyle;
@override
SymbolButtonStyle? get focusedStyle;
@override
SymbolButtonStyle? get tappedStyle;
@override
SymbolButtonStyle? get selectedStyle;
final MainAxisSize? mainAxisSize;
final Widget? icon;
final TextWrapper? label;
}
@@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'symbol_button_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $SymbolButtonComponentCWProxy {
SymbolButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
SymbolButtonComponent label(TextWrapper? label);
SymbolButtonComponent icon(Widget? icon);
SymbolButtonComponent disabledStyle(ButtonStyle<dynamic>? disabledStyle);
SymbolButtonComponent normalStyle(ButtonStyle<dynamic>? normalStyle);
SymbolButtonComponent hoveredStyle(ButtonStyle<dynamic>? hoveredStyle);
SymbolButtonComponent focusedStyle(ButtonStyle<dynamic>? focusedStyle);
SymbolButtonComponent tappedStyle(ButtonStyle<dynamic>? tappedStyle);
SymbolButtonComponent selectedStyle(ButtonStyle<dynamic>? selectedStyle);
SymbolButtonComponent onPressed(void Function(ControlState)? onPressed);
SymbolButtonComponent disabled(ValueNotifier<bool>? disabled);
SymbolButtonComponent themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver);
SymbolButtonComponent key(Key? key);
SymbolButtonComponent call({
MainAxisSize? mainAxisSize,
TextWrapper? label,
Widget? icon,
ButtonStyle<dynamic>? disabledStyle,
ButtonStyle<dynamic>? normalStyle,
ButtonStyle<dynamic>? hoveredStyle,
ButtonStyle<dynamic>? focusedStyle,
ButtonStyle<dynamic>? tappedStyle,
ButtonStyle<dynamic>? selectedStyle,
void Function(ControlState)? onPressed,
ValueNotifier<bool>? disabled,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
});
}
@@ -0,0 +1,133 @@
// 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 <https://www.gnu.org/licenses/>.
import 'dart:ui';
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> {
const SymbolButtonStyle({
this.label,
this.dimension,
super.radius,
super.padding,
super.foregroundColors,
super.backgroundColors,
super.borderColors,
super.stroke,
super.shadow,
});
/// Merges non-null `b` attributes in `a`
static SymbolButtonStyle? merge(
SymbolButtonStyle? a,
SymbolButtonStyle? b,
) {
if (b == null) {
return a?.copyWith();
}
if (a == null) {
return b.copyWith();
}
return a.copyWith(
label: b.label,
dimension: b.dimension,
radius: b.radius,
padding: b.padding,
foregroundColors: b.foregroundColors,
backgroundColors: b.backgroundColors,
borderColors: b.borderColors,
stroke: b.stroke,
shadow: b.shadow,
);
}
/// Used for interpolation.
static SymbolButtonStyle? lerp(
SymbolButtonStyle? a,
SymbolButtonStyle? b,
double t,
) {
if (a == null || b == null) {
return null;
}
// b.copyWith to return b attributes even if they are not lerped
return b.copyWith(
label: TextStyle.lerp(a.label, b.label, t),
dimension: lerpDouble(a.dimension, b.dimension, t),
foregroundColors: MultiColor.lerp(
a.foregroundColors,
b.foregroundColors,
t,
),
backgroundColors: MultiColor.lerp(
a.backgroundColors,
b.backgroundColors,
t,
),
borderColors: MultiColor.lerp(
a.borderColors,
b.borderColors,
t,
),
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
stroke: lerpDouble(a.stroke, b.stroke, t),
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
);
}
/// Label text style
///
/// Default to `TextTheme.labelLarge`
final TextStyle? label;
/// Dimension of this button (as a square)
///
/// Default to `context.buttonTheme.height`
final double? dimension;
@override
SymbolButtonStyle? mergeWith(SymbolButtonStyle? other) =>
SymbolButtonStyle.merge(this, other);
@override
SymbolButtonStyle? copyWith({
TextStyle? label,
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
SymbolButtonStyle(
label: label ?? this.label,
dimension: dimension ?? this.dimension,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
}
@@ -0,0 +1,61 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
abstract class CardComponent extends Component {
const CardComponent({
this.radius = 12,
this.padding = 25,
this.borderColors,
this.backgroundColors,
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,
});
/// Card radius
final double? radius;
/// Padding and gaps of this card
final double? padding;
/// Border gradient color (from left to right)
final MultiColor? borderColors;
/// Card background color
final MultiColor? backgroundColors;
/// Minimum size for this card
final Size? minSize;
/// Maximum size for this card
final Size? maxSize;
/// Drop shadow
final BoxShadow? shadow;
/// Background of the card
final Widget? background;
}
@@ -0,0 +1,20 @@
// 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 <https://www.gnu.org/licenses/>.
export './information_card_component.dart';
export './portfolio_card_component.dart';
export './quote_card_component.dart';
export './skill_card_component.dart';
@@ -0,0 +1,49 @@
// 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 <https://www.gnu.org/licenses/>.
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 '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,
super.padding,
super.borderColors,
super.backgroundColors,
super.minSize,
super.maxSize,
super.shadow,
super.background,
super.key,
});
final Axis? axis;
final List<Widget>? icons;
final TextWrapper? title;
final TextWrapper? subtitle;
final TextWrapper? body;
}
@@ -0,0 +1,40 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'information_card_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $InformationCardComponentCWProxy {
InformationCardComponent icons(List<Widget>? icons);
InformationCardComponent title(TextWrapper? title);
InformationCardComponent subtitle(TextWrapper? subtitle);
InformationCardComponent body(TextWrapper? body);
InformationCardComponent axis(Axis? axis);
InformationCardComponent radius(double? radius);
InformationCardComponent padding(double? padding);
InformationCardComponent borderColors(MultiColor? borderColors);
InformationCardComponent backgroundColors(MultiColor? backgroundColors);
InformationCardComponent minSize(Size? minSize);
InformationCardComponent maxSize(Size? maxSize);
InformationCardComponent shadow(BoxShadow? shadow);
InformationCardComponent background(Widget? background);
InformationCardComponent key(Key? key);
InformationCardComponent call({
List<Widget>? icons,
TextWrapper? title,
TextWrapper? subtitle,
TextWrapper? body,
Axis? axis,
double? radius,
double? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
Widget? background,
Key? key,
});
}
@@ -0,0 +1,57 @@
// 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 <https://www.gnu.org/licenses/>.
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.secondaryBackgroundColors,
this.showImagesOnTop,
this.keyword,
this.description,
this.logo,
this.projectName,
this.subtitle,
this.ctas,
this.assets,
super.radius,
super.padding,
super.borderColors,
super.backgroundColors,
super.minSize,
super.maxSize,
super.shadow,
super.background,
super.key,
});
final bool? showImagesOnTop;
final List<TextWrapper>? keyword;
final List<Widget>? assets;
final TextWrapper? description;
final Widget? logo;
final TextWrapper? projectName;
final TextWrapper? subtitle;
final List<Widget>? ctas;
final Color? secondaryBackgroundColors;
}
@@ -0,0 +1,49 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'portfolio_card_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $PortfolioCardComponentCWProxy {
PortfolioCardComponent secondaryBackgroundColors(
Color? secondaryBackgroundColors);
PortfolioCardComponent showImagesOnTop(bool? showImagesOnTop);
PortfolioCardComponent keyword(List<TextWrapper>? keyword);
PortfolioCardComponent description(TextWrapper? description);
PortfolioCardComponent logo(Widget? logo);
PortfolioCardComponent projectName(TextWrapper? projectName);
PortfolioCardComponent subtitle(TextWrapper? subtitle);
PortfolioCardComponent ctas(List<Widget>? ctas);
PortfolioCardComponent assets(List<Widget>? assets);
PortfolioCardComponent radius(double? radius);
PortfolioCardComponent padding(double? padding);
PortfolioCardComponent borderColors(MultiColor? borderColors);
PortfolioCardComponent backgroundColors(MultiColor? backgroundColors);
PortfolioCardComponent minSize(Size? minSize);
PortfolioCardComponent maxSize(Size? maxSize);
PortfolioCardComponent shadow(BoxShadow? shadow);
PortfolioCardComponent background(Widget? background);
PortfolioCardComponent key(Key? key);
PortfolioCardComponent call({
Color? secondaryBackgroundColors,
bool? showImagesOnTop,
List<TextWrapper>? keyword,
TextWrapper? description,
Widget? logo,
TextWrapper? projectName,
TextWrapper? subtitle,
List<Widget>? ctas,
List<Widget>? assets,
double? radius,
double? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
Widget? background,
Key? key,
});
}
@@ -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 <https://www.gnu.org/licenses/>.
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 'quote_card_component.g.dart';
@ComponentProxyExtension()
abstract class QuoteCardComponent extends CardComponent
with CopyWithMixin<$QuoteCardComponentCWProxy> {
const QuoteCardComponent({
this.avatar,
this.name,
this.subtitle,
this.gradient,
this.quote,
this.leftQuote,
this.rightQuote,
super.radius,
super.padding,
super.borderColors,
super.backgroundColors,
super.minSize,
super.maxSize,
super.shadow,
super.background,
super.key,
});
final Widget? avatar;
final TextWrapper? name;
final TextWrapper? subtitle;
final TextWrapper? quote;
final Gradient? gradient;
final Widget? leftQuote;
final Widget? rightQuote;
}
@@ -0,0 +1,44 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'quote_card_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $QuoteCardComponentCWProxy {
QuoteCardComponent avatar(Widget? avatar);
QuoteCardComponent name(TextWrapper? name);
QuoteCardComponent subtitle(TextWrapper? subtitle);
QuoteCardComponent gradient(Gradient? gradient);
QuoteCardComponent quote(TextWrapper? quote);
QuoteCardComponent leftQuote(Widget? leftQuote);
QuoteCardComponent rightQuote(Widget? rightQuote);
QuoteCardComponent radius(double? radius);
QuoteCardComponent padding(double? padding);
QuoteCardComponent borderColors(MultiColor? borderColors);
QuoteCardComponent backgroundColors(MultiColor? backgroundColors);
QuoteCardComponent minSize(Size? minSize);
QuoteCardComponent maxSize(Size? maxSize);
QuoteCardComponent shadow(BoxShadow? shadow);
QuoteCardComponent background(Widget? background);
QuoteCardComponent key(Key? key);
QuoteCardComponent call({
Widget? avatar,
TextWrapper? name,
TextWrapper? subtitle,
Gradient? gradient,
TextWrapper? quote,
Widget? leftQuote,
Widget? rightQuote,
double? radius,
double? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
Widget? background,
Key? key,
});
}
@@ -0,0 +1,53 @@
// 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 <https://www.gnu.org/licenses/>.
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,
this.secondaryBackgroundColors,
super.radius,
super.padding,
super.borderColors,
super.backgroundColors,
super.minSize,
super.maxSize,
super.shadow,
super.background,
super.key,
});
final IconData? icon;
final List<Color>? gradient;
final TextWrapper? title;
final TextWrapper? description;
final List<TextWrapper>? skills;
final IconData? leadingIcon;
final Color? secondaryBackgroundColors;
}
@@ -0,0 +1,45 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'skill_card_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $SkillCardComponentCWProxy {
SkillCardComponent icon(IconData? icon);
SkillCardComponent gradient(List<Color>? gradient);
SkillCardComponent title(TextWrapper? title);
SkillCardComponent description(TextWrapper? description);
SkillCardComponent skills(List<TextWrapper>? skills);
SkillCardComponent leadingIcon(IconData? leadingIcon);
SkillCardComponent secondaryBackgroundColors(
Color? secondaryBackgroundColors);
SkillCardComponent radius(double? radius);
SkillCardComponent padding(double? padding);
SkillCardComponent borderColors(MultiColor? borderColors);
SkillCardComponent backgroundColors(MultiColor? backgroundColors);
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<Color>? gradient,
TextWrapper? title,
TextWrapper? description,
List<TextWrapper>? skills,
IconData? leadingIcon,
Color? secondaryBackgroundColors,
double? radius,
double? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
Widget? background,
Key? key,
});
}
@@ -15,7 +15,11 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/src/core/utils/theme_resolver.dart';
abstract class Component extends StatelessWidget {
const Component({super.key});
const Component({this.themeResolver, super.key});
/// Theme Resolver for this component
final ThemeResolver<dynamic, dynamic, dynamic>? themeResolver;
}
@@ -14,8 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export './app_bar_component.dart';
export './bottom_navigation_bar_component.dart';
export './error_widget_component.dart';
export './loading_widget_component.dart';
export './bars/bars.dart';
export './buttons/buttons.dart';
export './cards/cards.dart';
export './component.dart';
export './error_widget_component.dart';
export './loader/loader.dart';
export './loading_widget_component.dart';
export './rich_text_builder/rich_text_builder.dart';
export './text_inputs/text_inputs.dart';
export './theme_style.dart';
@@ -14,16 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.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 TextWrapper? error;
}
@@ -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,
});
}
@@ -12,4 +12,6 @@
// 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 <https://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export './loader_component.dart';
@@ -0,0 +1,50 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'loader_component.g.dart';
@ComponentProxyExtension()
abstract class LoaderComponent extends Component
with CopyWithMixin<$LoaderComponentCWProxy> {
const LoaderComponent({
this.colors,
this.radius,
this.stroke,
this.duration,
this.flip,
super.themeResolver,
super.key,
});
/// Gradient colors from start to end.
final MultiColor? colors;
/// Loader radius
final double? radius;
/// Loader stroke width
final double? stroke;
/// Animation duration
final Duration? duration;
/// Flip the animation
final bool? flip;
}
@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'loader_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $LoaderComponentCWProxy {
LoaderComponent colors(MultiColor? colors);
LoaderComponent radius(double? radius);
LoaderComponent stroke(double? stroke);
LoaderComponent duration(Duration? duration);
LoaderComponent flip(bool? flip);
LoaderComponent themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver);
LoaderComponent key(Key? key);
LoaderComponent call({
MultiColor? colors,
double? radius,
double? stroke,
Duration? duration,
bool? flip,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
});
}
@@ -15,15 +15,15 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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;
}
@@ -0,0 +1,120 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
class RichTextStyleParameter {
const RichTextStyleParameter(
this.defaultStyle,
this.definedStyle,
this.styleName,
);
final TextStyle? defaultStyle;
final Map<String, TextStyle> definedStyle;
final String? styleName;
TextStyle get style {
if (definedStyle.containsKey(styleName)) {
return definedStyle[styleName]!;
}
return defaultStyle ?? const TextStyle();
}
RichTextStyleParameter copyWith({
TextStyle? defaultStyle,
Map<String, TextStyle>? definedStyle,
String? styleName,
}) =>
RichTextStyleParameter(
defaultStyle ?? this.defaultStyle,
definedStyle ?? this.definedStyle,
styleName ?? this.styleName,
);
}
class RichTextNode {
RichTextNode(this.nodes);
final List<RichTextNode> nodes;
static RichTextNode from(
String content,
RegExp regex,
RichTextStyleParameter styleParameter,
) {
final matches = regex.allMatches(content);
if (matches.isNotEmpty) {
// match found -> construct node with leaf/nodes
final List<RichTextNode> nodes = [];
for (var i = 0; i < matches.length; i++) {
final previousMatch = i > 0 ? matches.elementAt(i - 1) : null;
final currentMatch = matches.elementAt(i);
// non match before
final nonMatchBefore = (previousMatch != null)
? content.substring(previousMatch.end, currentMatch.start)
: content.substring(0, currentMatch.start);
nodes
..add(RichTextNode.from(nonMatchBefore, regex, styleParameter))
// match
..add(
RichTextNode.from(
currentMatch.group(2)!,
regex,
styleParameter.copyWith(styleName: currentMatch.group(1)),
),
);
}
// non match after
final nonMatchAfter = content.substring(matches.last.end);
nodes.add(RichTextNode.from(nonMatchAfter, regex, styleParameter));
return RichTextNode(nodes);
} else {
// match not found -> construct leaf
return RichTextLeaf(styleParameter.style, content);
}
}
InlineSpan toInlineSpan(RichTextParser parser) {
final children = <InlineSpan>[];
for (final node in nodes) {
children.add(node.toInlineSpan(parser));
}
return TextSpan(children: children);
}
}
class RichTextLeaf extends RichTextNode {
RichTextLeaf(this.style, this.content) : super([]);
final TextStyle style;
final String content;
@override
InlineSpan toInlineSpan(RichTextParser parser) =>
parser.nodeBuilder.call(content, style);
}
class RichTextParser {
const RichTextParser({required this.nodeBuilder});
factory RichTextParser.defaultBuilder() => RichTextParser(
nodeBuilder: (content, style) => TextSpan(
text: content,
style: style,
),
);
final InlineSpan Function(String content, TextStyle style) nodeBuilder;
}
@@ -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 <https://www.gnu.org/licenses/>.
export 'parser.dart';
export 'rich_text_builder_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 <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'rich_text_builder_component.g.dart';
@ComponentProxyExtension()
abstract class RichTextBuilderComponent extends Component
with CopyWithMixin<$RichTextBuilderComponentCWProxy> {
const RichTextBuilderComponent({
this.text,
this.parser,
this.defaultStyle,
this.styles,
super.key,
});
/// Full text
final String? text;
/// How to build InlineSpans
final RichTextParser? parser;
/// Default TextStyle used in this rich text component.
final TextStyle? defaultStyle;
/// Used styles in this rich text component.
///
/// e.g.
/// ```dart
/// styles = {'red': TextStyle(color: Colors.red)};
/// ```
/// will transform:
/// ```text
/// This text <red>is red</red.
/// ```
/// in "This text `is red`."
final Map<String, TextStyle>? styles;
}
@@ -0,0 +1,22 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'rich_text_builder_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $RichTextBuilderComponentCWProxy {
RichTextBuilderComponent text(String? text);
RichTextBuilderComponent parser(RichTextParser? parser);
RichTextBuilderComponent defaultStyle(TextStyle? defaultStyle);
RichTextBuilderComponent styles(Map<String, TextStyle>? styles);
RichTextBuilderComponent key(Key? key);
RichTextBuilderComponent call({
String? text,
RichTextParser? parser,
TextStyle? defaultStyle,
Map<String, TextStyle>? styles,
Key? key,
});
}
@@ -0,0 +1,173 @@
// 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 <https://www.gnu.org/licenses/>.
import 'dart:ui';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'text_input_component.g.dart';
@ComponentProxyExtension()
abstract class TextInputComponent extends Component
with CopyWithMixin<$TextInputComponentCWProxy> {
const TextInputComponent({
this.expand,
this.onError,
this.validator,
this.suffixText,
this.prefixText,
this.prefixIcon,
this.suffixIcon,
this.label,
this.hint,
this.normalStyle,
this.focusedStyle,
this.errorStyle,
this.disableStyle,
this.controller,
this.focusNode,
this.keyboardType,
this.smartDashesType,
this.smartQuotesType,
this.enableInteractiveSelection,
this.textInputAction,
this.textCapitalization,
this.style,
this.strutStyle,
this.textAlign,
this.textAlignVertical,
this.textDirection,
this.readOnly,
this.showCursor,
this.autofocus,
this.obscuringCharacter,
this.obscureText,
this.autocorrect,
this.enableSuggestions,
this.maxLines,
this.minLines,
this.expands,
this.maxLength,
this.maxLengthEnforcement,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.onAppPrivateCommand,
this.inputFormatters,
this.enabled,
this.cursorWidth,
this.cursorHeight,
this.cursorRadius,
this.cursorColor,
this.selectionHeightStyle,
this.selectionWidthStyle,
this.keyboardAppearance,
this.scrollPadding,
this.dragStartBehavior,
this.selectionControls,
this.onTap,
this.onTapOutside,
this.mouseCursor,
this.scrollController,
this.scrollPhysics,
this.autofillHints,
this.clipBehavior,
this.restorationId,
this.scribbleEnabled,
this.enableIMEPersonalizedLearning,
this.contextMenuBuilder,
this.spellCheckConfiguration,
this.magnifierConfiguration,
super.key,
});
final TextMagnifierConfiguration? magnifierConfiguration;
final TextEditingController? controller;
final FocusNode? focusNode;
final TextInputType? keyboardType;
final TextInputAction? textInputAction;
final TextCapitalization? textCapitalization;
final TextStyle? style;
final StrutStyle? strutStyle;
final TextAlign? textAlign;
final TextAlignVertical? textAlignVertical;
final TextDirection? textDirection;
final bool? autofocus;
final String? obscuringCharacter;
final bool? obscureText;
final bool? autocorrect;
final SmartDashesType? smartDashesType;
final SmartQuotesType? smartQuotesType;
final bool? enableSuggestions;
final int? maxLines;
final int? minLines;
final bool? expands;
final bool? readOnly;
final bool? showCursor;
final int? maxLength;
final MaxLengthEnforcement? maxLengthEnforcement;
final ValueChanged<String>? onChanged;
final VoidCallback? onEditingComplete;
final ValueChanged<String>? onSubmitted;
final AppPrivateCommandCallback? onAppPrivateCommand;
final List<TextInputFormatter>? inputFormatters;
final ValueNotifier<bool>? enabled;
final double? cursorWidth;
final double? cursorHeight;
final Radius? cursorRadius;
final Color? cursorColor;
final BoxHeightStyle? selectionHeightStyle;
final BoxWidthStyle? selectionWidthStyle;
final Brightness? keyboardAppearance;
final EdgeInsets? scrollPadding;
final bool? enableInteractiveSelection;
final TextSelectionControls? selectionControls;
final DragStartBehavior? dragStartBehavior;
final GestureTapCallback? onTap;
final TapRegionCallback? onTapOutside;
final MouseCursor? mouseCursor;
final ScrollPhysics? scrollPhysics;
final ScrollController? scrollController;
final Iterable<String>? autofillHints;
final Clip? clipBehavior;
final String? restorationId;
final bool? scribbleEnabled;
final bool? enableIMEPersonalizedLearning;
final EditableTextContextMenuBuilder? contextMenuBuilder;
final SpellCheckConfiguration? spellCheckConfiguration;
final bool Function(String)? validator;
final String? Function(String)? onError;
final TextInputStyle? normalStyle;
final TextInputStyle? focusedStyle;
final TextInputStyle? errorStyle;
final TextInputStyle? disableStyle;
final bool? expand;
final TextWrapper? label;
final TextWrapper? hint;
final TextWrapper? prefixText;
final TextWrapper? suffixText;
final Icon? prefixIcon;
final Icon? suffixIcon;
}
@@ -0,0 +1,157 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'text_input_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $TextInputComponentCWProxy {
TextInputComponent expand(bool? expand);
TextInputComponent onError(String Function(String)? onError);
TextInputComponent validator(bool Function(String)? validator);
TextInputComponent suffixText(TextWrapper? suffixText);
TextInputComponent prefixText(TextWrapper? prefixText);
TextInputComponent prefixIcon(Icon? prefixIcon);
TextInputComponent suffixIcon(Icon? suffixIcon);
TextInputComponent label(TextWrapper? label);
TextInputComponent hint(TextWrapper? hint);
TextInputComponent normalStyle(TextInputStyle? normalStyle);
TextInputComponent focusedStyle(TextInputStyle? focusedStyle);
TextInputComponent errorStyle(TextInputStyle? errorStyle);
TextInputComponent disableStyle(TextInputStyle? disableStyle);
TextInputComponent controller(TextEditingController? controller);
TextInputComponent focusNode(FocusNode? focusNode);
TextInputComponent keyboardType(TextInputType? keyboardType);
TextInputComponent smartDashesType(SmartDashesType? smartDashesType);
TextInputComponent smartQuotesType(SmartQuotesType? smartQuotesType);
TextInputComponent enableInteractiveSelection(
bool? enableInteractiveSelection);
TextInputComponent textInputAction(TextInputAction? textInputAction);
TextInputComponent textCapitalization(TextCapitalization? textCapitalization);
TextInputComponent style(TextStyle? style);
TextInputComponent strutStyle(StrutStyle? strutStyle);
TextInputComponent textAlign(TextAlign? textAlign);
TextInputComponent textAlignVertical(TextAlignVertical? textAlignVertical);
TextInputComponent textDirection(TextDirection? textDirection);
TextInputComponent readOnly(bool? readOnly);
TextInputComponent showCursor(bool? showCursor);
TextInputComponent autofocus(bool? autofocus);
TextInputComponent obscuringCharacter(String? obscuringCharacter);
TextInputComponent obscureText(bool? obscureText);
TextInputComponent autocorrect(bool? autocorrect);
TextInputComponent enableSuggestions(bool? enableSuggestions);
TextInputComponent maxLines(int? maxLines);
TextInputComponent minLines(int? minLines);
TextInputComponent expands(bool? expands);
TextInputComponent maxLength(int? maxLength);
TextInputComponent maxLengthEnforcement(
MaxLengthEnforcement? maxLengthEnforcement);
TextInputComponent onChanged(void Function(String)? onChanged);
TextInputComponent onEditingComplete(void Function()? onEditingComplete);
TextInputComponent onSubmitted(void Function(String)? onSubmitted);
TextInputComponent onAppPrivateCommand(
void Function(String, Map<String, dynamic>)? onAppPrivateCommand);
TextInputComponent inputFormatters(List<TextInputFormatter>? inputFormatters);
TextInputComponent enabled(ValueNotifier<bool>? enabled);
TextInputComponent cursorWidth(double? cursorWidth);
TextInputComponent cursorHeight(double? cursorHeight);
TextInputComponent cursorRadius(Radius? cursorRadius);
TextInputComponent cursorColor(Color? cursorColor);
TextInputComponent selectionHeightStyle(BoxHeightStyle? selectionHeightStyle);
TextInputComponent selectionWidthStyle(BoxWidthStyle? selectionWidthStyle);
TextInputComponent keyboardAppearance(Brightness? keyboardAppearance);
TextInputComponent scrollPadding(EdgeInsets? scrollPadding);
TextInputComponent dragStartBehavior(DragStartBehavior? dragStartBehavior);
TextInputComponent selectionControls(
TextSelectionControls? selectionControls);
TextInputComponent onTap(void Function()? onTap);
TextInputComponent onTapOutside(
void Function(PointerDownEvent)? onTapOutside);
TextInputComponent mouseCursor(MouseCursor? mouseCursor);
TextInputComponent scrollController(ScrollController? scrollController);
TextInputComponent scrollPhysics(ScrollPhysics? scrollPhysics);
TextInputComponent autofillHints(Iterable<String>? autofillHints);
TextInputComponent clipBehavior(Clip? clipBehavior);
TextInputComponent restorationId(String? restorationId);
TextInputComponent scribbleEnabled(bool? scribbleEnabled);
TextInputComponent enableIMEPersonalizedLearning(
bool? enableIMEPersonalizedLearning);
TextInputComponent contextMenuBuilder(
Widget Function(BuildContext, EditableTextState)? contextMenuBuilder);
TextInputComponent spellCheckConfiguration(
SpellCheckConfiguration? spellCheckConfiguration);
TextInputComponent magnifierConfiguration(
TextMagnifierConfiguration? magnifierConfiguration);
TextInputComponent key(Key? key);
TextInputComponent call({
bool? expand,
String Function(String)? onError,
bool Function(String)? validator,
TextWrapper? suffixText,
TextWrapper? prefixText,
Icon? prefixIcon,
Icon? suffixIcon,
TextWrapper? label,
TextWrapper? hint,
TextInputStyle? normalStyle,
TextInputStyle? focusedStyle,
TextInputStyle? errorStyle,
TextInputStyle? disableStyle,
TextEditingController? controller,
FocusNode? focusNode,
TextInputType? keyboardType,
SmartDashesType? smartDashesType,
SmartQuotesType? smartQuotesType,
bool? enableInteractiveSelection,
TextInputAction? textInputAction,
TextCapitalization? textCapitalization,
TextStyle? style,
StrutStyle? strutStyle,
TextAlign? textAlign,
TextAlignVertical? textAlignVertical,
TextDirection? textDirection,
bool? readOnly,
bool? showCursor,
bool? autofocus,
String? obscuringCharacter,
bool? obscureText,
bool? autocorrect,
bool? enableSuggestions,
int? maxLines,
int? minLines,
bool? expands,
int? maxLength,
MaxLengthEnforcement? maxLengthEnforcement,
void Function(String)? onChanged,
void Function()? onEditingComplete,
void Function(String)? onSubmitted,
void Function(String, Map<String, dynamic>)? onAppPrivateCommand,
List<TextInputFormatter>? inputFormatters,
ValueNotifier<bool>? enabled,
double? cursorWidth,
double? cursorHeight,
Radius? cursorRadius,
Color? cursorColor,
BoxHeightStyle? selectionHeightStyle,
BoxWidthStyle? selectionWidthStyle,
Brightness? keyboardAppearance,
EdgeInsets? scrollPadding,
DragStartBehavior? dragStartBehavior,
TextSelectionControls? selectionControls,
void Function()? onTap,
void Function(PointerDownEvent)? onTapOutside,
MouseCursor? mouseCursor,
ScrollController? scrollController,
ScrollPhysics? scrollPhysics,
Iterable<String>? autofillHints,
Clip? clipBehavior,
String? restorationId,
bool? scribbleEnabled,
bool? enableIMEPersonalizedLearning,
Widget Function(BuildContext, EditableTextState)? contextMenuBuilder,
SpellCheckConfiguration? spellCheckConfiguration,
TextMagnifierConfiguration? magnifierConfiguration,
Key? key,
});
}
@@ -0,0 +1,133 @@
// 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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
class TextInputStyle extends ThemeStyle<TextInputStyle> {
TextInputStyle({
this.labelStyle,
this.hintStyle,
this.backgroundColors,
this.borderColors,
this.boxShadow,
this.radius,
this.inputStyle,
this.iconColor,
this.prefixStyle,
this.prefixIconColor,
this.suffixStyle,
this.suffixIconColor,
});
final TextStyle? labelStyle;
final TextStyle? hintStyle;
final Color? iconColor;
final TextStyle? prefixStyle;
final Color? prefixIconColor;
final TextStyle? suffixStyle;
final Color? suffixIconColor;
final MultiColor? backgroundColors;
final Color? borderColors;
final BoxShadow? boxShadow;
final BorderRadiusGeometry? radius;
final TextStyle? inputStyle;
static TextInputStyle? merge(TextInputStyle? a, TextInputStyle? b) {
if (b == null) {
return a?.copyWith();
}
if (a == null) {
return b.copyWith();
}
return a.copyWith(
labelStyle: b.labelStyle,
hintStyle: b.hintStyle,
backgroundColors: b.backgroundColors,
borderColors: b.borderColors,
boxShadow: b.boxShadow,
radius: b.radius,
inputStyle: b.inputStyle,
iconColor: b.iconColor,
prefixStyle: b.prefixStyle,
prefixIconColor: b.prefixIconColor,
suffixIconColor: b.suffixIconColor,
suffixStyle: b.suffixStyle,
);
}
static TextInputStyle? lerp(
TextInputStyle? a,
TextInputStyle? b,
double t,
) {
if (a == null || b == null) {
return null;
}
return b.copyWith(
labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
hintStyle: TextStyle.lerp(a.hintStyle, b.hintStyle, t),
backgroundColors:
MultiColor.lerp(a.backgroundColors, b.backgroundColors, t),
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
borderColors: Color.lerp(a.borderColors, b.borderColors, t),
boxShadow: BoxShadow.lerp(a.boxShadow, b.boxShadow, t),
inputStyle: TextStyle.lerp(a.inputStyle, b.inputStyle, t),
prefixStyle: TextStyle.lerp(a.prefixStyle, b.prefixStyle, t),
suffixStyle: TextStyle.lerp(a.suffixStyle, b.suffixStyle, t),
prefixIconColor: Color.lerp(a.prefixIconColor, b.prefixIconColor, t),
suffixIconColor: Color.lerp(a.suffixIconColor, b.suffixIconColor, t),
iconColor: Color.lerp(a.iconColor, b.iconColor, t),
);
}
@override
TextInputStyle? mergeWith(TextInputStyle? other) =>
TextInputStyle.merge(this, other);
@override
TextInputStyle copyWith({
TextStyle? labelStyle,
TextStyle? hintStyle,
MultiColor? backgroundColors,
Color? borderColors,
BoxShadow? boxShadow,
BorderRadiusGeometry? radius,
TextStyle? inputStyle,
Color? iconColor,
TextStyle? prefixStyle,
Color? prefixIconColor,
TextStyle? suffixStyle,
Color? suffixIconColor,
}) =>
TextInputStyle(
labelStyle: labelStyle ?? this.labelStyle,
hintStyle: hintStyle ?? this.hintStyle,
backgroundColors: backgroundColors ?? this.backgroundColors,
radius: radius ?? this.radius,
borderColors: borderColors ?? this.borderColors,
boxShadow: boxShadow ?? this.boxShadow,
inputStyle: inputStyle ?? this.inputStyle,
prefixStyle: prefixStyle ?? this.prefixStyle,
suffixStyle: suffixStyle ?? this.suffixStyle,
prefixIconColor: prefixIconColor ?? this.prefixIconColor,
suffixIconColor: suffixIconColor ?? this.suffixIconColor,
iconColor: iconColor ?? this.iconColor,
);
}
@@ -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 <https://www.gnu.org/licenses/>.
export './text_input_component.dart';
export './text_input_style.dart';
@@ -0,0 +1,25 @@
// 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 <https://www.gnu.org/licenses/>.
abstract class ThemeStyle<T> {
const ThemeStyle();
/// Merges non-null `other` attributes in `this` and returns a copy.
T? mergeWith(T? other);
/// Copy with (mandatory for mergeWith, needs to be simple and ignore `null`)
T? copyWith();
}
@@ -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) =>
@@ -14,18 +14,88 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:wyatt_ui_components/src/domain/entities/entities.dart';
part 'component_theme_data.g.dart';
@CopyWith()
class ComponentThemeData {
final AppBarComponent? appBar;
final BottomNavigationBarComponent? bottomNavigationBar;
final ErrorWidgetComponent? errorWidget;
final LoadingWidgetComponent? loadingWidget;
factory ComponentThemeData({
TopAppBarComponent? appBar,
TopNavigationBarComponent? topNavigationBarComponent,
BottomNavigationBarComponent? bottomNavigationBar,
ErrorWidgetComponent? errorWidget,
LoadingWidgetComponent? loadingWidget,
LoaderComponent? loaderComponent,
RichTextBuilderComponent? richTextBuilderComponent,
TextInputComponent? textInputComponent,
FileSelectionButtonComponent? fileSelectionButtonComponent,
FlatButtonComponent? flatButtonComponent,
SimpleIconButtonComponent? simpleIconButtonComponent,
SymbolButtonComponent? symbolButtonComponent,
InformationCardComponent? informationCardComponent,
PortfolioCardComponent? portfolioCardComponent,
QuoteCardComponent? quoteCardComponent,
SkillCardComponent? skillCardComponent,
}) =>
ComponentThemeData.raw(
appBar: appBar,
topNavigationBarComponent: topNavigationBarComponent,
bottomNavigationBar: bottomNavigationBar,
errorWidget: errorWidget,
loadingWidget: loadingWidget,
loaderComponent: loaderComponent,
richTextBuilderComponent: richTextBuilderComponent,
textInputComponent: textInputComponent,
fileSelectionButtonComponent: fileSelectionButtonComponent,
flatButtonComponent: flatButtonComponent,
simpleIconButtonComponent: simpleIconButtonComponent,
symbolButtonComponent: symbolButtonComponent,
informationCardComponent: informationCardComponent,
portfolioCardComponent: portfolioCardComponent,
quoteCardComponent: quoteCardComponent,
skillCardComponent: skillCardComponent,
);
const ComponentThemeData.raw({
this.appBar,
this.topNavigationBarComponent,
this.bottomNavigationBar,
this.errorWidget,
this.loadingWidget,
this.loaderComponent,
this.richTextBuilderComponent,
this.textInputComponent,
this.fileSelectionButtonComponent,
this.flatButtonComponent,
this.simpleIconButtonComponent,
this.symbolButtonComponent,
this.informationCardComponent,
this.portfolioCardComponent,
this.quoteCardComponent,
this.skillCardComponent,
});
final TopAppBarComponent? appBar;
final TopNavigationBarComponent? topNavigationBarComponent;
final BottomNavigationBarComponent? bottomNavigationBar;
final ErrorWidgetComponent? errorWidget;
final LoadingWidgetComponent? loadingWidget;
final LoaderComponent? loaderComponent;
final RichTextBuilderComponent? richTextBuilderComponent;
final TextInputComponent? textInputComponent;
// Buttons
final FileSelectionButtonComponent? fileSelectionButtonComponent;
final FlatButtonComponent? flatButtonComponent;
final SimpleIconButtonComponent? simpleIconButtonComponent;
final SymbolButtonComponent? symbolButtonComponent;
// Cards
final InformationCardComponent? informationCardComponent;
final PortfolioCardComponent? portfolioCardComponent;
final QuoteCardComponent? quoteCardComponent;
final SkillCardComponent? skillCardComponent;
}
@@ -0,0 +1,265 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'component_theme_data.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$ComponentThemeDataCWProxy {
ComponentThemeData appBar(TopAppBarComponent? appBar);
ComponentThemeData topNavigationBarComponent(
TopNavigationBarComponent? topNavigationBarComponent);
ComponentThemeData bottomNavigationBar(
BottomNavigationBarComponent? bottomNavigationBar);
ComponentThemeData errorWidget(ErrorWidgetComponent? errorWidget);
ComponentThemeData loadingWidget(LoadingWidgetComponent? loadingWidget);
ComponentThemeData loaderComponent(LoaderComponent? loaderComponent);
ComponentThemeData richTextBuilderComponent(
RichTextBuilderComponent? richTextBuilderComponent);
ComponentThemeData textInputComponent(TextInputComponent? textInputComponent);
ComponentThemeData fileSelectionButtonComponent(
FileSelectionButtonComponent? fileSelectionButtonComponent);
ComponentThemeData flatButtonComponent(
FlatButtonComponent? flatButtonComponent);
ComponentThemeData simpleIconButtonComponent(
SimpleIconButtonComponent? simpleIconButtonComponent);
ComponentThemeData symbolButtonComponent(
SymbolButtonComponent? symbolButtonComponent);
ComponentThemeData informationCardComponent(
InformationCardComponent? informationCardComponent);
ComponentThemeData portfolioCardComponent(
PortfolioCardComponent? portfolioCardComponent);
ComponentThemeData quoteCardComponent(QuoteCardComponent? quoteCardComponent);
ComponentThemeData skillCardComponent(SkillCardComponent? skillCardComponent);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ComponentThemeData(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// ComponentThemeData(...).copyWith(id: 12, name: "My name")
/// ````
ComponentThemeData call({
TopAppBarComponent? appBar,
TopNavigationBarComponent? topNavigationBarComponent,
BottomNavigationBarComponent? bottomNavigationBar,
ErrorWidgetComponent? errorWidget,
LoadingWidgetComponent? loadingWidget,
LoaderComponent? loaderComponent,
RichTextBuilderComponent? richTextBuilderComponent,
TextInputComponent? textInputComponent,
FileSelectionButtonComponent? fileSelectionButtonComponent,
FlatButtonComponent? flatButtonComponent,
SimpleIconButtonComponent? simpleIconButtonComponent,
SymbolButtonComponent? symbolButtonComponent,
InformationCardComponent? informationCardComponent,
PortfolioCardComponent? portfolioCardComponent,
QuoteCardComponent? quoteCardComponent,
SkillCardComponent? skillCardComponent,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfComponentThemeData.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfComponentThemeData.copyWith.fieldName(...)`
class _$ComponentThemeDataCWProxyImpl implements _$ComponentThemeDataCWProxy {
const _$ComponentThemeDataCWProxyImpl(this._value);
final ComponentThemeData _value;
@override
ComponentThemeData appBar(TopAppBarComponent? appBar) => this(appBar: appBar);
@override
ComponentThemeData topNavigationBarComponent(
TopNavigationBarComponent? topNavigationBarComponent) =>
this(topNavigationBarComponent: topNavigationBarComponent);
@override
ComponentThemeData bottomNavigationBar(
BottomNavigationBarComponent? bottomNavigationBar) =>
this(bottomNavigationBar: bottomNavigationBar);
@override
ComponentThemeData errorWidget(ErrorWidgetComponent? errorWidget) =>
this(errorWidget: errorWidget);
@override
ComponentThemeData loadingWidget(LoadingWidgetComponent? loadingWidget) =>
this(loadingWidget: loadingWidget);
@override
ComponentThemeData loaderComponent(LoaderComponent? loaderComponent) =>
this(loaderComponent: loaderComponent);
@override
ComponentThemeData richTextBuilderComponent(
RichTextBuilderComponent? richTextBuilderComponent) =>
this(richTextBuilderComponent: richTextBuilderComponent);
@override
ComponentThemeData textInputComponent(
TextInputComponent? textInputComponent) =>
this(textInputComponent: textInputComponent);
@override
ComponentThemeData fileSelectionButtonComponent(
FileSelectionButtonComponent? fileSelectionButtonComponent) =>
this(fileSelectionButtonComponent: fileSelectionButtonComponent);
@override
ComponentThemeData flatButtonComponent(
FlatButtonComponent? flatButtonComponent) =>
this(flatButtonComponent: flatButtonComponent);
@override
ComponentThemeData simpleIconButtonComponent(
SimpleIconButtonComponent? simpleIconButtonComponent) =>
this(simpleIconButtonComponent: simpleIconButtonComponent);
@override
ComponentThemeData symbolButtonComponent(
SymbolButtonComponent? symbolButtonComponent) =>
this(symbolButtonComponent: symbolButtonComponent);
@override
ComponentThemeData informationCardComponent(
InformationCardComponent? informationCardComponent) =>
this(informationCardComponent: informationCardComponent);
@override
ComponentThemeData portfolioCardComponent(
PortfolioCardComponent? portfolioCardComponent) =>
this(portfolioCardComponent: portfolioCardComponent);
@override
ComponentThemeData quoteCardComponent(
QuoteCardComponent? quoteCardComponent) =>
this(quoteCardComponent: quoteCardComponent);
@override
ComponentThemeData skillCardComponent(
SkillCardComponent? skillCardComponent) =>
this(skillCardComponent: skillCardComponent);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ComponentThemeData(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// ComponentThemeData(...).copyWith(id: 12, name: "My name")
/// ````
ComponentThemeData call({
Object? appBar = const $CopyWithPlaceholder(),
Object? topNavigationBarComponent = const $CopyWithPlaceholder(),
Object? bottomNavigationBar = const $CopyWithPlaceholder(),
Object? errorWidget = const $CopyWithPlaceholder(),
Object? loadingWidget = const $CopyWithPlaceholder(),
Object? loaderComponent = const $CopyWithPlaceholder(),
Object? richTextBuilderComponent = const $CopyWithPlaceholder(),
Object? textInputComponent = const $CopyWithPlaceholder(),
Object? fileSelectionButtonComponent = const $CopyWithPlaceholder(),
Object? flatButtonComponent = const $CopyWithPlaceholder(),
Object? simpleIconButtonComponent = const $CopyWithPlaceholder(),
Object? symbolButtonComponent = const $CopyWithPlaceholder(),
Object? informationCardComponent = const $CopyWithPlaceholder(),
Object? portfolioCardComponent = const $CopyWithPlaceholder(),
Object? quoteCardComponent = const $CopyWithPlaceholder(),
Object? skillCardComponent = const $CopyWithPlaceholder(),
}) {
return ComponentThemeData(
appBar: appBar == const $CopyWithPlaceholder()
? _value.appBar
// ignore: cast_nullable_to_non_nullable
: appBar as TopAppBarComponent?,
topNavigationBarComponent:
topNavigationBarComponent == const $CopyWithPlaceholder()
? _value.topNavigationBarComponent
// ignore: cast_nullable_to_non_nullable
: topNavigationBarComponent as TopNavigationBarComponent?,
bottomNavigationBar: bottomNavigationBar == const $CopyWithPlaceholder()
? _value.bottomNavigationBar
// ignore: cast_nullable_to_non_nullable
: bottomNavigationBar as BottomNavigationBarComponent?,
errorWidget: errorWidget == const $CopyWithPlaceholder()
? _value.errorWidget
// ignore: cast_nullable_to_non_nullable
: errorWidget as ErrorWidgetComponent?,
loadingWidget: loadingWidget == const $CopyWithPlaceholder()
? _value.loadingWidget
// ignore: cast_nullable_to_non_nullable
: loadingWidget as LoadingWidgetComponent?,
loaderComponent: loaderComponent == const $CopyWithPlaceholder()
? _value.loaderComponent
// ignore: cast_nullable_to_non_nullable
: loaderComponent as LoaderComponent?,
richTextBuilderComponent:
richTextBuilderComponent == const $CopyWithPlaceholder()
? _value.richTextBuilderComponent
// ignore: cast_nullable_to_non_nullable
: richTextBuilderComponent as RichTextBuilderComponent?,
textInputComponent: textInputComponent == const $CopyWithPlaceholder()
? _value.textInputComponent
// ignore: cast_nullable_to_non_nullable
: textInputComponent as TextInputComponent?,
fileSelectionButtonComponent:
fileSelectionButtonComponent == const $CopyWithPlaceholder()
? _value.fileSelectionButtonComponent
// ignore: cast_nullable_to_non_nullable
: fileSelectionButtonComponent as FileSelectionButtonComponent?,
flatButtonComponent: flatButtonComponent == const $CopyWithPlaceholder()
? _value.flatButtonComponent
// ignore: cast_nullable_to_non_nullable
: flatButtonComponent as FlatButtonComponent?,
simpleIconButtonComponent:
simpleIconButtonComponent == const $CopyWithPlaceholder()
? _value.simpleIconButtonComponent
// ignore: cast_nullable_to_non_nullable
: simpleIconButtonComponent as SimpleIconButtonComponent?,
symbolButtonComponent:
symbolButtonComponent == const $CopyWithPlaceholder()
? _value.symbolButtonComponent
// ignore: cast_nullable_to_non_nullable
: symbolButtonComponent as SymbolButtonComponent?,
informationCardComponent:
informationCardComponent == const $CopyWithPlaceholder()
? _value.informationCardComponent
// ignore: cast_nullable_to_non_nullable
: informationCardComponent as InformationCardComponent?,
portfolioCardComponent:
portfolioCardComponent == const $CopyWithPlaceholder()
? _value.portfolioCardComponent
// ignore: cast_nullable_to_non_nullable
: portfolioCardComponent as PortfolioCardComponent?,
quoteCardComponent: quoteCardComponent == const $CopyWithPlaceholder()
? _value.quoteCardComponent
// ignore: cast_nullable_to_non_nullable
: quoteCardComponent as QuoteCardComponent?,
skillCardComponent: skillCardComponent == const $CopyWithPlaceholder()
? _value.skillCardComponent
// ignore: cast_nullable_to_non_nullable
: skillCardComponent as SkillCardComponent?,
);
}
}
extension $ComponentThemeDataCopyWith on ComponentThemeData {
/// Returns a callable class that can be used as follows: `instanceOfComponentThemeData.copyWith(...)` or like so:`instanceOfComponentThemeData.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$ComponentThemeDataCWProxy get copyWith =>
_$ComponentThemeDataCWProxyImpl(this);
}
@@ -14,5 +14,5 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'component_theme_data.dart';
export 'component_theme.dart';
export 'component_theme_data.dart';
+13 -14
View File
@@ -3,29 +3,28 @@ 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
flutter: { sdk: flutter }
copy_with_extension: ^5.0.0
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:
sdk: flutter
flutter_test: { sdk: flutter }
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.0
build_runner: ^2.3.3
copy_with_extension_gen: ^5.0.0
wyatt_component_copy_with_gen:
git:
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
path: packages/wyatt_component_copy_with_gen
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.0
path: packages/wyatt_analysis
+7
View File
@@ -0,0 +1,7 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock
+24
View File
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 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 <https://www.gnu.org/licenses/>.
*/
{
"recommendations": [
"psioniq.psi-header",
"blaugold.melos-code"
]
}
+34
View File
@@ -0,0 +1,34 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Example",
"request": "launch",
"type": "dart",
"cwd": "example/",
"program": "lib/main.dart",
"flutterMode": "debug"
},
]
}

Some files were not shown because too many files have changed in this diff Show More