From 5734b0951032e7b731f5bcd0777784d0f3e5d8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Tue, 9 Aug 2022 18:22:03 +0100 Subject: [PATCH] add exemple app for wyatt feature brick --- apps/wyatt_feature_brick/.gitignore | 47 +++++++ apps/wyatt_feature_brick/.metadata | 30 +++++ apps/wyatt_feature_brick/README.md | 16 +++ .../wyatt_feature_brick/analysis_options.yaml | 1 + apps/wyatt_feature_brick/android/.gitignore | 13 ++ .../android/app/build.gradle | 71 +++++++++++ .../android/app/src/debug/AndroidManifest.xml | 8 ++ .../android/app/src/main/AndroidManifest.xml | 34 ++++++ .../wyatt_feature_brick/MainActivity.kt | 6 + .../res/drawable-v21/launch_background.xml | 12 ++ .../main/res/drawable/launch_background.xml | 12 ++ .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 544 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 442 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 721 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1031 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 1443 bytes .../app/src/main/res/values-night/styles.xml | 18 +++ .../app/src/main/res/values/styles.xml | 18 +++ .../app/src/profile/AndroidManifest.xml | 8 ++ apps/wyatt_feature_brick/android/build.gradle | 31 +++++ .../android/gradle.properties | 3 + .../gradle/wrapper/gradle-wrapper.properties | 6 + .../android/settings.gradle | 11 ++ apps/wyatt_feature_brick/brick_config.yaml | 20 +++ .../feature_name/bloc/feature_name_bloc.dart | 22 ++++ .../feature_name/bloc/feature_name_event.dart | 18 +++ .../feature_name/bloc/feature_name_state.dart | 22 ++++ .../cubit/feature_name_cubit.dart | 14 +++ .../cubit/feature_name_state.dart | 20 +++ .../lib/feature_name/feature_name.dart | 1 + .../feature_name_state_management.dart | 25 ++++ .../feature_name_wrapper_widget.dart | 11 ++ .../widgets/feature_name_widget.dart | 8 ++ apps/wyatt_feature_brick/lib/main.dart | 115 ++++++++++++++++++ apps/wyatt_feature_brick/pubspec.yaml | 99 +++++++++++++++ .../wyatt_feature_brick/test/widget_test.dart | 30 +++++ bricks/wyatt_feature_brick/README.md | 88 +++++++++++++- tools/brick_generator/README.md | 15 --- .../brick_generator/bin/brick_generator.dart | 1 + 39 files changed, 836 insertions(+), 18 deletions(-) create mode 100644 apps/wyatt_feature_brick/.gitignore create mode 100644 apps/wyatt_feature_brick/.metadata create mode 100644 apps/wyatt_feature_brick/README.md create mode 100644 apps/wyatt_feature_brick/analysis_options.yaml create mode 100644 apps/wyatt_feature_brick/android/.gitignore create mode 100644 apps/wyatt_feature_brick/android/app/build.gradle create mode 100644 apps/wyatt_feature_brick/android/app/src/debug/AndroidManifest.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/main/AndroidManifest.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/main/kotlin/com/example/wyatt_feature_brick/MainActivity.kt create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/drawable/launch_background.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/values-night/styles.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/main/res/values/styles.xml create mode 100644 apps/wyatt_feature_brick/android/app/src/profile/AndroidManifest.xml create mode 100644 apps/wyatt_feature_brick/android/build.gradle create mode 100644 apps/wyatt_feature_brick/android/gradle.properties create mode 100644 apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 apps/wyatt_feature_brick/android/settings.gradle create mode 100644 apps/wyatt_feature_brick/brick_config.yaml create mode 100644 apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_bloc.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_event.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_state.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_cubit.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_state.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/feature_name.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_state_management.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_wrapper_widget.dart create mode 100644 apps/wyatt_feature_brick/lib/feature_name/state_management/widgets/feature_name_widget.dart create mode 100644 apps/wyatt_feature_brick/lib/main.dart create mode 100644 apps/wyatt_feature_brick/pubspec.yaml create mode 100644 apps/wyatt_feature_brick/test/widget_test.dart diff --git a/apps/wyatt_feature_brick/.gitignore b/apps/wyatt_feature_brick/.gitignore new file mode 100644 index 0000000..a8e938c --- /dev/null +++ b/apps/wyatt_feature_brick/.gitignore @@ -0,0 +1,47 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/apps/wyatt_feature_brick/.metadata b/apps/wyatt_feature_brick/.metadata new file mode 100644 index 0000000..2544bab --- /dev/null +++ b/apps/wyatt_feature_brick/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + - platform: android + create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/apps/wyatt_feature_brick/README.md b/apps/wyatt_feature_brick/README.md new file mode 100644 index 0000000..90ea944 --- /dev/null +++ b/apps/wyatt_feature_brick/README.md @@ -0,0 +1,16 @@ +# wyatt_feature_brick + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/apps/wyatt_feature_brick/analysis_options.yaml b/apps/wyatt_feature_brick/analysis_options.yaml new file mode 100644 index 0000000..abfedf0 --- /dev/null +++ b/apps/wyatt_feature_brick/analysis_options.yaml @@ -0,0 +1 @@ +include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml diff --git a/apps/wyatt_feature_brick/android/.gitignore b/apps/wyatt_feature_brick/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/apps/wyatt_feature_brick/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/apps/wyatt_feature_brick/android/app/build.gradle b/apps/wyatt_feature_brick/android/app/build.gradle new file mode 100644 index 0000000..9a12ea4 --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/build.gradle @@ -0,0 +1,71 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.wyatt_feature_brick" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/apps/wyatt_feature_brick/android/app/src/debug/AndroidManifest.xml b/apps/wyatt_feature_brick/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..4de5ed0 --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/main/AndroidManifest.xml b/apps/wyatt_feature_brick/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..92ac70e --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/main/kotlin/com/example/wyatt_feature_brick/MainActivity.kt b/apps/wyatt_feature_brick/android/app/src/main/kotlin/com/example/wyatt_feature_brick/MainActivity.kt new file mode 100644 index 0000000..c68250d --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/kotlin/com/example/wyatt_feature_brick/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.wyatt_feature_brick + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/drawable-v21/launch_background.xml b/apps/wyatt_feature_brick/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/drawable/launch_background.xml b/apps/wyatt_feature_brick/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..db77bb4b7b0906d62b1847e87f15cdcacf6a4f29 GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ literal 0 HcmV?d00001 diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..17987b79bb8a35cc66c3c1fd44f5a5526c1b78be GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ literal 0 HcmV?d00001 diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d5f1c8d34e7a88e3f88bea192c3a370d44689c3c GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof literal 0 HcmV?d00001 diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6372eebdb28e45604e46eeda8dd24651419bc0 GIT binary patch literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` literal 0 HcmV?d00001 diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/values-night/styles.xml b/apps/wyatt_feature_brick/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/values/styles.xml b/apps/wyatt_feature_brick/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/apps/wyatt_feature_brick/android/app/src/profile/AndroidManifest.xml b/apps/wyatt_feature_brick/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..4de5ed0 --- /dev/null +++ b/apps/wyatt_feature_brick/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/apps/wyatt_feature_brick/android/build.gradle b/apps/wyatt_feature_brick/android/build.gradle new file mode 100644 index 0000000..83ae220 --- /dev/null +++ b/apps/wyatt_feature_brick/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.1.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/apps/wyatt_feature_brick/android/gradle.properties b/apps/wyatt_feature_brick/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/apps/wyatt_feature_brick/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties b/apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..cc5527d --- /dev/null +++ b/apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/apps/wyatt_feature_brick/android/settings.gradle b/apps/wyatt_feature_brick/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/apps/wyatt_feature_brick/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/apps/wyatt_feature_brick/brick_config.yaml b/apps/wyatt_feature_brick/brick_config.yaml new file mode 100644 index 0000000..5853d58 --- /dev/null +++ b/apps/wyatt_feature_brick/brick_config.yaml @@ -0,0 +1,20 @@ +brick_name: wyatt_feature_brick + +path_to_brickify: lib/feature_name + +variables: + feature_name: + variable_name: feature_brick + type: string + syntax: + camel_case: featureName + constant_case: FEATURE_NAME + dot_case: feature.name + header_case: Feature-Name + lower_case: feature name + pascal_case: FeatureName + param_case: feature-name + sentence_case: Feature name + snake_case: feature_name + title_case: Feature Name + upper_case: FEATURE NAME diff --git a/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_bloc.dart b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_bloc.dart new file mode 100644 index 0000000..c3ba487 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_bloc.dart @@ -0,0 +1,22 @@ +// isBloc + +import 'dart:async'; + +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +part 'feature_name_event.dart'; +part 'feature_name_state.dart'; + +class FeatureNameBloc extends Bloc { + FeatureNameBloc() : super(const FeatureNameInitial()) { + on(_onCustomFeatureNameEvent); + } + + FutureOr _onCustomFeatureNameEvent( + CustomFeatureNameEvent event, + Emitter emit, + ) { + // TODO(wyattstudio): Add Logic + } +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_event.dart b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_event.dart new file mode 100644 index 0000000..f10cc0b --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_event.dart @@ -0,0 +1,18 @@ +// isBloc + +part of 'feature_name_bloc.dart'; + +abstract class FeatureNameEvent extends Equatable { + const FeatureNameEvent(); +} + +/// {@template custom_feature_name_event} +/// Event added when some custom logic happens +/// {@endtemplate} +class CustomFeatureNameEvent extends FeatureNameEvent { + /// {@macro custom_feature_name_event} + const CustomFeatureNameEvent(); + + @override + List get props => []; +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_state.dart b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_state.dart new file mode 100644 index 0000000..a8d8dfc --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/bloc/feature_name_state.dart @@ -0,0 +1,22 @@ +// isBloc + +part of 'feature_name_bloc.dart'; + +/// {@template feature_name_state} +/// FeatureNameState description +/// {@endtemplate} +abstract class FeatureNameState extends Equatable { + /// {@macro feature_name_state} + const FeatureNameState(); +} + +/// {@template feature_name_initial} +/// The initial state of FeatureNameState +/// {@endtemplate} +class FeatureNameInitial extends FeatureNameState { + /// {@macro feature_name_initial} + const FeatureNameInitial(); + + @override + List get props => []; +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_cubit.dart b/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_cubit.dart new file mode 100644 index 0000000..d7fdfba --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_cubit.dart @@ -0,0 +1,14 @@ +import 'dart:async'; + +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +part 'feature_name_state.dart'; + +class FeatureNameCubit extends Cubit { + FeatureNameCubit() : super(const FeatureNameInitial()); + + /// A description for yourCustomFunction + FutureOr yourCustomFunction() { + // TODO(wyattstudio): Add Logic + } +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_state.dart b/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_state.dart new file mode 100644 index 0000000..3150289 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/cubit/feature_name_state.dart @@ -0,0 +1,20 @@ +part of 'feature_name_cubit.dart'; + +/// {@template {feature_name}} +/// FeatureNameState description +/// {@endtemplate} +abstract class FeatureNameState extends Equatable { + /// {@macro {feature_name}} + const FeatureNameState(); +} + +/// {@template feature_name_initial} +/// The initial state of FeatureNameState +/// {@endtemplate} +class FeatureNameInitial extends FeatureNameState { + /// {@macro feature_name_initial} + const FeatureNameInitial() : super(); + + @override + List get props => []; +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/feature_name.dart b/apps/wyatt_feature_brick/lib/feature_name/feature_name.dart new file mode 100644 index 0000000..a071f26 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/feature_name.dart @@ -0,0 +1 @@ +export './state_management/feature_name_state_management.dart'; diff --git a/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_state_management.dart b/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_state_management.dart new file mode 100644 index 0000000..5c958f4 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_state_management.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart'; + +// ignore: always_use_package_imports +import './feature_name_wrapper_widget.dart'; +// ignore: always_use_package_imports +import './widgets/feature_name_widget.dart'; +// ignore: always_use_package_imports +import '../cubit/feature_name_cubit.dart'; + +class FeatureNameCubitStateManagement + extends CubitScreen { + const FeatureNameCubitStateManagement({super.key}); + + @override + FeatureNameCubit create(BuildContext context) => FeatureNameCubit(); + + @override + Widget onWrap(BuildContext context, Widget child) => + FeatureNameWrapperWidget(child: child); + + @override + Widget onBuild(BuildContext context, FeatureNameState state) => + const FeatureNameWidget(); +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_wrapper_widget.dart b/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_wrapper_widget.dart new file mode 100644 index 0000000..c966a59 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/state_management/feature_name_wrapper_widget.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +class FeatureNameWrapperWidget extends StatelessWidget { + final Widget child; + const FeatureNameWrapperWidget({super.key, required this.child}); + + @override + Widget build(BuildContext context) => Container( + child: child, + ); +} diff --git a/apps/wyatt_feature_brick/lib/feature_name/state_management/widgets/feature_name_widget.dart b/apps/wyatt_feature_brick/lib/feature_name/state_management/widgets/feature_name_widget.dart new file mode 100644 index 0000000..9ab7ada --- /dev/null +++ b/apps/wyatt_feature_brick/lib/feature_name/state_management/widgets/feature_name_widget.dart @@ -0,0 +1,8 @@ +import 'package:flutter/material.dart'; + +class FeatureNameWidget extends StatelessWidget { + const FeatureNameWidget({super.key}); + + @override + Widget build(BuildContext context) => const SizedBox(); +} diff --git a/apps/wyatt_feature_brick/lib/main.dart b/apps/wyatt_feature_brick/lib/main.dart new file mode 100644 index 0000000..e016029 --- /dev/null +++ b/apps/wyatt_feature_brick/lib/main.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({super.key, required this.title}); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/apps/wyatt_feature_brick/pubspec.yaml b/apps/wyatt_feature_brick/pubspec.yaml new file mode 100644 index 0000000..e73da2d --- /dev/null +++ b/apps/wyatt_feature_brick/pubspec.yaml @@ -0,0 +1,99 @@ +name: wyatt_feature_brick +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: "none" # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.17.6 <3.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + flutter_bloc: ^8.0.1 + equatable: ^2.0.3 + wyatt_bloc_helper: + git: + url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages + ref: bloc/feature/fix_and_repo + path: packages/wyatt_bloc_helper + +dev_dependencies: + flutter_test: + sdk: flutter + wyatt_analysis: + git: + url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages + ref: wyatt_analysis-v2.1.0 + path: packages/wyatt_analysis + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/apps/wyatt_feature_brick/test/widget_test.dart b/apps/wyatt_feature_brick/test/widget_test.dart new file mode 100644 index 0000000..1ce5d91 --- /dev/null +++ b/apps/wyatt_feature_brick/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:wyatt_feature_brick/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/bricks/wyatt_feature_brick/README.md b/bricks/wyatt_feature_brick/README.md index 3a04ebf..b714e43 100644 --- a/bricks/wyatt_feature_brick/README.md +++ b/bricks/wyatt_feature_brick/README.md @@ -18,8 +18,7 @@ mason make feature_brick --feature_name audit --state_management cubit --use_equ | Variable | Description | Default | Type | | ------------------ | ------------------------------- | ------- | --------- | | `feature_name` | The name of the feature | login | `string` | -| `state_management` | The state management of the app | cubit | `enum` | -| `use_equatable` | Use the equatable package | true | `boolean` | + ## Outputs 📦 @@ -113,4 +112,87 @@ class FeatureCubit extends Cubit { {{featureName}}_state.dart is the same file as before ### None -TODO \ No newline at end of file +TODO + + +## TODO +add this varibales : + +| `state_management` | The state management of the app | cubit | `enum` | +| `use_equatable` | Use the equatable package | true | `boolean` | + +# State Management Helper Brick + +[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason) + + +## How to use 🚀 + +``` +mason make state_management_helper_brick --name audit --state_management cubit --use_wrapper true +``` + +## Variables ✨ + +| Variable | Description | Default | Type | When | +| ------------------ | ------------------------------- | ------- | --------- |------------------------| +| `name` | The name of the part | login | `string` | N/A | + + + +``` +├── feature_state_management +│ ├── feature_state_management.dart +| ├── feature_wraper_widget.dart +| └── widgets +| └── feature_widget.dart +└── ... +``` + +- {{Name}}_state_management.dart + +```dart +class FeatureCubitStateManagement + extends CubitScreen { + const CounterCubitPage({super.key}); + + @override + CounterCubit create(BuildContext context) => FeatureCubit(); + + @override + Widget onWrap(BuildContext context, Widget child) => FeatureWrapperWidget(child: child); + + @override + Widget onBuild(BuildContext context, CounterState state) => ChildWidget(); + +} +``` + +- {{Name}}_wrapper_widget.dart + +```dart +class FeatureWrapperWidget extends WrapperStatelessWidget { + const FeatureWrapperWidget(super.child); + + @override + Widget build(BuildContext context, Widget child) => child; + +} +``` + +- {{Name}}_widget.dart classic stateless widget. + +Please note that `{Name}}_state_management.dart` and the functions you can override may change depending on the type you have chosen (Consummer, Screen or Provider). + + +Note 2 : This is intentionally not part of the feature : +- Assets +- AppRessources +- Data (Repositories, Data Provider, Models, ..) + +## TODO +add this variables + +| `state_management` | The state management of the app | cubit | `enum` | N/A | +| `type` | Screen, Provider or Consumer | screen | `enum` | N/A | +| `use_wrapper` | Use the equatable package | true | `boolean` | Using screen/consumer/ | \ No newline at end of file diff --git a/tools/brick_generator/README.md b/tools/brick_generator/README.md index 885baa8..c8b20d0 100644 --- a/tools/brick_generator/README.md +++ b/tools/brick_generator/README.md @@ -27,21 +27,6 @@ variables: snake_case: feature_brick title_case: Feature Brick upper_case: FEATURE BRICK - description: - variable_name: description - type: string - syntax: - camel_case: description - constant_case: DESCRIPTION - dot_case: description - header_case: Description - lower_case: description - pascal_case: Description - param_case: description - sentence_case: Description - snake_case: description - title_case: Description - upper_case: DESCRIPTION isBloc: variable_name: bloc type: bool diff --git a/tools/brick_generator/bin/brick_generator.dart b/tools/brick_generator/bin/brick_generator.dart index 08a5530..97caaa5 100644 --- a/tools/brick_generator/bin/brick_generator.dart +++ b/tools/brick_generator/bin/brick_generator.dart @@ -66,6 +66,7 @@ Future main(List arguments) async { // Transform all values in variables if (brickConfig.variables != null) { for (final variable in brickConfig.variables!) { + // Replace all string variables if (variable?.type == VariabelType.string) { for (final syntax in VariableStringSyntax.values) { final toReplace = variable?.syntax?[syntax.mapKey] as String?;