Compare commits

...
Author SHA1 Message Date
hugo 0592cf9a3c chore(release): publish packages �
continuous-integration/drone/pr Build is passing
2023-05-03 11:50:05 +02:00
hugo 0720a14532 feat(analysis): update version 2023-05-03 11:33:11 +02:00
hugo 33b38185b8 style(ui_components): reduce text size in example
continuous-integration/drone/pr Build is failing
2023-05-03 10:54:52 +02:00
hugo 4e3b288e70 fix(analysis): remove depencies sort
continuous-integration/drone/pr Build is passing
2023-05-03 10:48:06 +02:00
hugo 2692c60743 feat(analysis): upgrade
continuous-integration/drone/pr Build is failing
2023-05-03 10:38:18 +02:00
hugo e76857f118 feat(layout)!: update layout plugins with new components system
continuous-integration/drone/pr Build is failing
2023-05-02 13:32:52 +02:00
hugo 96369e24f9 feat(ui_components): make textwrapper toString useful 2023-05-02 13:32:20 +02:00
hugo 635bb329ea style(ui_components): fix theme resolver line
continuous-integration/drone/pr Build is failing
2023-04-28 18:42:13 +02:00
hugo bfbeabe7ec feat(ui): add pricing card
continuous-integration/drone/pr Build is failing
2023-04-28 18:40:40 +02:00
hugo 01a5619dc5 feat(ui): update default extension implementation
continuous-integration/drone/pr Build is failing
2023-04-28 16:08:10 +02:00
hugo 4ebb679a29 feat(ui): add animated decorated box + animate all buttons + customize duration in style 2023-04-28 15:33:26 +02:00
hugo abd5e1b558 feat(ui): add colors and rework ComponentThemeData
continuous-integration/drone/pr Build is failing
2023-04-28 14:04:55 +02:00
hugo a024b7e70a feat(ui_kit): update example by removing adaptative theme 2023-04-28 14:04:15 +02:00
hugo 4097a420c8 feat(ui)!: move last extensions + add extension provider
continuous-integration/drone/pr Build is failing
2023-04-27 20:28:08 +02:00
hugo 8f5e3923d6 feat(ui)!: rework theme resolver mechanism + move theme extension implementations
continuous-integration/drone/pr Build is failing
2023-04-27 16:55:10 +02:00
hugo 01269027f2 feat(ui): make components more coherent + docs 2023-04-27 16:54:16 +02:00
hugo 0d5109fc77 feat(ui): make gradient as component
continuous-integration/drone/pr Build is failing
2023-04-26 18:15:47 +02:00
hugo 3fb4020594 feat(ui): fix, rename, rewrite some helpers 2023-04-26 18:14:00 +02:00
hugo cef73aa62d fix(gen): rename builder correctly 2023-04-26 18:12:10 +02:00
hugo 32cc6e8288 feat(ui_kit): make flat button fade on transition 2023-04-18 11:47:56 +02:00
hugo 2baaf5c0bb feat(ui_kit): add more control over flat button prefix/suffix color 2023-04-18 09:33:00 +02:00
hugo 0ca4c41a27 build: fix and pin correct versions
continuous-integration/drone/pr Build is passing
2023-04-14 14:33:06 +02:00
hugo 5bf9f01be0 build: remove any pub git dependencies
continuous-integration/drone/pr Build is passing
2023-04-14 13:55:17 +02:00
hugo 90339d15a3 ci: fix latest melos config
continuous-integration/drone/pr Build is passing
2023-04-14 12:13:37 +02:00
hugo 9c9d6783c3 ci: use latest flutter-melos container
continuous-integration/drone/pr Build is failing
2023-04-14 11:09:04 +02:00
hugo 72173cdf18 ci: update melos tasks + upgrade melos 3
continuous-integration/drone/pr Build was killed
2023-04-14 10:16:00 +02:00
hugo 6725960c44 build: update pubignore
continuous-integration/drone/pr Build is passing
2023-04-14 10:04:23 +02:00
hugo 458ad76786 style: remove ignored files 2023-04-14 10:03:57 +02:00
hugo e9b6671500 build(ui_kit): change version constraint
continuous-integration/drone/pr Build is failing
2023-04-14 00:28:55 +02:00
273 changed files with 8762 additions and 3688 deletions
+6 -6
View File
@@ -20,18 +20,18 @@ name: default
steps:
- name: quality-check
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0-1
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:latest
commands:
- melos run quality-check
- melos run publish:validate
- name: publish
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0-1
commands:
- melos run publish:validate
# - name: publish
# image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0-1
# commands:
# - melos run publish:validate
#
trigger:
branch:
- master
event:
- push
- pull_request
+585
View File
@@ -1,5 +1,590 @@
### Android ###
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Log/OS Files
*.log
# Android Studio generated files and folders
captures/
.externalNativeBuild/
.cxx/
*.apk
output.json
# IntelliJ
*.iml
.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml
# Keystore files
*.jks
*.keystore
# Google Services (e.g. APIs or Firebase)
google-services.json
# Android Profiling
*.hprof
### Android Patch ###
gen-external-apklibs
# Replacement of .externalNativeBuild directories introduced
# with Android Studio 3.5.
### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
.dart_tool/
.packages
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
# dotenv environment variables file
.env*
# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
.flutter-plugins
.flutter-plugins-dependencies
### Dart Patch ###
# dotenv environment variables file
.env
### fastlane ###
# fastlane - A streamlined workflow tool for Cocoa deployment
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
# fastlane specific
**/fastlane/report.xml
# deliver temporary files
**/fastlane/Preview.html
# snapshot generated screenshots
**/fastlane/screenshots
# scan temporary files
**/fastlane/test_output
# Fastlane.swift runner binary
**/fastlane/FastlaneRunner
### Firebase ###
.idea
**/node_modules/*
**/.firebaserc
### Firebase Patch ###
.runtimeconfig.json
.firebase/
### Flutter ###
# Flutter/Dart/Pub related
**/doc/api/
.fvm/flutter_sdk
.pub-cache/
.pub/
coverage/
lib/generated_plugin_registrant.dart
# For library packages, don't commit the pubspec.lock file.
# Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies.
# See https://dart.dev/guides/libraries/private-files#pubspeclock
#pubspec.lock
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/key.properties
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
### Java ###
# Compiled class file
*.class
# Log file
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Kotlin ###
# Compiled class file
# Log file
# BlueJ files
# Mobile Tools for Java (J2ME)
# Package Files #
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Objective-C ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Obj-C/Swift specific
*.hmap
## App packaging
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build/
# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
### Objective-C Patch ###
### Swift ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm
.build/
# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
# Accio dependency management
Dependencies/
.accio/
# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Xcode ###
## Xcode 8 and earlier
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings
### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.
# Built application files
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
# Generated files
bin/
gen/
# Gradle files
.gradle
# Signing files
.signing/
# Local configuration file (sdk path, etc)
# Proguard folder generated by Eclipse
proguard/
# Log Files
# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
.navigation/
*.ipr
*~
*.swp
# Keystore files
# Google Services (e.g. APIs or Firebase)
# google-services.json
# Android Patch
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# NDK
obj/
# IntelliJ IDEA
/out/
# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/assetWizardSettings.xml
.idea/gradle.xml
.idea/jarRepositories.xml
.idea/navEditor.xml
# Legacy Eclipse project files
.classpath
.project
.cproject
.settings/
# Mobile Tools for Java (J2ME)
# Package Files #
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
## Plugin-specific files:
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Mongo Explorer plugin
.idea/mongoSettings.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
### AndroidStudio Patch ###
!/gradle/wrapper/gradle-wrapper.jar
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,android,androidstudio,dart,fastlane,firebase,flutter,java,jetbrains+all,kotlin,objective-c,swift,xcode
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
.idea/
*.iml
google-services.json
pubspec_overrides.yaml
# Mason
.mason/
new_version.sh
.latest_version
.vscode/
example/
models/
build/
*.iml
+74
View File
@@ -3,6 +3,80 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2023-05-03
### Changes
---
Packages with breaking changes:
- [`wyatt_bloc_layout` - `v0.1.0`](#wyatt_bloc_layout---v010)
- [`wyatt_ui_components` - `v0.2.0`](#wyatt_ui_components---v020)
- [`wyatt_ui_kit` - `v3.0.0`](#wyatt_ui_kit---v300)
- [`wyatt_ui_layout` - `v0.1.0`](#wyatt_ui_layout---v010)
Packages with other changes:
- [`wyatt_analysis` - `v2.5.0`](#wyatt_analysis---v250)
- [`wyatt_component_copy_with_extension` - `v2.0.1`](#wyatt_component_copy_with_extension---v201)
- [`wyatt_component_copy_with_gen` - `v2.0.1`](#wyatt_component_copy_with_gen---v201)
---
#### `wyatt_bloc_layout` - `v0.1.0`
- **BREAKING** **FEAT**(layout): update layout plugins with new components system. (e76857f1)
#### `wyatt_ui_components` - `v0.2.0`
- **FIX**(gen): rename builder correctly. (cef73aa6)
- **FEAT**(ui_components): make textwrapper toString useful. (96369e24)
- **FEAT**(ui): add pricing card. (bfbeabe7)
- **FEAT**(ui): update default extension implementation. (01a5619d)
- **FEAT**(ui): add animated decorated box + animate all buttons + customize duration in style. (4ebb679a)
- **FEAT**(ui): add colors and rework ComponentThemeData. (abd5e1b5)
- **FEAT**(ui): make components more coherent + docs. (01269027)
- **FEAT**(ui): make gradient as component. (0d5109fc)
- **FEAT**(ui): fix, rename, rewrite some helpers. (3fb40205)
- **BREAKING** **FEAT**(ui): move last extensions + add extension provider. (4097a420)
- **BREAKING** **FEAT**(ui): rework theme resolver mechanism + move theme extension implementations. (8f5e3923)
#### `wyatt_ui_kit` - `v3.0.0`
- **FIX**(gen): rename builder correctly. (cef73aa6)
- **FEAT**(ui): add pricing card. (bfbeabe7)
- **FEAT**(ui): update default extension implementation. (01a5619d)
- **FEAT**(ui): add animated decorated box + animate all buttons + customize duration in style. (4ebb679a)
- **FEAT**(ui): add colors and rework ComponentThemeData. (abd5e1b5)
- **FEAT**(ui_kit): update example by removing adaptative theme. (a024b7e7)
- **FEAT**(ui): make components more coherent + docs. (01269027)
- **FEAT**(ui): make gradient as component. (0d5109fc)
- **FEAT**(ui): fix, rename, rewrite some helpers. (3fb40205)
- **FEAT**(ui_kit): make flat button fade on transition. (32cc6e82)
- **FEAT**(ui_kit): add more control over flat button prefix/suffix color. (2baaf5c0)
- **BREAKING** **FEAT**(ui): move last extensions + add extension provider. (4097a420)
- **BREAKING** **FEAT**(ui): rework theme resolver mechanism + move theme extension implementations. (8f5e3923)
#### `wyatt_ui_layout` - `v0.1.0`
- **BREAKING** **FEAT**(layout): update layout plugins with new components system. (e76857f1)
#### `wyatt_analysis` - `v2.5.0`
- **FIX**(analysis): remove depencies sort. (4e3b288e)
- **FEAT**(analysis): update version. (0720a145)
- **FEAT**(analysis): upgrade. (2692c607)
#### `wyatt_component_copy_with_extension` - `v2.0.1`
- **FIX**(gen): rename builder correctly. (cef73aa6)
#### `wyatt_component_copy_with_gen` - `v2.0.1`
- **FIX**(gen): rename builder correctly. (cef73aa6)
## 2023-04-14
### Changes
+2 -13
View File
@@ -270,25 +270,14 @@ or
You can add any package of the `packages/` sub directory in your project.
```yaml
dependencies:
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.1
path: packages/wyatt_analysis
```
or the hosted version :
```yaml
dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: 2.4.1
version: ^2.4.1
```
Here you can change `package name` and `package version` .
> You can also use the `git` protocol. But it's not recommended since it's not handle version constraints.
---
+57 -33
View File
@@ -1,65 +1,86 @@
name: Wyatt-Packages
#repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages Gitea not yet supported
sdkPath: auto
packages:
- packages/**
command:
bootstrap:
usePubspecOverrides: true
ide:
intellij:
enabled: false
command:
version:
updateGitTagRefs: true
linkToCommits: false # Gitea not yet supported
workspaceChangelog: true
includeCommitId: true
branch: master
message: |
chore(release): publish packages 🎉
{new_package_versions}
clean:
hooks:
post: melos exec --flutter --concurrency=3 -- "flutter clean"
scripts:
analyze:
run: |
melos exec --flutter --concurrency=1 -- flutter analyze --fatal-infos
description: Run `flutter analyze` for all flutter packages.
fix:apply:
run: melos exec --concurrency=1 -- dart fix . --apply
description: Run and apply `dart fix` for all packages.
fix:check:
run: melos exec --concurrency=1 -- dart fix . --set-exit-if-changed
description: Run `dart fix` checks for all packages.
format:
run: melos exec --concurrency=1 -- dart format .
description: Run `dart format` for all packages.
lint:all:
run: melos run analyze && melos run format
description: Run all static analysis checks.
analyze:
run: |
melos exec -c 1 -- flutter analyze --fatal-infos
description: Run `flutter analyze` for all packages.
fix:
run: melos exec dart fix . --apply
description: Run `dart fix` for all packages.
format:
run: melos exec dart format .
description: Run `dart format` for all packages.
format-check:
run: melos exec dart fix . --set-exit-if-changed
description: Run `dart fix` checks for all packages.
clean:deep:
run: git clean -x -d -f -q
description: Clean things very deeply with `git clean`.
test:selective_unit_test:
run: melos exec -- flutter test --no-pub --coverage
run: melos exec --concurrency=1 -- flutter test --no-pub --coverage
description: Run Flutter tests for a specific package in this project.
select-package:
dir-exists:
packageFilters:
dirExists:
- test
ignore:
- '*example*'
- "*example*"
test:all:
run: melos run test:selective_unit_test --no-select
description: Run all Flutter tests in this project.
gen-coverage: melos exec -- sh "\$MELOS_ROOT_PATH/combine_coverage.sh" && genhtml coverage/lcov.info -o coverage/html
gen:coverage:
run: |
melos exec --concurrency=1 -- sh "\$MELOS_ROOT_PATH/combine_coverage.sh" && \
genhtml coverage/lcov.info -o coverage/html
description: |
Generate coverage report for all packages.
Requires `lcov` and `genhtml`.
gen-class-models:
run: melos exec -- dart pub global run dcdg -o models/class-models.puml
select-package:
gen:class_models:
run: melos exec --concurrency=1 -- dart pub global run dcdg -o models/class-models.puml
description: |
Generate class models for all packages.
Requires `dcdg`. (https://pub.dev/packages/dcdg)
packageFilters:
ignore:
- '*example*'
- "*example*"
quality-check:
run: |
@@ -70,13 +91,16 @@ scripts:
publish:validate:
run: melos publish --diff="origin/$DRONE_COMMIT_BRANCH...HEAD" --yes
description: |
Validate that all packages are ready to be published.
Requires DRONE_COMMIT_BRANCH to be set.
Note: This will not actually publish anything.
publish:validate-local:
run: melos publish --yes
description: |
Validate that all packages are ready to be published.
Note: This will not actually publish anything.
# publish:
# run: melos publish --diff="origin/$DRONE_COMMIT_BRANCH...HEAD" --no-dry-run --yes
# Additional cleanup lifecycle script, executed when `melos clean` is run.
postclean: >
melos exec -c 6 -- "flutter clean"
+1 -1
View File
@@ -1 +1 @@
2.4.1
2.5.0
+6
View File
@@ -1,3 +1,9 @@
## 2.5.0
- **FIX**(analysis): remove depencies sort. (4e3b288e)
- **FEAT**(analysis): update version. (0720a145)
- **FEAT**(analysis): upgrade. (2692c607)
## 2.4.2
- **REFACTOR**: remove cross package export.
+5 -5
View File
@@ -20,7 +20,7 @@
![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 Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.1.yaml**.
This package provides lint rules for Dart and Flutter which are used at [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.5.0.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).
@@ -29,7 +29,7 @@ This package provides lint rules for Dart and Flutter which are used at [Wyatt
Using CLI:
```sh
dart pub add wyatt_analysis:2.4.1 --dev --hosted-url=https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
dart pub add wyatt_analysis:2.5.0 --dev --hosted-url=https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
```
## Usage
@@ -39,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.1
version: 2.5.0
```
Then, add an include in `analysis_options.yaml` :
@@ -57,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.1.yaml
include: package:wyatt_analysis/analysis_options.flutter.2.5.0.yaml
```
If you just want **Dart** version:
```yaml
include: package:wyatt_analysis/analysis_options.2.4.1.yaml
include: package:wyatt_analysis/analysis_options.2.5.0.yaml
```
## Suppressing Lints
@@ -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,218 @@
# 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
- dangling_library_doc_comments
- 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,218 @@
# 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
- dangling_library_doc_comments
- 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.2.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
@@ -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.3.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
@@ -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.5.0.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
@@ -1,3 +1,4 @@
# Copyright (C) 2023 WYATT GROUP
# Please see the AUTHORS file for details.
#
@@ -14,4 +15,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/>.
include: package:wyatt_analysis/analysis_options.flutter.2.4.1.yaml
include: package:wyatt_analysis/analysis_options.flutter.2.5.0.yaml
@@ -1,3 +1,4 @@
# Copyright (C) 2023 WYATT GROUP
# Please see the AUTHORS file for details.
#
@@ -14,4 +15,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/>.
include: package:wyatt_analysis/analysis_options.2.4.1.yaml
include: package:wyatt_analysis/analysis_options.2.5.0.yaml
@@ -18,4 +18,4 @@
/// used internally at [Wyatt Studio](https://wyatt-studio.fr).
library wyatt_analysis;
const String wyattAnalysisVersion = '2.4.1';
const String wyattAnalysisVersion = '2.5.0';
+1 -1
View File
@@ -17,7 +17,7 @@
name: wyatt_analysis
description: Lint rules for Dart and Flutter used internally at Wyatt Studio.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis
version: 2.4.2
version: 2.5.0
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -27,48 +27,41 @@ environment:
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
flutter: { sdk: flutter }
flutter_bloc: ^8.1.1
wyatt_architecture:
path: "../"
wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.5
wyatt_http_client:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_http_client-v2.0.0
path: packages/wyatt_http_client
flutter_bloc: ^8.1.1
get_it: ^7.2.0
hive: ^2.2.3
hive_flutter: ^1.1.0
wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1
equatable: ^2.0.5
stream_transform: ^2.1.0
bloc_concurrency: ^0.2.0
freezed_annotation: ^2.2.0
json_annotation: ^4.7.0
wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1
wyatt_http_client:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.0
wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.5
dev_dependencies:
build_runner: ^2.3.2
flutter_test:
sdk: flutter
flutter_test: { sdk: flutter }
freezed: ^2.2.1
hive_generator: ^2.0.0
json_serializable: ^6.5.4
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.2
path: packages/wyatt_analysis
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.5.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
+1 -1
View File
@@ -32,4 +32,4 @@ dependencies:
dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,5 +0,0 @@
{
"projects": {
"default": "tchat-beta"
}
}
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -39,4 +39,4 @@ dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.4.2
version: ^2.5.0
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
+1 -1
View File
@@ -20,4 +20,4 @@ dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
+6
View File
@@ -1,3 +1,9 @@
## 0.1.0
> Note: This release has breaking changes.
- **BREAKING** **FEAT**(layout): update layout plugins with new components system. (e76857f1)
## 0.0.2
- **REFACTOR**: remove cross package export.
@@ -88,6 +88,7 @@ class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
Key? key,
}) =>
CustomAppBar(
key: key ?? _value.key,
title: title ?? _value.title,
);
}
@@ -24,7 +24,9 @@ class $CustomBottomBarCWProxyImpl
int? currentIndex,
Key? key,
}) =>
CustomBottomBar();
CustomBottomBar(
key: key ?? _value.key,
);
}
mixin $CustomBottomBarCWMixin on Component {
@@ -5,13 +5,12 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_error_widget.g.dart';
@ComponentCopyWithExtension()
class CustomErrorWidget extends ErrorWidgetComponent
with $CustomErrorWidgetCWMixin {
CustomErrorWidget({super.key, super.error});
class CustomErrorWidget extends ErrorComponent with $CustomErrorWidgetCWMixin {
const CustomErrorWidget({super.key, super.details});
@override
Widget build(BuildContext context) => ColoredBox(
color: Colors.red,
child: Center(child: Text(error?.data ?? 'Error')),
child: Center(child: Text(details?.data ?? 'Error')),
);
}
@@ -6,24 +6,36 @@ part of 'custom_error_widget.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomErrorWidgetCWProxyImpl implements $ErrorWidgetComponentCWProxy {
class $CustomErrorWidgetCWProxyImpl implements $ErrorComponentCWProxy {
const $CustomErrorWidgetCWProxyImpl(this._value);
final CustomErrorWidget _value;
@override
CustomErrorWidget error(TextWrapper? error) => this(error: error);
CustomErrorWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomErrorWidget message(TextWrapper? message) => this(message: message);
@override
CustomErrorWidget details(TextWrapper? details) => this(details: details);
@override
CustomErrorWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomErrorWidget key(Key? key) => this(key: key);
@override
CustomErrorWidget call({
TextWrapper? error,
MultiColor? colors,
TextWrapper? message,
TextWrapper? details,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomErrorWidget(
error: error ?? _value.error,
key: key ?? _value.key,
details: details ?? _value.details,
);
}
mixin $CustomErrorWidgetCWMixin on Component {
$ErrorWidgetComponentCWProxy get copyWith =>
$ErrorComponentCWProxy get copyWith =>
$CustomErrorWidgetCWProxyImpl(this as CustomErrorWidget);
}
@@ -5,11 +5,14 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_loading_widget.g.dart';
@ComponentCopyWithExtension()
class CustomLoadingWidget extends LoadingWidgetComponent
class CustomLoadingWidget extends LoaderComponent
with $CustomLoadingWidgetCWMixin {
CustomLoadingWidget({super.key, super.color});
const CustomLoadingWidget({super.key, super.colors});
@override
Widget build(BuildContext context) =>
Center(child: CircularProgressIndicator(color: color));
Widget build(BuildContext context) => Center(
child: CircularProgressIndicator(
color: (colors?.isColor ?? false) ? colors!.color : Colors.blue,
),
);
}
@@ -6,25 +6,42 @@ part of 'custom_loading_widget.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomLoadingWidgetCWProxyImpl
implements $LoadingWidgetComponentCWProxy {
class $CustomLoadingWidgetCWProxyImpl implements $LoaderComponentCWProxy {
const $CustomLoadingWidgetCWProxyImpl(this._value);
final CustomLoadingWidget _value;
@override
CustomLoadingWidget color(Color? color) => this(color: color);
CustomLoadingWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomLoadingWidget radius(double? radius) => this(radius: radius);
@override
CustomLoadingWidget stroke(double? stroke) => this(stroke: stroke);
@override
CustomLoadingWidget duration(Duration? duration) => this(duration: duration);
@override
CustomLoadingWidget flip(bool? flip) => this(flip: flip);
@override
CustomLoadingWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomLoadingWidget key(Key? key) => this(key: key);
@override
CustomLoadingWidget call({
Color? color,
MultiColor? colors,
double? radius,
double? stroke,
Duration? duration,
bool? flip,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomLoadingWidget(
color: color ?? _value.color,
key: key ?? _value.key,
colors: colors ?? _value.colors,
);
}
mixin $CustomLoadingWidgetCWMixin on Component {
$LoadingWidgetComponentCWProxy get copyWith =>
$LoaderComponentCWProxy get copyWith =>
$CustomLoadingWidgetCWProxyImpl(this as CustomLoadingWidget);
}
@@ -4,11 +4,11 @@ import 'package:bloc_layout_example/components/custom_error_widget.dart';
import 'package:bloc_layout_example/components/custom_loading_widget.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
class AppThemeComponent {
static ComponentThemeData get components => ComponentThemeData.raw(
appBar: const CustomAppBar(),
bottomNavigationBar: const CustomBottomBar(),
loadingWidget: CustomLoadingWidget(),
errorWidget: CustomErrorWidget(),
);
abstract class AppThemeComponent {
static const ComponentThemeData components = ComponentThemeData.raw(
topAppBar: CustomAppBar(),
bottomNavigationBar: CustomBottomBar(),
loader: CustomLoadingWidget(),
error: CustomErrorWidget(),
);
}
@@ -32,7 +32,7 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
data: AppThemeComponent.components,
child: MaterialApp(
title: 'Bloc Layout Example',
theme: ThemeData(
@@ -122,7 +122,7 @@ class ExampleFrameLayoutCrudConsumer
ExampleFrameLayoutCrudConsumer({super.key})
: super(
customAppBar: (bar) => bar?.copyWith.title(
'Example Title'.wrap(),
const TextWrapper('Example Title'),
),
);
@@ -139,7 +139,7 @@ class ExampleFrameLayoutCrudListConsumer
ExampleFrameLayoutCrudListConsumer({super.key})
: super(
customAppBar: (bar) => bar?.copyWith.title(
'Example Title'.wrap(),
const TextWrapper('Example Title'),
),
);
+13 -24
View File
@@ -27,50 +27,39 @@ environment:
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^8.1.2
flutter: { sdk: flutter }
wyatt_bloc_layout:
path: "../"
flutter_bloc: ^8.1.2
wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
wyatt_ui_layout:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.2
version: ^0.1.0
wyatt_crud_bloc:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.1.1
wyatt_ui_components:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.1.0
version: ^0.2.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
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_test: { sdk: flutter }
build_runner: ^2.3.3
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_component_copy_with_gen:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.2
path: packages/wyatt_analysis
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
@@ -23,11 +23,12 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
mixin CrudMixin<Cubit extends bloc_base.Cubit<dynamic>,
SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorWidget?.copyWith(error: state.message.wrap()) ??
const SizedBox.shrink();
context.components.errorComponent.call(
message: (state.message != null) ? TextWrapper(state.message!) : null,
);
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
context.components.loadingWidget ?? const SizedBox.shrink();
context.components.loader ?? const SizedBox.shrink();
Widget initialBuilder(BuildContext context, CrudInitial state) =>
const SizedBox.shrink();
+4 -4
View File
@@ -1,7 +1,7 @@
name: wyatt_bloc_layout
description: Layouts based on bloc helper library
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_layout
version: 0.0.2
version: 0.1.0
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -19,7 +19,7 @@ dependencies:
wyatt_ui_layout:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.2
version: ^0.1.0
wyatt_crud_bloc:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -27,11 +27,11 @@ dependencies:
wyatt_ui_components:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.1.0
version: ^0.2.0
dev_dependencies:
flutter_test: { sdk: flutter }
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,3 +1,7 @@
## 2.0.1
- **FIX**(gen): rename builder correctly. (cef73aa6)
## 2.0.0
> Note: This release has breaking changes.
@@ -20,7 +20,7 @@ dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
# The following section is specific to Flutter.
flutter:
@@ -15,7 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// Extension for component copy with feature
library component_copy_with_extension;
library wyatt_component_copy_with_extension;
export './src/domain/domain.dart';
export 'src/component_copy_with_extension.dart';
@@ -1,7 +1,7 @@
name: wyatt_component_copy_with_extension
description: Extension for component copy with feature.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/component_copy_with_extension
version: 2.0.0
version: 2.0.1
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -14,4 +14,4 @@ dependencies:
dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,3 +1,7 @@
## 2.0.1
- **FIX**(gen): rename builder correctly. (cef73aa6)
## 2.0.0
> Note: This release has breaking changes.
@@ -1,7 +1,7 @@
targets:
$default:
builders:
component_copy_with_gen:
wyatt_component_copy_with_gen:
enabled: true
generate_for:
exclude:
@@ -11,9 +11,9 @@ targets:
- test/gen_*
builders:
component_copy_with_gen:
target: ":component_copy_with_gen"
import: "package:wyatt_component_copy_with_gen/component_copy_with_gen.dart"
wyatt_component_copy_with_gen:
target: ":wyatt_component_copy_with_gen"
import: "package:wyatt_component_copy_with_gen/wyatt_component_copy_with_gen.dart"
builder_factories: ["componentCopyWithReporter"]
build_extensions: { ".dart": ["copy_with_extension_gen.g.part"] }
auto_apply: dependents
@@ -8,21 +8,22 @@ environment:
sdk: ">=2.19.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter: { sdk: flutter }
wyatt_component_copy_with_extension:
path: "../../wyatt_component_copy_with_extension"
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
wyatt_ui_components:
git:
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
path: packages/wyatt_ui_components
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.2.0
dev_dependencies:
build_runner: ^2.3.3
wyatt_component_copy_with_gen:
path: "../"
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -15,7 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// Generator for copywith method for components
library component_copy_with_gen;
library wyatt_component_copy_with_gen;
export 'src/builder.dart';
export 'src/generators/component_copy_with_generator.dart';
@@ -1,7 +1,7 @@
name: wyatt_component_copy_with_gen
description: Generator for copywith method for components.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/component_copy_with_gen
version: 2.0.0
version: 2.0.1
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -15,11 +15,11 @@ dependencies:
wyatt_component_copy_with_extension:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.0
version: ^2.0.1
dev_dependencies:
test: ^1.21.0
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,91 +0,0 @@
{
"project_info": {
"project_number": "136771801992",
"firebase_url": "https://tchat-beta.firebaseio.com",
"project_id": "tchat-beta",
"storage_bucket": "tchat-beta.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:136771801992:android:4ff419f07afdad6097203d",
"android_client_info": {
"package_name": "com.example.authentication_bloc_example"
}
},
"oauth_client": [
{
"client_id": "136771801992-nps7ic22shstvgdv0c2ojvbkj3dkntum.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.authentication_bloc_example",
"certificate_hash": "5d8790309e13b68c35e5d4d8437c35c6d15e6131"
}
},
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.example"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:136771801992:android:8482c9b90bc29de697203d",
"android_client_info": {
"package_name": "com.example.crud_bloc_example"
}
},
"oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.example"
}
}
]
}
}
}
],
"configuration_version": "1"
}
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
+1 -1
View File
@@ -29,4 +29,4 @@ dev_dependencies:
bloc_test: ^9.1.0
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
+1 -1
View File
@@ -30,4 +30,4 @@ dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.4.2
version: ^2.5.0
+1 -1
View File
@@ -15,4 +15,4 @@ dependencies:
dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
+1 -1
View File
@@ -13,7 +13,7 @@ dev_dependencies:
flutter_test: { sdk: flutter }
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
# The following section is specific to Flutter.
flutter:
uses-material-design: true
+1 -1
View File
@@ -40,4 +40,4 @@ dev_dependencies:
dart_code_metrics: ^5.5.1
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -1,10 +1,12 @@
name: wyatt_notification_bloc
description: A starting point for Dart libraries or applications.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_notification_bloc
version: 1.0.0
# homepage: https://www.example.com
publish_to: none
environment:
sdk: '>=2.18.2 <3.0.0'
sdk: ">=2.18.2 <3.0.0"
# dependencies:
# path: ^1.8.0
@@ -34,10 +34,5 @@ dependencies:
dev_dependencies:
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.2
path: packages/wyatt_analysis
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0
+1 -1
View File
@@ -13,4 +13,4 @@ dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.2
version: ^2.5.0
+16
View File
@@ -1,3 +1,19 @@
## 0.2.0
> Note: This release has breaking changes.
- **FIX**(gen): rename builder correctly. (cef73aa6)
- **FEAT**(ui_components): make textwrapper toString useful. (96369e24)
- **FEAT**(ui): add pricing card. (bfbeabe7)
- **FEAT**(ui): update default extension implementation. (01a5619d)
- **FEAT**(ui): add animated decorated box + animate all buttons + customize duration in style. (4ebb679a)
- **FEAT**(ui): add colors and rework ComponentThemeData. (abd5e1b5)
- **FEAT**(ui): make components more coherent + docs. (01269027)
- **FEAT**(ui): make gradient as component. (0d5109fc)
- **FEAT**(ui): fix, rename, rewrite some helpers. (3fb40205)
- **BREAKING** **FEAT**(ui): move last extensions + add extension provider. (4097a420)
- **BREAKING** **FEAT**(ui): rework theme resolver mechanism + move theme extension implementations. (8f5e3923)
## 0.1.0
> Note: This release has breaking changes.
+6
View File
@@ -99,6 +99,12 @@ If you need specific settings, or pass parameters to your component, call `copyW
)
```
## Default implementation
To use this package, you have to create your own implementation of the components. You can check out [Wyatt UI Kit](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_ui_kit) package for an example.
But default theme extensions (used in all implementations as fallback for styles) are available in `lib/src/domain/theme_extensions` folder.
## Development
> Common to this, and Wyatt UI Kit packages.
+1 -1
View File
@@ -2,7 +2,7 @@ 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:
wyatt_component_copy_with_gen:wyatt_component_copy_with_gen:
generate_for:
# Example glob for only the Dart files under `lib/models`
- lib/**/*.dart
@@ -2,13 +2,13 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_components_example/components/custom_app_bar.dart';
import 'package:wyatt_ui_components_example/components/custom_bottom_bar.dart';
import 'package:wyatt_ui_components_example/components/custom_error_widget.dart';
import 'package:wyatt_ui_components_example/components/custom_loading_widget.dart';
import 'package:wyatt_ui_components_example/components/custom_loader_widget.dart';
class AppThemeComponent {
static ComponentThemeData get components => const ComponentThemeData.raw(
appBar: CustomAppBar(),
topAppBar: CustomAppBar(),
bottomNavigationBar: CustomBottomNavigationBar(),
errorWidget: CustomErrorWidget(),
loadingWidget: CustomLoadingWidget(),
error: CustomErrorWidget(),
loader: CustomLoaderWidget(),
);
}
@@ -5,13 +5,17 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_error_widget.g.dart';
@ComponentCopyWithExtension()
class CustomErrorWidget extends ErrorWidgetComponent
with $CustomErrorWidgetCWMixin {
const CustomErrorWidget({super.error, super.key});
class CustomErrorWidget extends ErrorComponent with $CustomErrorWidgetCWMixin {
const CustomErrorWidget({
super.colors,
super.message,
super.details,
super.key,
});
@override
Widget build(BuildContext context) => ColoredBox(
color: Colors.red,
child: Center(child: Text(error?.data ?? 'Error')),
color: colors?.color ?? Colors.red,
child: Center(child: Text(message?.data ?? 'Error')),
);
}
@@ -6,25 +6,38 @@ part of 'custom_error_widget.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomErrorWidgetCWProxyImpl implements $ErrorWidgetComponentCWProxy {
class $CustomErrorWidgetCWProxyImpl implements $ErrorComponentCWProxy {
const $CustomErrorWidgetCWProxyImpl(this._value);
final CustomErrorWidget _value;
@override
CustomErrorWidget error(TextWrapper? error) => this(error: error);
CustomErrorWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomErrorWidget message(TextWrapper? message) => this(message: message);
@override
CustomErrorWidget details(TextWrapper? details) => this(details: details);
@override
CustomErrorWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomErrorWidget key(Key? key) => this(key: key);
@override
CustomErrorWidget call({
TextWrapper? error,
MultiColor? colors,
TextWrapper? message,
TextWrapper? details,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomErrorWidget(
error: error ?? _value.error,
colors: colors ?? _value.colors,
message: message ?? _value.message,
details: details ?? _value.details,
key: key ?? _value.key,
);
}
mixin $CustomErrorWidgetCWMixin on Component {
$ErrorWidgetComponentCWProxy get copyWith =>
$ErrorComponentCWProxy get copyWith =>
$CustomErrorWidgetCWProxyImpl(this as CustomErrorWidget);
}
@@ -2,17 +2,24 @@ import 'package:flutter/material.dart';
import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_loading_widget.g.dart';
part 'custom_loader_widget.g.dart';
@ComponentCopyWithExtension()
class CustomLoadingWidget extends LoadingWidgetComponent
with $CustomLoadingWidgetCWMixin {
const CustomLoadingWidget({super.color, super.key});
class CustomLoaderWidget extends LoaderComponent
with $CustomLoaderWidgetCWMixin {
const CustomLoaderWidget({
super.colors,
super.duration,
super.flip,
super.radius,
super.stroke,
super.key,
});
@override
Widget build(BuildContext context) => Center(
child: CircularProgressIndicator(
color: color,
color: colors?.color ?? Colors.blue,
),
);
}
@@ -0,0 +1,51 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_loader_widget.dart';
// **************************************************************************
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomLoaderWidgetCWProxyImpl implements $LoaderComponentCWProxy {
const $CustomLoaderWidgetCWProxyImpl(this._value);
final CustomLoaderWidget _value;
@override
CustomLoaderWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomLoaderWidget radius(double? radius) => this(radius: radius);
@override
CustomLoaderWidget stroke(double? stroke) => this(stroke: stroke);
@override
CustomLoaderWidget duration(Duration? duration) => this(duration: duration);
@override
CustomLoaderWidget flip(bool? flip) => this(flip: flip);
@override
CustomLoaderWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomLoaderWidget key(Key? key) => this(key: key);
@override
CustomLoaderWidget call({
MultiColor? colors,
double? radius,
double? stroke,
Duration? duration,
bool? flip,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomLoaderWidget(
colors: colors ?? _value.colors,
duration: duration ?? _value.duration,
flip: flip ?? _value.flip,
radius: radius ?? _value.radius,
stroke: stroke ?? _value.stroke,
key: key ?? _value.key,
);
}
mixin $CustomLoaderWidgetCWMixin on Component {
$LoaderComponentCWProxy get copyWith =>
$CustomLoaderWidgetCWProxyImpl(this as CustomLoaderWidget);
}
@@ -1,31 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_loading_widget.dart';
// **************************************************************************
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomLoadingWidgetCWProxyImpl
implements $LoadingWidgetComponentCWProxy {
const $CustomLoadingWidgetCWProxyImpl(this._value);
final CustomLoadingWidget _value;
@override
CustomLoadingWidget color(Color? color) => this(color: color);
@override
CustomLoadingWidget key(Key? key) => this(key: key);
@override
CustomLoadingWidget call({
Color? color,
Key? key,
}) =>
CustomLoadingWidget(
color: color ?? _value.color,
key: key ?? _value.key,
);
}
mixin $CustomLoadingWidgetCWMixin on Component {
$LoadingWidgetComponentCWProxy get copyWith =>
$CustomLoadingWidgetCWProxyImpl(this as CustomLoadingWidget);
}
@@ -28,7 +28,7 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
data: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Components Example',
theme: ThemeData(
@@ -48,24 +48,23 @@ class Home extends StatelessWidget {
Widget build(BuildContext context) => Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: context.components.appBar?.copyWith
.title('Example title'.wrap()) ??
const SizedBox.shrink(),
child: context.components.topAppBarComponent
.title(const TextWrapper('Example title')),
),
body: Column(
children: [
Expanded(
child: context.components.errorWidget
?.copyWith(error: 'Example erreur'.wrap()) ??
const SizedBox.shrink(),
child: context.components.errorComponent.call(
message: const TextWrapper('Example error'),
),
),
const SizedBox(
height: 10,
),
Expanded(
child: context.components.loadingWidget
?.copyWith(color: Colors.green) ??
const SizedBox.shrink(),
child: context.components.loaderComponent.call(
colors: const MultiColor.single(Colors.green),
),
),
],
),
@@ -27,32 +27,26 @@ environment:
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
flutter: { sdk: flutter }
wyatt_ui_components:
path: "../"
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
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_test: { sdk: flutter }
build_runner: ^2.3.3
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
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.2
path: packages/wyatt_analysis
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
@@ -16,6 +16,5 @@
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';
@@ -17,10 +17,22 @@
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
class LinearGradientHelper {
static LinearGradient? fromNullableColors(List<Color>? colors) =>
abstract class GradientHelper {
static LinearGradient? linearFromNullableColors(List<Color>? colors) =>
colors != null ? LinearGradient(colors: colors) : null;
static LinearGradient? fromMultiColor(MultiColor multiColor) =>
static LinearGradient? linearFromMultiColor(MultiColor multiColor) =>
multiColor.isGradient ? LinearGradient(colors: multiColor.colors) : null;
static RadialGradient? radialFromNullableColors(List<Color>? colors) =>
colors != null ? RadialGradient(colors: colors) : null;
static RadialGradient? radialFromMultiColor(MultiColor multiColor) =>
multiColor.isGradient ? RadialGradient(colors: multiColor.colors) : null;
static SweepGradient? sweepFromNullableColors(List<Color>? colors) =>
colors != null ? SweepGradient(colors: colors) : null;
static SweepGradient? sweepFromMultiColor(MultiColor multiColor) =>
multiColor.isGradient ? SweepGradient(colors: multiColor.colors) : null;
}
@@ -36,15 +36,28 @@ class TextWrapper {
});
/// Creates a [TextWrapper] from a [Text] widget.
const TextWrapper.text(this.data)
: style = null,
TextWrapper.text(Text text)
: data = text.data!,
style = text.style,
gradientColors = null,
textAlign = null,
textDirection = null,
softWrap = null,
overflow = null,
maxLines = null,
selectionColor = null;
textAlign = text.textAlign,
textDirection = text.textDirection,
softWrap = text.softWrap,
overflow = text.overflow,
maxLines = text.maxLines,
selectionColor = text.selectionColor;
/// Creates a [TextWrapper] from a [RichText] widget.
TextWrapper.rich(RichText richText)
: data = richText.text.toPlainText(),
style = richText.text.style,
gradientColors = null,
textAlign = richText.textAlign,
textDirection = richText.textDirection,
softWrap = richText.softWrap,
overflow = richText.overflow,
maxLines = richText.maxLines,
selectionColor = richText.selectionColor;
/// Text to be displayed
final String data;
@@ -108,4 +121,7 @@ class TextWrapper {
/// that, the selection color defaults to [DefaultSelectionStyle.defaultColor]
/// (semi-transparent grey).
final Color? selectionColor;
@override
String toString() => data;
}
@@ -14,35 +14,84 @@
// 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';
/// A helper class for getting theme elements.
abstract class ThemeHelper {
/// Gets a theme element from a list of styles.
/// Gets a nullable theme element from a list of styles.
/// {@template getElement}
/// 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>(
/// - [styles] : A list of styles that need to be checked.
///
/// - [transform] : An optional function that transforms each style element
/// to a [T] type after it passes the [valueValidator]. *(default: returns
/// element as is)*
///
/// - [valueValidator] : An optional validation function that
/// determines if a style element is valid. *(default: checks if element
/// is not null)*
///
/// - [combine] : A function that combines two [P] type objects to create
/// a new object. *(default: returns the first element)*
///
/// So, if you only pass a [styles] list, the first valid style element
/// will be returned as is.
/// If you pass a [transform] function, the first valid style element
/// will be transformed to a [T] type.
/// {@endtemplate}
static T? maybeGetElement<P, T>(
List<P?>? styles, {
required T? Function(P?)? transform,
T? Function(P?)? transform,
bool? Function(P?)? valueValidator,
P? Function(P?, P?)? combine,
}) {
// List of valid styles
final Iterable<P?>? validStyles = styles?.where(
(element) => valueValidator?.call(element) ?? (element != null),
);
// tranformation function
final transformation = transform ?? (element) => element as T?;
return (validStyles?.isNotEmpty ?? false)
? transform?.call(
? transformation.call(
validStyles?.reduce(
(value, element) => combine?.call(value, element) ?? value,
),
)
: null;
}
/// Gets a theme element from a list of styles. Throws an exception if no
/// valid style is found.
///
/// See [maybeGetElement] for more details.
///
/// {@macro getElement}
static T getElement<P, T>(
List<P?>? styles, {
T? Function(P?)? transform,
bool? Function(P?)? valueValidator,
P? Function(P?, P?)? combine,
}) {
final result = maybeGetElement<P, T>(
styles,
transform: transform,
valueValidator: valueValidator,
combine: combine,
);
if (result == null) {
throw FlutterError(
'No valid style found.\nPlease check your theme configuration.\n'
'Searching for: $P in $styles (transform to $T)\n'
'If this value can be null, use maybeGetElement instead.',
);
}
return result;
}
}
@@ -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/>.
import 'package:flutter/material.dart';
abstract class ThemeImporter {
/// Imports a [ThemeData] from either a [BuildContext] or a [ThemeData].
///
/// Throws an [ArgumentError] if the type of [from] is not a [BuildContext]
/// or a [ThemeData].
static ThemeData importFrom<T>(T from) {
ThemeData theme;
if (from is BuildContext) {
theme = Theme.of(from);
} else if (from is ThemeData) {
theme = from;
} else {
throw ArgumentError(
'from must be either a BuildContext or a ThemeData',
);
}
return theme;
}
}
@@ -26,47 +26,82 @@ import 'package:wyatt_ui_components/src/domain/entities/theme_style.dart';
/// 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.
/// flutter theme, or use a hardcoded value.
///
/// 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.
/// If a negotiation phase fails, it will fallback to the next one.
///
/// This resolver uses [ThemeHelper] to negotiate and merge styles.
/// {@endtemplate}
abstract class ThemeResolver<S extends ThemeStyle<S>, T, E> {
abstract class ThemeResolver<Style extends ThemeStyle<Style>, Extension,
Extra> {
/// {@macro theme_resolver}
const ThemeResolver();
S? Function(BuildContext context, {E? extra}) get customStyleFn;
/// Compute extension value from a given extension.
Style? computeExtensionValueFn(
BuildContext context,
Extension? themeExtension, {
Extra? extra,
});
/// Return the default extension containing Flutter's default values and
/// hardcoded values.
Extension? getDefaultExtension(BuildContext context);
/// Compute default value from Flutter Theme or with hardcoded values.
S computeDefaultValue(
///
/// If no default value is found, it will throw a [FlutterError].
Style computeDefaultValue(
BuildContext context, {
E? extra,
});
Extra? extra,
}) {
final extension = getDefaultExtension(context);
if (extension == null) {
throw FlutterError('No default extension found for $Extension\n'
'Please provide a default extension in your theme using '
'`wyatt_ui_components` default extensions kit.');
}
/// Compute extension value from custom component extension.
S? computeExtensionValueFn(
BuildContext context,
T? themeExtension, {
E? extra,
});
final style = computeExtensionValueFn(context, extension, extra: extra);
if (style == null) {
throw FlutterError(
'No default style found for $Style in '
'$Extension${extra != null ? ' with $extra' : ''}',
);
}
return style;
}
/// Compute custom style from context.
Style? Function(BuildContext context, {Extra? extra}) get customStyleFn;
/// Choose most suitable style for a given context.
S negotiate(BuildContext context, {E? extra}) {
Style negotiate(BuildContext context, {Extra? extra}) {
// 1) Custom style passed in constructor (cannot be null)
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;
return ThemeHelper.getElement<Style, Style>(
[
// 3) Default
style,
// -> then, try to find better style, and merge it with the default
// 2) Theme extension
computeExtensionValueFn(
context,
Theme.of(context).extension<Extension>(),
extra: extra,
),
// -> then, try to find better style, and merge it with the one above
// 1) Custom style passed in constructor
customStyleFn(context, extra: extra),
],
transform: (value) => value,
combine: (value, element) => value?.mergeWith(element),
);
}
}
@@ -14,6 +14,7 @@
// 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 'gradient_helper.dart';
export 'multi_color.dart';
export 'text_wrapper.dart';
export 'theme_helper.dart';
@@ -14,12 +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/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
extension StringExtension on String? {
TextWrapper? wrap({TextStyle? style, MultiColor? gradientColors}) =>
this != null
? TextWrapper(this!, style: style, gradientColors: gradientColors)
: null;
}
export 'theme_extensions/theme_extensions.dart';
@@ -14,19 +14,7 @@
// 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_ui_components.dart';
abstract class LoaderThemeExtension
extends ThemeExtension<LoaderThemeExtension> {
const LoaderThemeExtension({
this.colors,
this.stroke,
});
/// Gradient colors from start to end.
final MultiColor? colors;
/// Loader stroke width
final double? stroke;
}
export 'file_selection_button_theme_extension_default.dart';
export 'flat_button_theme_extension_default.dart';
export 'simple_icon_button_theme_extension_default.dart';
export 'symbol_button_theme_extension_default.dart';
@@ -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/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
/// {@template file_selection_button_theme_extension}
/// Default file selection button theme extension using Flutter's
/// default theme and opinionated defaults.
/// {@endtemplate}
class FileSelectionButtonThemeExtensionDefault
extends FileSelectionButtonThemeExtension {
/// {@macro file_selection_button_theme_extension}
const FileSelectionButtonThemeExtensionDefault({
required super.disabledStyle,
required super.focusedStyle,
required super.hoveredStyle,
required super.normalStyle,
required super.tappedStyle,
required super.selectedStyle,
required super.invalidStyle,
});
/// Creates a [FileSelectionButtonThemeExtensionDefault] given a [ThemeData]
///
/// {@macro file_selection_button_theme_extension}
factory FileSelectionButtonThemeExtensionDefault.from(ThemeData theme) {
final style = FileSelectionButtonStyle(
titleStyle: theme.textTheme.labelLarge,
subtitleStyle: theme.textTheme.labelSmall,
radius: (theme.buttonTheme.shape is RoundedRectangleBorder)
? (theme.buttonTheme.shape as RoundedRectangleBorder).borderRadius
: null,
padding: const EdgeInsets.symmetric(horizontal: 10),
foregroundColors: MultiColor.single(theme.colorScheme.onPrimary),
backgroundColors: MultiColor.single(theme.colorScheme.primary),
animationDuration: Duration.zero,
);
return FileSelectionButtonThemeExtensionDefault(
normalStyle: style,
focusedStyle: style,
hoveredStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.80)),
),
tappedStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.75)),
),
selectedStyle: style,
disabledStyle: style.copyWith(
foregroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.12)),
backgroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.38)),
),
invalidStyle: style,
);
}
/// Creates a [FileSelectionButtonThemeExtensionDefault] from a dark theme
factory FileSelectionButtonThemeExtensionDefault.dark() =>
FileSelectionButtonThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [FileSelectionButtonThemeExtensionDefault] from a light theme
factory FileSelectionButtonThemeExtensionDefault.light() =>
FileSelectionButtonThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,79 @@
// 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_ui_components.dart';
/// {@template flat_button_theme_extension_default}
/// Default flat button theme extension using Flutter's default values.
/// {@endtemplate}
class FlatButtonThemeExtensionDefault extends FlatButtonThemeExtension {
/// {@macro flat_button_theme_extension_default}
const FlatButtonThemeExtensionDefault({
required super.disabledStyle,
required super.focusedStyle,
required super.hoveredStyle,
required super.normalStyle,
required super.tappedStyle,
});
/// Creates a [FlatButtonThemeExtensionDefault] given a [ThemeData]
///
/// {@macro flat_button_theme_extension_default}
factory FlatButtonThemeExtensionDefault.from(ThemeData theme) {
final backgroundColor = MultiColor.single(theme.colorScheme.primary);
final foregroundColor = MultiColor.single(theme.colorScheme.onPrimary);
final style = FlatButtonStyle(
labelStyle:
theme.textTheme.labelLarge?.copyWith(color: foregroundColor.color),
radius: (theme.buttonTheme.shape is RoundedRectangleBorder)
? (theme.buttonTheme.shape as RoundedRectangleBorder).borderRadius
: null,
padding: theme.buttonTheme.padding,
foregroundColors: foregroundColor,
backgroundColors: backgroundColor,
animationDuration: Duration.zero,
);
return FlatButtonThemeExtensionDefault(
normalStyle: style,
focusedStyle: style,
hoveredStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.92)),
),
tappedStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.92)),
),
disabledStyle: style.copyWith(
foregroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.12)),
backgroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.38)),
),
);
}
/// Creates a [FlatButtonThemeExtensionDefault] from a dark theme
factory FlatButtonThemeExtensionDefault.dark() =>
FlatButtonThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [FlatButtonThemeExtensionDefault] from a light theme
factory FlatButtonThemeExtensionDefault.light() =>
FlatButtonThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,79 @@
// 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_ui_components.dart';
/// {@template simple_icon_button_theme_extension}
/// Default simple icon button theme extension using Flutter's default values.
/// {@endtemplate}
class SimpleIconButtonThemeExtensionDefault
extends SimpleIconButtonThemeExtension {
/// {@macro simple_icon_button_theme_extension}
const SimpleIconButtonThemeExtensionDefault({
required super.disabledStyle,
required super.focusedStyle,
required super.hoveredStyle,
required super.normalStyle,
required super.tappedStyle,
});
/// Creates a [SimpleIconButtonThemeExtensionDefault] given a [ThemeData]
///
/// {@macro file_selection_button_theme_extension}
factory SimpleIconButtonThemeExtensionDefault.from(ThemeData theme) {
final backgroundColor = MultiColor.single(theme.colorScheme.primary);
final foregroundColor = MultiColor.single(theme.colorScheme.onPrimary);
final style = SimpleIconButtonStyle(
dimension: theme.buttonTheme.height,
radius: (theme.buttonTheme.shape is RoundedRectangleBorder)
? (theme.buttonTheme.shape as RoundedRectangleBorder).borderRadius
: null,
padding: const EdgeInsets.all(5),
foregroundColors: foregroundColor,
backgroundColors: backgroundColor,
animationDuration: Duration.zero,
);
return SimpleIconButtonThemeExtensionDefault(
normalStyle: style,
focusedStyle: style,
hoveredStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.80)),
),
tappedStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.75)),
),
disabledStyle: style.copyWith(
foregroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.12)),
backgroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.38)),
),
);
}
/// Creates a [SimpleIconButtonThemeExtensionDefault] from a dark theme
factory SimpleIconButtonThemeExtensionDefault.dark() =>
SimpleIconButtonThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [SimpleIconButtonThemeExtensionDefault] from a light theme
factory SimpleIconButtonThemeExtensionDefault.light() =>
SimpleIconButtonThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,87 @@
// 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_ui_components.dart';
/// {@template symbol_button_theme_extension}
/// Default symbol button theme extension using Flutter's default values.
/// {@endtemplate}
class SymbolButtonThemeExtensionDefault extends SymbolButtonThemeExtension {
/// {@macro flat_button_theme_extension}
const SymbolButtonThemeExtensionDefault({
required super.disabledStyle,
required super.focusedStyle,
required super.hoveredStyle,
required super.normalStyle,
required super.tappedStyle,
required super.selectedStyle,
});
/// Creates a [SymbolButtonThemeExtensionDefault] given a [ThemeData]
///
/// {@macro file_selection_button_theme_extension}
factory SymbolButtonThemeExtensionDefault.from(ThemeData theme) {
final backgroundColor = MultiColor.single(theme.colorScheme.primary);
final foregroundColor = MultiColor.single(theme.colorScheme.onPrimary);
final textColor = MultiColor.single(theme.textTheme.bodyMedium?.color);
final style = SymbolButtonStyle(
labelStyle: theme.textTheme.labelLarge?.copyWith(color: textColor.color),
dimension: theme.buttonTheme.height * 1.5,
radius: (theme.buttonTheme.shape is RoundedRectangleBorder)
? (theme.buttonTheme.shape as RoundedRectangleBorder).borderRadius
: null,
padding: theme.buttonTheme.padding,
foregroundColors: foregroundColor,
backgroundColors: backgroundColor,
animationDuration: Duration.zero,
);
return SymbolButtonThemeExtensionDefault(
normalStyle: style,
focusedStyle: style,
hoveredStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.80)),
),
tappedStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.75)),
),
disabledStyle: style.copyWith(
foregroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.12)),
backgroundColors:
MultiColor.single(theme.colorScheme.onSurface.withOpacity(0.38)),
),
selectedStyle: style.copyWith(
backgroundColors:
MultiColor.single(theme.colorScheme.primary.withOpacity(0.92)),
borderColors: textColor,
stroke: 3,
),
);
}
/// Creates a [SymbolButtonThemeExtensionDefault] from a dark theme
factory SymbolButtonThemeExtensionDefault.dark() =>
SymbolButtonThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [SymbolButtonThemeExtensionDefault] from a light theme
factory SymbolButtonThemeExtensionDefault.light() =>
SymbolButtonThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,67 @@
// 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/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/theme_extensions/theme_extensions.dart';
/// {@template card_theme_extension_default}
/// Default card theme extension using Flutter's default card theme and
/// opinionated defaults.
/// {@endtemplate}
class CardThemeExtensionDefault extends CardThemeExtension {
/// {@macro card_theme_extension_default}
const CardThemeExtensionDefault({
required super.radius,
required super.padding,
required super.backgroundColors,
required super.borderColors,
required super.stroke,
required super.shadow,
required super.minSize,
required super.maxSize,
required super.titleStyle,
required super.subtitleStyle,
required super.bodyStyle,
});
/// Creates a [CardThemeExtensionDefault] from a [ThemeData]
/// and opinionated defaults.
///
/// {@macro card_theme_extension_default}
factory CardThemeExtensionDefault.from(ThemeData theme) =>
CardThemeExtensionDefault(
radius: const BorderRadius.all(Radius.circular(12)),
padding: theme.cardTheme.margin ?? const EdgeInsets.all(15),
backgroundColors: MultiColor.single(theme.cardColor),
borderColors: MultiColor.single(theme.canvasColor),
minSize: const Size(330, 0),
maxSize: const Size(390, double.infinity),
titleStyle: theme.textTheme.titleLarge,
subtitleStyle: theme.textTheme.titleMedium,
bodyStyle: theme.textTheme.bodyMedium,
stroke: 0,
shadow: null,
);
/// Creates a [CardThemeExtensionDefault] from a dark [ThemeData]
factory CardThemeExtensionDefault.dark() =>
CardThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [CardThemeExtensionDefault] from a light [ThemeData]
factory CardThemeExtensionDefault.light() =>
CardThemeExtensionDefault.from(ThemeData.light());
}
@@ -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/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
/// {@template loader_theme_extension_default}
/// The default [LoaderThemeExtension].
/// {@endtemplate}
class LoaderThemeExtensionDefault extends LoaderThemeExtension {
/// {@macro loader_theme_extension_default}
const LoaderThemeExtensionDefault({
required super.colors,
required super.stroke,
});
/// Creates a [LoaderThemeExtensionDefault] from a [ThemeData]
/// and opinionated defaults.
///
/// {@macro card_theme_extension_default}
factory LoaderThemeExtensionDefault.from(ThemeData theme) =>
LoaderThemeExtensionDefault(
colors: MultiColor([
theme.progressIndicatorTheme.color ?? theme.colorScheme.primary,
Colors.transparent,
]),
stroke: 4,
);
/// Creates a [LoaderThemeExtensionDefault] from a dark [ThemeData]
factory LoaderThemeExtensionDefault.dark() =>
LoaderThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [LoaderThemeExtensionDefault] from a light [ThemeData]
factory LoaderThemeExtensionDefault.light() =>
LoaderThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,73 @@
// 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/domain/theme_extensions/rich_text_builder_theme_extension.dart';
class RichTextBuilderThemeExtensionDefault
extends RichTextBuilderThemeExtension {
const RichTextBuilderThemeExtensionDefault({
required super.defaultStyle,
required super.styles,
});
/// Creates a [RichTextBuilderThemeExtensionDefault] from a [ThemeData]
/// and opinionated defaults.
///
/// {@macro card_theme_extension_default}
factory RichTextBuilderThemeExtensionDefault.from(ThemeData theme) =>
RichTextBuilderThemeExtensionDefault(
defaultStyle: theme.textTheme.bodyMedium,
styles: {
'blue': theme.textTheme.bodyMedium?.copyWith(
color: Colors.blue,
) ??
const TextStyle(
color: Colors.blue,
),
'red': theme.textTheme.bodyMedium?.copyWith(
color: Colors.red,
) ??
const TextStyle(
color: Colors.red,
),
'green': theme.textTheme.bodyMedium?.copyWith(
color: Colors.green,
) ??
const TextStyle(
color: Colors.green,
),
'bold': theme.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.bold,
) ??
const TextStyle(
fontWeight: FontWeight.bold,
),
'italic': theme.textTheme.bodyMedium?.copyWith(
fontStyle: FontStyle.italic,
) ??
const TextStyle(fontStyle: FontStyle.italic),
},
);
/// Creates a [RichTextBuilderThemeExtensionDefault] from a dark [ThemeData]
factory RichTextBuilderThemeExtensionDefault.dark() =>
RichTextBuilderThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [RichTextBuilderThemeExtensionDefault] from a light [ThemeData]
factory RichTextBuilderThemeExtensionDefault.light() =>
RichTextBuilderThemeExtensionDefault.from(ThemeData.light());
}
@@ -0,0 +1,97 @@
// 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/domain/entities/text_inputs/text_input_style.dart';
import 'package:wyatt_ui_components/src/domain/theme_extensions/text_input_theme_extension.dart';
/// {@template text_input_theme_extension_default}
/// The default implementation of [TextInputThemeExtension].
/// {@endtemplate}
class TextInputThemeExtensionDefault extends TextInputThemeExtension {
/// {@macro text_input_theme_extension_default}
const TextInputThemeExtensionDefault({
required super.normalStyle,
required super.focusedStyle,
required super.disabledStyle,
required super.invalidStyle,
});
/// Creates a [TextInputThemeExtensionDefault] from a [ThemeData].
///
/// {@macro text_input_theme_extension_default}
factory TextInputThemeExtensionDefault.from(ThemeData theme) {
final labelStyle = theme.textTheme.labelLarge
?.copyWith(color: theme.unselectedWidgetColor);
final hintStyle = theme.textTheme.labelLarge;
final prefixStyle = theme.textTheme.bodyMedium;
final suffixStyle = theme.textTheme.bodyMedium;
final inputStyle = theme.textTheme.bodyMedium;
final iconColor = theme.colorScheme.inversePrimary;
final prefixIconColor = theme.unselectedWidgetColor;
final suffixIconColor = theme.unselectedWidgetColor;
final borderColors = theme.unselectedWidgetColor;
final style = TextInputStyle(
labelStyle: labelStyle,
hintStyle: hintStyle,
iconColor: iconColor,
prefixIconColor: prefixIconColor,
prefixStyle: prefixStyle,
suffixStyle: suffixStyle,
suffixIconColor: suffixIconColor,
borderColors: borderColors,
inputStyle: inputStyle,
);
return TextInputThemeExtensionDefault(
normalStyle: style,
focusedStyle: style.copyWith(
prefixIconColor: theme.colorScheme.primary,
suffixIconColor: theme.colorScheme.primary,
iconColor: theme.colorScheme.primary,
borderColors: theme.colorScheme.primary,
labelStyle: labelStyle?.copyWith(color: theme.colorScheme.primary),
),
disabledStyle: style.copyWith(
labelStyle: labelStyle?.copyWith(color: theme.disabledColor),
hintStyle: hintStyle?.copyWith(color: theme.disabledColor),
prefixStyle: prefixStyle?.copyWith(color: theme.disabledColor),
suffixStyle: suffixStyle?.copyWith(color: theme.disabledColor),
inputStyle: inputStyle?.copyWith(color: theme.disabledColor),
borderColors: theme.disabledColor,
prefixIconColor: theme.disabledColor,
suffixIconColor: theme.disabledColor,
),
invalidStyle: style.copyWith(
labelStyle: theme.textTheme.labelLarge
?.copyWith(color: theme.colorScheme.error),
borderColors: theme.colorScheme.error,
),
);
}
/// Creates a [TextInputThemeExtensionDefault] from a [ThemeData.light].
factory TextInputThemeExtensionDefault.light() =>
TextInputThemeExtensionDefault.from(ThemeData.light());
/// Creates a [TextInputThemeExtensionDefault] from a [ThemeData.dark].
factory TextInputThemeExtensionDefault.dark() =>
TextInputThemeExtensionDefault.from(ThemeData.dark());
}
@@ -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/>.
export 'button_theme_extension/button_theme_extension.dart';
export 'card_theme_extension_default.dart';
export 'loader_theme_extension_default.dart';
export 'rich_text_builder_theme_extension_default.dart';
export 'text_input_theme_extension_default.dart';
export 'top_bar_theme_extension_default.dart';
@@ -0,0 +1,54 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
class TopBarThemeExtensionDefault extends TopBarThemeExtension {
const TopBarThemeExtensionDefault({
required super.iconTheme,
required super.backgroundColors,
required super.titleStyle,
required super.subtitleStyle,
required super.selectedIndicatorColors,
required super.selectedIndicatorSize,
required super.dividerColor,
});
/// Creates a [TopBarThemeExtensionDefault] from a [ThemeData]
/// and opinionated defaults.
///
/// {@macro card_theme_extension_default}
factory TopBarThemeExtensionDefault.from(ThemeData theme) =>
TopBarThemeExtensionDefault(
backgroundColors: MultiColor.single(theme.appBarTheme.backgroundColor),
titleStyle:
theme.appBarTheme.titleTextStyle ?? theme.textTheme.titleMedium,
subtitleStyle: theme.textTheme.bodyMedium,
selectedIndicatorColors: MultiColor.single(theme.colorScheme.primary),
selectedIndicatorSize: const Size(70, 5),
iconTheme: theme.iconTheme,
dividerColor: theme.colorScheme.onSurface.withOpacity(0.12),
);
/// Creates a [TopBarThemeExtensionDefault] from a dark [ThemeData]
factory TopBarThemeExtensionDefault.dark() =>
TopBarThemeExtensionDefault.from(ThemeData.dark());
/// Creates a [TopBarThemeExtensionDefault] from a light [ThemeData]
factory TopBarThemeExtensionDefault.light() =>
TopBarThemeExtensionDefault.from(ThemeData.light());
}
@@ -15,3 +15,4 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export './entities/entities.dart';
export './theme_extensions/theme_extensions.dart';
@@ -17,7 +17,11 @@
import 'package:flutter/foundation.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
/// {@template button_component}
/// A button component is a component that can be pressed.
/// {@endtemplate}
abstract class ButtonComponent extends Component {
/// {@macro button_component}
const ButtonComponent({
this.disabledStyle,
this.normalStyle,
@@ -18,7 +18,11 @@ 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';
/// {@template button_style}
/// Base class for button styles.
/// {@endtemplate}
abstract class ButtonStyle<T> extends ThemeStyle<T> {
/// {@macro button_style}
const ButtonStyle({
this.radius,
this.padding,
@@ -27,6 +31,7 @@ abstract class ButtonStyle<T> extends ThemeStyle<T> {
this.borderColors,
this.stroke,
this.shadow,
this.animationDuration,
});
/// Button radius
@@ -64,9 +69,15 @@ abstract class ButtonStyle<T> extends ThemeStyle<T> {
/// Default to `null`
final BoxShadow? shadow;
/// Animation duration
///
/// Default to `Duration.zero`
final Duration? animationDuration;
@override
String toString() =>
'ButtonStyle(radius: $radius, padding: $padding, foregroundColors: '
'$foregroundColors, backgroundColors: $backgroundColors, borderColors: '
'$borderColors, stroke: $stroke, shadow: $shadow)';
'$borderColors, stroke: $stroke, shadow: $shadow, '
'animationDuration: $animationDuration)';
}
@@ -24,10 +24,10 @@ part 'file_selection_button_component.g.dart';
abstract class FileSelectionButtonComponent extends ButtonComponent
with CopyWithMixin<$FileSelectionButtonComponentCWProxy> {
const FileSelectionButtonComponent({
this.mainAxisSize = MainAxisSize.min,
this.mainAxisSize,
this.leading,
this.title,
this.subTitle,
this.subtitle,
super.disabledStyle,
super.normalStyle,
super.hoveredStyle,
@@ -64,8 +64,15 @@ abstract class FileSelectionButtonComponent extends ButtonComponent
@override
FileSelectionButtonStyle? get invalidStyle;
/// The main axis size of the button
final MainAxisSize? mainAxisSize;
/// The leading widget of the button
final Widget? leading;
/// The title of the button
final TextWrapper? title;
final TextWrapper? subTitle;
/// The subtitle of the button
final TextWrapper? subtitle;
}
@@ -10,7 +10,7 @@ abstract class $FileSelectionButtonComponentCWProxy {
FileSelectionButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
FileSelectionButtonComponent leading(Widget? leading);
FileSelectionButtonComponent title(TextWrapper? title);
FileSelectionButtonComponent subTitle(TextWrapper? subTitle);
FileSelectionButtonComponent subtitle(TextWrapper? subtitle);
FileSelectionButtonComponent disabledStyle(
ButtonStyle<dynamic>? disabledStyle);
FileSelectionButtonComponent normalStyle(ButtonStyle<dynamic>? normalStyle);
@@ -30,7 +30,7 @@ abstract class $FileSelectionButtonComponentCWProxy {
MainAxisSize? mainAxisSize,
Widget? leading,
TextWrapper? title,
TextWrapper? subTitle,
TextWrapper? subtitle,
ButtonStyle<dynamic>? disabledStyle,
ButtonStyle<dynamic>? normalStyle,
ButtonStyle<dynamic>? hoveredStyle,
@@ -16,14 +16,21 @@
import 'dart:ui';
import 'package:flutter/foundation.dart';
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';
/// {@template file_selection_button_style}
/// File selection button style.
///
/// This style is used for the FileSelectionButton widget.
/// {@endtemplate}
class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
/// {@macro file_selection_button_style}
const FileSelectionButtonStyle({
this.title,
this.subTitle,
this.titleStyle,
this.subtitleStyle,
super.radius,
super.padding,
super.foregroundColors,
@@ -31,6 +38,7 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
super.borderColors,
super.stroke,
super.shadow,
super.animationDuration,
});
/// Merges non-null `b` attributes in `a`
@@ -46,8 +54,8 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
}
return a.copyWith(
title: b.title,
subTitle: b.subTitle,
titleStyle: b.titleStyle,
subtitleStyle: b.subtitleStyle,
radius: b.radius,
padding: b.padding,
foregroundColors: b.foregroundColors,
@@ -55,6 +63,7 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
borderColors: b.borderColors,
stroke: b.stroke,
shadow: b.shadow,
animationDuration: b.animationDuration,
);
}
@@ -69,8 +78,8 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
}
// 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),
titleStyle: TextStyle.lerp(a.titleStyle, b.titleStyle, t),
subtitleStyle: TextStyle.lerp(a.subtitleStyle, b.subtitleStyle, t),
foregroundColors: MultiColor.lerp(
a.foregroundColors,
b.foregroundColors,
@@ -90,18 +99,23 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
stroke: lerpDouble(a.stroke, b.stroke, t),
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
animationDuration: lerpDuration(
a.animationDuration ?? Duration.zero,
b.animationDuration ?? Duration.zero,
t,
),
);
}
/// Title text style
///
/// Default to `TextTheme.labelLarge`
final TextStyle? title;
final TextStyle? titleStyle;
/// Sub title text style
///
/// Default to `TextTheme.labelSmall`
final TextStyle? subTitle;
final TextStyle? subtitleStyle;
@override
FileSelectionButtonStyle? mergeWith(FileSelectionButtonStyle? other) =>
@@ -109,8 +123,8 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
@override
FileSelectionButtonStyle? copyWith({
TextStyle? title,
TextStyle? subTitle,
TextStyle? titleStyle,
TextStyle? subtitleStyle,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
@@ -118,10 +132,11 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
Duration? animationDuration,
}) =>
FileSelectionButtonStyle(
title: title ?? this.title,
subTitle: subTitle ?? this.subTitle,
titleStyle: titleStyle ?? this.titleStyle,
subtitleStyle: subtitleStyle ?? this.subtitleStyle,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
@@ -129,5 +144,6 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
animationDuration: animationDuration ?? this.animationDuration,
);
}
@@ -54,8 +54,15 @@ abstract class FlatButtonComponent extends ButtonComponent
@override
FlatButtonStyle? get tappedStyle;
/// The main axis size of the button.
final MainAxisSize? mainAxisSize;
/// The prefix widget of the button.
final Widget? prefix;
/// The suffix widget of the button.
final Widget? suffix;
/// The label widget of the button.
final TextWrapper? label;
}

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