Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #748 from Parabeac/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SushiRoll53 authored Mar 24, 2023
2 parents 33832ea + 236e069 commit ab0cf03
Show file tree
Hide file tree
Showing 71 changed files with 253 additions and 213 deletions.
2 changes: 1 addition & 1 deletion lib/configurations/configurations.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"tablet": 600,
"desktop": 1280
},
"designSystem": "material2",
"designSystem": "material3",
"componentIsolation": "widgetbook",
"folderArchitecture": "domain",
"project-name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class PBSizeHelper extends PBAttributesHelper {

// Size for LayoutBuilder
sizeString =
'$lowerCaseDimentionString: widget.constraints.max$dimentionString * ${relativeSize.toString()},';
'$lowerCaseDimentionString: constraints.max$dimentionString * ${relativeSize.toString()},';
}
} else {
// Size for constants value
Expand Down
6 changes: 5 additions & 1 deletion lib/generation/generators/pb_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ abstract class PBGenerator {

Logger logger;

/// Chain of responsability restructure
PBGenerator next;

///The [TemplateStrategy] that is going to be used to generate the boilerplate code around the node.
///
///The `default` [TemplateStrategy] is going to be [InlineTemplateStrategy]
TemplateStrategy templateStrategy;

PBGenerator({TemplateStrategy strategy}) {
PBGenerator({TemplateStrategy strategy, this.next}) {
templateStrategy = strategy;
templateStrategy ??= InlineTemplateStrategy();
logger = Logger(runtimeType.toString());
Expand Down
27 changes: 27 additions & 0 deletions lib/generation/generators/symbols/layout_builder_gen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:parabeac_core/generation/generators/pb_generator.dart';
import 'package:parabeac_core/generation/generators/value_objects/template_strategy/stateful_template_strategy.dart';
import 'package:parabeac_core/interpret_and_optimize/entities/subclasses/pb_intermediate_node.dart';
import 'package:parabeac_core/interpret_and_optimize/helpers/pb_context.dart';
import 'package:quick_log/quick_log.dart';

class LayoutBuilderGenerator extends PBGenerator {
LayoutBuilderGenerator(PBGenerator next)
: super(strategy: StatefulTemplateStrategy(), next: next);

var log = Logger('Layout Builder Generator');
@override
String generate(PBIntermediateNode source, PBContext context) {
var buffer = StringBuffer();
buffer.write('LayoutBuilder( \n');
buffer.write(' builder: (context, constraints) {\n');
buffer.write(' return ');

buffer.write(next.generate(source, context));

buffer.write(';\n');
buffer.write('}\n');
buffer.write(')');

return buffer.toString();
}
}
10 changes: 0 additions & 10 deletions lib/generation/generators/symbols/pb_instancesym_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class PBSymbolInstanceGenerator extends PBGenerator {
String generate(PBIntermediateNode source, PBContext generatorContext) {
if (source is PBSharedInstanceIntermediateNode) {
var buffer = StringBuffer();
buffer.write('LayoutBuilder( \n');
buffer.write(' builder: (context, constraints) {\n');
buffer.write(' return ');

// If storage found an instance, get its master
var masterSymbol =
Expand All @@ -34,12 +31,6 @@ class PBSymbolInstanceGenerator extends PBGenerator {
generatorContext,
));

// end of return <genSymbolInstance>();
buffer.write(';\n');
// end of builder: (context, constraints) {
buffer.write('}\n');
// end of LayoutBuilder()
buffer.write(')');
return buffer.toString();
}
return '';
Expand Down Expand Up @@ -93,7 +84,6 @@ class PBSymbolInstanceGenerator extends PBGenerator {

buffer.write(symName.pascalCase);
buffer.write('(\n');
buffer.write('constraints,\n');

// Make sure override property of every value is overridable
if (overrideValues != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ class StatefulTemplateStrategy extends TemplateStrategy {
${manager.generateImports()}
class $widgetName extends StatefulWidget{
${node is PBSharedMasterNode ? 'final BoxConstraints constraints;' : ''}
$overrideVars
const $widgetName(${node is PBSharedMasterNode ? 'this.constraints,' : ''} {Key? key, $overrides}) : super(key: key);
const $widgetName({Key? key, $overrides}) : super(key: key);
@override
_$widgetName createState() => _$widgetName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class StatelessTemplateStrategy extends TemplateStrategy {
${manager.generateImports()}
class ${widgetName.pascalCase} extends StatelessWidget{
${node is PBSharedMasterNode ? 'final BoxConstraints constraints;' : ''}
${overrideVars.isNotEmpty ? overrideVars : ''}
const ${widgetName.pascalCase}(${node is PBSharedMasterNode ? 'this.constraints,' : ''} {Key? key, ${overrides.isNotEmpty ? overrides : ''}}) : super(key : key);
const ${widgetName.pascalCase}({Key? key, ${overrides.isNotEmpty ? overrides : ''}}) : super(key : key);
${manager.generateGlobalVariables()}
@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class PBPositionedGenerator extends PBGenerator {
} else if (sizingValueContext ==
SizingValueContext.LayoutBuilderStatefulValue) {
if (_positionedValue.isXAxis) {
return 'widget.constraints.maxWidth *';
return 'constraints.maxWidth *';
} else {
return 'widget.constraints.maxHeight *';
return 'constraints.maxHeight *';
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:parabeac_core/generation/generators/symbols/layout_builder_gen.dart';
import 'package:parabeac_core/generation/generators/symbols/pb_mastersym_gen.dart';
import 'package:parabeac_core/generation/prototyping/pb_prototype_node.dart';
import 'package:parabeac_core/interpret_and_optimize/entities/interfaces/pb_inherited_intermediate.dart';
Expand Down Expand Up @@ -70,8 +71,7 @@ class PBSharedMasterNode extends PBVisualIntermediateNode
this.sharedNodeSetID,
}) : super(UUID, frame, name, constraints: constraints) {
overridableProperties ??= [];

generator = PBMasterSymbolGenerator();
generator = LayoutBuilderGenerator(PBMasterSymbolGenerator());
childrenStrategy = TempChildrenStrategy('child');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/interpret_and_optimize/helpers/pb_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class PBConfiguration {
///This is going to be defaulted to [GenerationConfiguration] if nothing else is specified.
GenerationConfiguration generationConfiguration;

@JsonKey(defaultValue: 'material2')
@JsonKey(defaultValue: 'material3')
String designSystem;

/// The type of folder architecture that Parabeac-Core should follow
Expand Down
2 changes: 1 addition & 1 deletion lib/interpret_and_optimize/helpers/pb_configuration.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/tags/custom_tag/custom_tag.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ class CustomTagGenerator extends PBGenerator {
),
MainInfo().projectName,
).toString();
suffix =
'?? $baseCompName(BoxConstraints(maxWidth: ${child.parent.frame.width}, maxHeight: ${child.parent.frame.height},))';
suffix = '?? const $baseCompName()';
}

return '''
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: parabeac_core
description: Continuous Design / Continuous Integration for Figma-to-Flutter

version: 3.6.0
version: 4.0.0
homepage: https://www.parabeac.com

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AdminCitySectionEditScreen extends StatefulWidget {
const AdminCitySectionEditScreen({
Key? key,
}) : super(key: key);

@override
_AdminCitySectionEditScreen createState() => _AdminCitySectionEditScreen();
}
Expand All @@ -44,11 +45,7 @@ class _AdminCitySectionEditScreen extends State<AdminCitySectionEditScreen> {
right: 44.0,
top: 0,
height: 280.0,
child: LayoutBuilder(builder: (context, constraints) {
return OrcaCityAdminHeader(
constraints,
);
}),
child: OrcaCityAdminHeader(),
),
Positioned(
left: 36.0,
Expand Down Expand Up @@ -89,12 +86,7 @@ class _AdminCitySectionEditScreen extends State<AdminCitySectionEditScreen> {
right: 0,
top: 84.0,
height: 335.0,
child: LayoutBuilder(
builder: (context, constraints) {
return FullArticle(
constraints,
);
}),
child: FullArticle(),
),
])),
SizedBox(
Expand Down Expand Up @@ -213,39 +205,21 @@ class _AdminCitySectionEditScreen extends State<AdminCitySectionEditScreen> {
Container(
height: 75.0,
width: 75.0,
child: LayoutBuilder(
builder: (context,
constraints) {
return LabelButton(
constraints,
);
})),
child: LabelButton()),
SizedBox(
width: 16.0,
),
Container(
height: 75.0,
width: 75.0,
child: LayoutBuilder(
builder: (context,
constraints) {
return LabelButton(
constraints,
);
})),
child: LabelButton()),
SizedBox(
width: 16.0,
),
Container(
height: 75.0,
width: 75.0,
child: LayoutBuilder(
builder: (context,
constraints) {
return LabelButton(
constraints,
);
})),
child: LabelButton()),
])))),
])),
SizedBox(
Expand All @@ -270,12 +244,7 @@ class _AdminCitySectionEditScreen extends State<AdminCitySectionEditScreen> {
width: 540.0,
top: 0,
height: 303.75,
child: LayoutBuilder(builder:
(context, constraints) {
return EditMainImage(
constraints,
);
}),
child: EditMainImage(),
),
]))),
),
Expand Down Expand Up @@ -407,24 +376,14 @@ class _AdminCitySectionEditScreen extends State<AdminCitySectionEditScreen> {
width: 540.0,
top: 0,
height: 335.0,
child: LayoutBuilder(builder:
(context, constraints) {
return DeleteImageComponent(
constraints,
);
}),
child: DeleteImageComponent(),
),
Positioned(
left: 0,
width: 540.0,
top: 354.0,
height: 335.0,
child: LayoutBuilder(builder:
(context, constraints) {
return DeleteImageComponent(
constraints,
);
}),
child: DeleteImageComponent(),
),
])))),
])),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk1 extends StatefulWidget {
const ColHzFxVrFxSpPk1({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk1 createState() => _ColHzFxVrFxSpPk1();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk2 extends StatefulWidget {
const ColHzFxVrFxSpPk2({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk2 createState() => _ColHzFxVrFxSpPk2();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk3 extends StatefulWidget {
const ColHzFxVrFxSpPk3({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk3 createState() => _ColHzFxVrFxSpPk3();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk4 extends StatefulWidget {
const ColHzFxVrFxSpPk4({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk4 createState() => _ColHzFxVrFxSpPk4();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk5 extends StatefulWidget {
const ColHzFxVrFxSpPk5({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk5 createState() => _ColHzFxVrFxSpPk5();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk6 extends StatefulWidget {
const ColHzFxVrFxSpPk6({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk6 createState() => _ColHzFxVrFxSpPk6();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk7 extends StatefulWidget {
const ColHzFxVrFxSpPk7({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk7 createState() => _ColHzFxVrFxSpPk7();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk8 extends StatefulWidget {
const ColHzFxVrFxSpPk8({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk8 createState() => _ColHzFxVrFxSpPk8();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpPk9 extends StatefulWidget {
const ColHzFxVrFxSpPk9({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpPk9 createState() => _ColHzFxVrFxSpPk9();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpSb147 extends StatefulWidget {
const ColHzFxVrFxSpSb147({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpSb147 createState() => _ColHzFxVrFxSpSb147();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpSb258 extends StatefulWidget {
const ColHzFxVrFxSpSb258({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpSb258 createState() => _ColHzFxVrFxSpSb258();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ColHzFxVrFxSpSb369 extends StatefulWidget {
const ColHzFxVrFxSpSb369({
Key? key,
}) : super(key: key);

@override
_ColHzFxVrFxSpSb369 createState() => _ColHzFxVrFxSpSb369();
}
Expand Down
Loading

0 comments on commit ab0cf03

Please sign in to comment.