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 #641 from Parabeac/dev
Browse files Browse the repository at this point in the history
Dev - 2.8.2
  • Loading branch information
mergify[bot] committed Apr 22, 2022
2 parents bb620e4 + d5d5916 commit 96f2739
Show file tree
Hide file tree
Showing 64 changed files with 209 additions and 17 deletions.
1 change: 0 additions & 1 deletion lib/generation/generators/layouts/pb_layout_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ abstract class PBLayoutGenerator extends PBGenerator {
buffer.write(')');
}

// Return complete layout generated
return buffer.toString();
}

Expand Down
12 changes: 1 addition & 11 deletions lib/generation/generators/layouts/pb_stack_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,10 @@ class PBStackGenerator extends PBGenerator {
buffer.write(')');
}
if (source.parent is InjectedAppbar) {
return containerWrapper(buffer.toString(), source);
return containerWrapper(buffer.toString(), source, context);
}
return buffer.toString();
}
return '';
}

String containerWrapper(String body, PBIntermediateNode source) {
return '''
Container(
height: ${source.frame.height},
width: ${source.frame.width},
child: $body
)
''';
}
}
28 changes: 26 additions & 2 deletions lib/generation/generators/pb_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import 'package:parabeac_core/interpret_and_optimize/entities/subclasses/pb_inte
import 'package:parabeac_core/interpret_and_optimize/helpers/pb_context.dart';
import 'package:quick_log/quick_log.dart';

import 'attribute-helper/pb_box_decoration_gen_helper.dart';

abstract class PBGenerator {
final String OBJECTID = 'UUID';
static String MEDIAQUERY_HORIZONTAL_BOILERPLATE = 'MediaQuery.of(context).size.width';
static String MEDIAQUERY_VERTICAL_BOILERPLATE = 'MediaQuery.of(context).size.height';
static String MEDIAQUERY_HORIZONTAL_BOILERPLATE =
'MediaQuery.of(context).size.width';
static String MEDIAQUERY_VERTICAL_BOILERPLATE =
'MediaQuery.of(context).size.height';

Logger logger;

Expand All @@ -23,4 +27,24 @@ abstract class PBGenerator {
}

String generate(PBIntermediateNode source, PBContext context);

/// Method that wraps `this` with a `Container`.
///
/// The container will also contain the [source]'s `styling` properties if applicable.
/// The container will contain [source]'s `width` and `height` properties if [includeSize] is `true`.
String containerWrapper(
String body,
PBIntermediateNode source,
PBContext context, {
bool includeSize = true,
}) {
var decoration = PBBoxDecorationHelper().generate(source, context);
return '''
Container(
${includeSize ? 'width: ${source.frame.width}, height: ${source.frame.height},' : ''}
${decoration.isEmpty || decoration.contains('BoxDecoration()') ? '' : '$decoration'}
child: $body,
)
''';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ class PBContainerGenerator extends PBGenerator {
var buffer = StringBuffer();
buffer.write('Container(');

/// Add clip behavior in case children needs to be clipped
/// TODO: Extend to different kinds of clip
if (source.auxiliaryData.clipsContent ?? false) {
buffer.write('clipBehavior: Clip.hardEdge,');
}

//TODO(ivanV): please clean my if statement :(
if (source is InjectedContainer) {
if (source.padding != null) {
Expand Down
2 changes: 2 additions & 0 deletions lib/interpret_and_optimize/entities/inherited_circle.g.dart

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

2 changes: 2 additions & 0 deletions lib/interpret_and_optimize/entities/inherited_material.g.dart

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

2 changes: 2 additions & 0 deletions lib/interpret_and_optimize/entities/inherited_scaffold.g.dart

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

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PBIntermediateConstraints {
factory PBIntermediateConstraints.fromJson(Map<String, dynamic> json) =>
_$PBIntermediateConstraintsFromJson(json);

/// Returns a `PBIntermediateConstraints` instance where all values are set to false.
factory PBIntermediateConstraints.defaultConstraints() =>
PBIntermediateConstraints(
pinBottom: false,
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class PBLayoutGenerationService extends AITHandler {
IntermediateAxisMode.FIXED,
)
..layoutCrossAxisSizing = tempLayout.layoutCrossAxisSizing
..layoutMainAxisSizing = tempLayout.layoutMainAxisSizing;
..layoutMainAxisSizing = tempLayout.layoutMainAxisSizing
..auxiliaryData = tempGroup.auxiliaryData;

// Let the tree know that the layout will be
// wrapped by the Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ class IntermediateAuxiliaryData {
@JsonKey(ignore: true)
PBColor color;

@JsonKey(defaultValue: false)
bool clipsContent;

IntermediateAuxiliaryData({
this.colors,
this.borderInfo,
this.effects,
this.intermediateTextStyle,
this.clipsContent,
}) {
if (colors != null) {
color = _calculateBlendColor();
Expand Down

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

8 changes: 7 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:parabeac_core/interpret_and_optimize/entities/pb_shared_master_n
import 'package:parabeac_core/controllers/main_info.dart';
import 'package:parabeac_core/generation/flutter_project_builder/file_system_analyzer.dart';
import 'package:parabeac_core/generation/flutter_project_builder/flutter_project_builder.dart';
import 'package:parabeac_core/interpret_and_optimize/entities/subclasses/pb_intermediate_constraints.dart';
import 'package:parabeac_core/interpret_and_optimize/helpers/component_isolation_configuration.dart';
import 'package:parabeac_core/interpret_and_optimize/helpers/pb_configuration.dart';
import 'package:parabeac_core/interpret_and_optimize/helpers/pb_context.dart';
Expand Down Expand Up @@ -304,6 +305,11 @@ Future<List<PBIntermediateTree>> treeHasMaster(PBIntermediateTree tree) async {
var forest = [tree];
for (var element in tree) {
if (element is PBSharedMasterNode && element.parent != null) {
var elementConstraints = element.constraints.copyWith();

/// Since this is now a [PBSharedMasterNode], we need to remove the constraints
/// and pass them on to the instance.
element.constraints = PBIntermediateConstraints.defaultConstraints();
var tempTree = PBIntermediateTree(name: element.name)
..rootNode = element
..tree_type = TREE_TYPE.VIEW
Expand Down Expand Up @@ -336,7 +342,7 @@ Future<List<PBIntermediateTree>> treeHasMaster(PBIntermediateTree tree) async {
)
..layoutCrossAxisSizing = element.layoutCrossAxisSizing
..layoutMainAxisSizing = element.layoutMainAxisSizing
..constraints = element.constraints
..constraints = elementConstraints
..auxiliaryData = element.auxiliaryData;
tree.replaceNode(element, newInstance);
}
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: 2.8.1
version: 2.8.2
# homepage: https://www.example.com

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk1 extends State<ColHzFxVrFxSpPk1> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk2 extends State<ColHzFxVrFxSpPk2> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk3 extends State<ColHzFxVrFxSpPk3> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk4 extends State<ColHzFxVrFxSpPk4> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk5 extends State<ColHzFxVrFxSpPk5> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk6 extends State<ColHzFxVrFxSpPk6> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk7 extends State<ColHzFxVrFxSpPk7> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk8 extends State<ColHzFxVrFxSpPk8> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpPk9 extends State<ColHzFxVrFxSpPk9> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpSb147 extends State<ColHzFxVrFxSpSb147> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpSb258 extends State<ColHzFxVrFxSpSb258> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrFxSpSb369 extends State<ColHzFxVrFxSpSb369> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrHgSpPk147 extends State<ColHzFxVrHgSpPk147> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrHgSpPk258 extends State<ColHzFxVrHgSpPk258> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class _ColHzFxVrHgSpPk369 extends State<ColHzFxVrHgSpPk369> {
bottom: 10.0,
),
width: 326.000,
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class _ColHzHgVrFxSpPk1 extends State<ColHzHgVrFxSpPk1> {
top: 10.0,
bottom: 10.0,
),
decoration: BoxDecoration(
color: Colors.black,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Loading

0 comments on commit 96f2739

Please sign in to comment.