add exemple app for wyatt feature brick
This commit is contained in:
parent
be22a3d6fa
commit
5734b09510
47
apps/wyatt_feature_brick/.gitignore
vendored
Normal file
47
apps/wyatt_feature_brick/.gitignore
vendored
Normal file
@ -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
|
30
apps/wyatt_feature_brick/.metadata
Normal file
30
apps/wyatt_feature_brick/.metadata
Normal file
@ -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'
|
16
apps/wyatt_feature_brick/README.md
Normal file
16
apps/wyatt_feature_brick/README.md
Normal file
@ -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.
|
1
apps/wyatt_feature_brick/analysis_options.yaml
Normal file
1
apps/wyatt_feature_brick/analysis_options.yaml
Normal file
@ -0,0 +1 @@
|
||||
include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml
|
13
apps/wyatt_feature_brick/android/.gitignore
vendored
Normal file
13
apps/wyatt_feature_brick/android/.gitignore
vendored
Normal file
@ -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
|
71
apps/wyatt_feature_brick/android/app/build.gradle
Normal file
71
apps/wyatt_feature_brick/android/app/build.gradle
Normal file
@ -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"
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.wyatt_feature_brick">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
@ -0,0 +1,34 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.wyatt_feature_brick">
|
||||
<application
|
||||
android:label="wyatt_feature_brick"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
@ -0,0 +1,6 @@
|
||||
package com.example.wyatt_feature_brick
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
Binary file not shown.
After Width: | Height: | Size: 544 B |
Binary file not shown.
After Width: | Height: | Size: 442 B |
Binary file not shown.
After Width: | Height: | Size: 721 B |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
@ -0,0 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.wyatt_feature_brick">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
31
apps/wyatt_feature_brick/android/build.gradle
Normal file
31
apps/wyatt_feature_brick/android/build.gradle
Normal file
@ -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
|
||||
}
|
3
apps/wyatt_feature_brick/android/gradle.properties
Normal file
3
apps/wyatt_feature_brick/android/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
6
apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
apps/wyatt_feature_brick/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -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
|
11
apps/wyatt_feature_brick/android/settings.gradle
Normal file
11
apps/wyatt_feature_brick/android/settings.gradle
Normal file
@ -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"
|
20
apps/wyatt_feature_brick/brick_config.yaml
Normal file
20
apps/wyatt_feature_brick/brick_config.yaml
Normal file
@ -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
|
@ -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<FeatureNameEvent, FeatureNameState> {
|
||||
FeatureNameBloc() : super(const FeatureNameInitial()) {
|
||||
on<CustomFeatureNameEvent>(_onCustomFeatureNameEvent);
|
||||
}
|
||||
|
||||
FutureOr<void> _onCustomFeatureNameEvent(
|
||||
CustomFeatureNameEvent event,
|
||||
Emitter<FeatureNameState> emit,
|
||||
) {
|
||||
// TODO(wyattstudio): Add Logic
|
||||
}
|
||||
}
|
@ -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<Object?> get props => [];
|
||||
}
|
@ -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<Object?> get props => [];
|
||||
}
|
@ -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<FeatureNameState> {
|
||||
FeatureNameCubit() : super(const FeatureNameInitial());
|
||||
|
||||
/// A description for yourCustomFunction
|
||||
FutureOr<void> yourCustomFunction() {
|
||||
// TODO(wyattstudio): Add Logic
|
||||
}
|
||||
}
|
@ -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<Object?> get props => [];
|
||||
}
|
@ -0,0 +1 @@
|
||||
export './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<FeatureNameCubit, FeatureNameState> {
|
||||
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();
|
||||
}
|
@ -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,
|
||||
);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FeatureNameWidget extends StatelessWidget {
|
||||
const FeatureNameWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => const SizedBox();
|
||||
}
|
115
apps/wyatt_feature_brick/lib/main.dart
Normal file
115
apps/wyatt_feature_brick/lib/main.dart
Normal file
@ -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<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
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: <Widget>[
|
||||
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.
|
||||
);
|
||||
}
|
||||
}
|
99
apps/wyatt_feature_brick/pubspec.yaml
Normal file
99
apps/wyatt_feature_brick/pubspec.yaml
Normal file
@ -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
|
30
apps/wyatt_feature_brick/test/widget_test.dart
Normal file
30
apps/wyatt_feature_brick/test/widget_test.dart
Normal file
@ -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);
|
||||
});
|
||||
}
|
@ -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<FeatureState> {
|
||||
{{featureName}}_state.dart is the same file as before
|
||||
|
||||
### None
|
||||
TODO
|
||||
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
|
||||
|
||||
[](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<CounterCubit, CounterState> {
|
||||
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/ |
|
@ -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
|
||||
|
@ -66,6 +66,7 @@ Future<void> main(List<String> 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?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user