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 0000000..db77bb4 Binary files /dev/null and b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ 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 0000000..17987b7 Binary files /dev/null and b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ 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 0000000..d5f1c8d Binary files /dev/null and b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ 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 0000000..4d6372e Binary files /dev/null and b/apps/wyatt_feature_brick/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ 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?;