diff --git a/README.md b/README.md
index 1a6b1fad..a40f84a9 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ parabeac_core converts design files into isolated & responsive Flutter code for
[![Discord Chat](https://img.shields.io/discord/308323056592486420.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/qUrghes) [![https://twitter.com/parabeac?lang=en](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&style=plastic)](https://twitter.com/parabeac?lang=en) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://github.com/Parabeac/parabeac_core/blob/stable/CODE_OF_CONDUCT.md)
- Hello World
+ Hello World
·
Fundamental Laws of Parabeac
·
@@ -89,7 +89,7 @@ Due to the lack of requested support for Sketch and the major updates to this pr
# Running the generated code
-We recommend following our [Hello World guide](https://docs.parabeac.com/docs/hello-world-guide) but if you feel experienced enough with Flutter, feel free to jump right in here:
+We recommend following our [Hello World guide](https://docs.parabeac.com/docs/hello-world) but if you feel experienced enough with Flutter, feel free to jump right in here:
### Running a Figma Frame/Screen
![Figma Frame Example](https://github.com/Parabeac/parabeac_core/blob/stable/repo_assets/figma_frame_example.png?raw=true)
@@ -140,8 +140,10 @@ The best way to run and test a component package is to use tools like Storybook.
_Be sure to use Figma Components_
+ To run the widgetbook, instead of running the normal `flutter run`, you want to run `flutter run lib/main_widgetbook.g.dart`.
+
# What's Next?
-Be sure to complete our [Hello World Guide](https://docs.parabeac.com/docs/hello-world-guide) or read the [docs](https://docs.parabeac.com/) so you know how to handle the code generated.
+Be sure to complete our [Hello World Guide](https://docs.parabeac.com/docs/hello-world) or read the [docs](https://docs.parabeac.com/) so you know how to handle the code generated.
## Enabling the design team to create pull requests
If you find the viability in the code generation to support continuous design changes, create a free account on [Parabeac Nest](https://app.parabeac.com) where you can create an integration between Figma & the project Github repo.
diff --git a/lib/generation/generators/value_objects/file_structure_strategy/commands/entry_file_command.dart b/lib/generation/generators/value_objects/file_structure_strategy/commands/entry_file_command.dart
index 546f87a7..38dc8524 100644
--- a/lib/generation/generators/value_objects/file_structure_strategy/commands/entry_file_command.dart
+++ b/lib/generation/generators/value_objects/file_structure_strategy/commands/entry_file_command.dart
@@ -32,7 +32,9 @@ class EntryFileCommand extends NodeFileStructureCommand {
this.projectName = 'Parabeac-Core Generated Project',
this.mainCode = 'runApp(MyApp());',
FileOwnership ownership = FileOwnership.DEV})
- : super('ENTRY_FILE', '''
+ : super(
+ 'ENTRY_FILE',
+ '''
import 'package:flutter/material.dart';
$entryScreenImport
@@ -55,7 +57,8 @@ class MyApp extends StatelessWidget {
}
}
- ''', ownership) {
+ ''',
+ ownership) {
if ((entryScreenImport == null && entryScreenName != null) ||
(entryScreenName == null && entryScreenName != null)) {
throw NullThrownError();
@@ -66,7 +69,6 @@ class MyApp extends StatelessWidget {
Future write(FileStructureStrategy strategy) {
strategy.writeDataToFile(
code, strategy.GENERATED_PROJECT_PATH, p.join('lib', mainFileName),
- UUID: UUID,
- ownership: ownership);
+ UUID: UUID, ownership: ownership);
}
}
diff --git a/lib/generation/generators/value_objects/file_structure_strategy/commands/export_platform_command.dart b/lib/generation/generators/value_objects/file_structure_strategy/commands/export_platform_command.dart
index 2da9f045..b0796bea 100644
--- a/lib/generation/generators/value_objects/file_structure_strategy/commands/export_platform_command.dart
+++ b/lib/generation/generators/value_objects/file_structure_strategy/commands/export_platform_command.dart
@@ -12,13 +12,9 @@ class ExportPlatformCommand extends NodeFileStructureCommand {
static final String WIDGET_PATH = 'lib/screens';
ExportPlatformCommand(
- String UUID,
- this.platform,
- this.folderName,
- this.fileName,
- String code,
- {FileOwnership ownership = FileOwnership.PBC}
- ) : super(UUID, code, ownership);
+ String UUID, this.platform, this.folderName, this.fileName, String code,
+ {FileOwnership ownership = FileOwnership.PBC})
+ : super(UUID, code, ownership);
@override
Future write(FileStructureStrategy strategy) async {
@@ -28,6 +24,7 @@ class ExportPlatformCommand extends NodeFileStructureCommand {
folderName,
platform.toString().toLowerCase().replaceAll('platform.', ''),
);
- strategy.writeDataToFile(code, path, fileName, UUID: UUID, ownership: ownership);
+ strategy.writeDataToFile(code, path, fileName,
+ UUID: UUID, ownership: ownership);
}
}
diff --git a/lib/generation/generators/value_objects/file_structure_strategy/commands/node_file_structure_command.dart b/lib/generation/generators/value_objects/file_structure_strategy/commands/node_file_structure_command.dart
index 4766a983..4b4d56ae 100644
--- a/lib/generation/generators/value_objects/file_structure_strategy/commands/node_file_structure_command.dart
+++ b/lib/generation/generators/value_objects/file_structure_strategy/commands/node_file_structure_command.dart
@@ -1,5 +1,6 @@
import 'package:parabeac_core/generation/generators/value_objects/file_structure_strategy/commands/file_structure_command.dart';
import 'package:parabeac_core/generation/generators/value_objects/file_structure_strategy/file_ownership_policy.dart';
+import 'package:path/path.dart';
/// Class that relies on `code` to implement its `write` method.
abstract class NodeFileStructureCommand extends FileStructureCommand {
@@ -9,7 +10,6 @@ abstract class NodeFileStructureCommand extends FileStructureCommand {
/// through [write]
FileOwnership ownership;
- NodeFileStructureCommand(String UUID, this.code,
- this.ownership)
+ NodeFileStructureCommand(String UUID, this.code, this.ownership)
: super(UUID);
}
diff --git a/lib/generation/generators/value_objects/file_structure_strategy/pb_file_structure_strategy.dart b/lib/generation/generators/value_objects/file_structure_strategy/pb_file_structure_strategy.dart
index aa332535..6189ae61 100644
--- a/lib/generation/generators/value_objects/file_structure_strategy/pb_file_structure_strategy.dart
+++ b/lib/generation/generators/value_objects/file_structure_strategy/pb_file_structure_strategy.dart
@@ -185,6 +185,10 @@ abstract class FileStructureStrategy implements CommandInvoker {
p.setExtension(
name, fileOwnershipPolicy.getFileExtension(ownership, ext)));
+ if (FileOwnership.PBC == ownership) {
+ data = _setHeader(data);
+ }
+
if (_fileSystemAnalyzer.containsFile(file.path) &&
ownership == FileOwnership.DEV) {
/// file is going to be ignored
@@ -248,6 +252,18 @@ abstract class FileStructureStrategy implements CommandInvoker {
}
}
+ String _setHeader(String code) {
+ return '''
+// *********************************************************************************
+// PARABEAC-GENERATED CODE. DO NOT MODIFY.
+//
+// FOR MORE INFORMATION ON HOW TO USE PARABEAC, PLEASE VISIT docs.parabeac.com
+// *********************************************************************************
+ ''' +
+ '\n\n' +
+ code;
+ }
+
File getFile(String directory, String name) => File(p.join(directory, name));
}
diff --git a/lib/generation/generators/writers/pb_flutter_writer.dart b/lib/generation/generators/writers/pb_flutter_writer.dart
index 28f71f15..c43f43d1 100644
--- a/lib/generation/generators/writers/pb_flutter_writer.dart
+++ b/lib/generation/generators/writers/pb_flutter_writer.dart
@@ -97,14 +97,8 @@ class MyApp extends StatelessWidget {
}
/// Add assets
- if (modifiableyaml.containsKey('flutter')) {
- var assets = _getAssetFileNames();
-
- /// If there are no assets to add, simply return.
- if (assets.isEmpty) {
- return;
- }
-
+ var assets = _getAssetFileNames();
+ if (modifiableyaml.containsKey('flutter') && assets.isNotEmpty) {
/// Add only elements that are not already in the yaml
if (modifiableyaml['flutter'].containsKey('assets') &&
modifiableyaml['flutter']['assets'] != null) {
diff --git a/pubspec.yaml b/pubspec.yaml
index 71ac646e..8837c2e7 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: parabeac_core
description: Continuous Design / Continuous Integration for Figma-to-Flutter
-version: 2.6.0
+version: 2.6.1
# homepage: https://www.example.com
environment: