-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Onix-Systems/dev
Dev
- Loading branch information
Showing
98 changed files
with
5,015 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
|
||
# Onix Flutter Project Generator | ||
|
||
|
||
## Creating DMG installer | ||
|
||
Use following command: | ||
|
||
`rm ‘release/Onix Flutter Project Generator.dmg’ && flutter clean && flutter build macos --release && appdmg installers/dmg_creator/config.json ‘release/Onix Flutter Project Generator.dmg’` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//ignore: one_member_abstracts | ||
abstract class Mapper<T, E> { | ||
E map(T from); | ||
} | ||
|
||
abstract class MapperIterable<T, E> extends Mapper<T, E> { | ||
Iterable<E> mapIterable(Iterable<T> from) { | ||
return from.map(map); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/connector/connector_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/document/document_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/frame/frame_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/node/node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/section/section_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/shape_with_text/shape_with_text_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/sticky/sticky_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/table_cell/table_cell_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/text/text_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/vector/vector_node_data_model.dart'; | ||
|
||
class FigmaNodeTypeConverter | ||
extends JsonConverter<NodeDataModel, Map<String, dynamic>> { | ||
const FigmaNodeTypeConverter(); | ||
|
||
@override | ||
NodeDataModel fromJson(Map<String, dynamic> json) { | ||
final type = json['type']; | ||
|
||
switch (type) { | ||
case 'DOCUMENT': | ||
return DocumentNodeDataModel.fromJson(json); | ||
case 'FRAME': | ||
case 'COMPONENT': | ||
case 'COMPONENT_SET': | ||
case 'INSTANCE': | ||
case 'GROUP': | ||
return FrameNodeDataModel.fromJson(json); | ||
case 'SECTION': | ||
return SectionNodeDataModel.fromJson(json); | ||
case 'VECTOR': | ||
case 'BOOLEAN_OPERATION': | ||
case 'STAR': | ||
case 'LINE': | ||
case 'ELLIPSE': | ||
case 'REGULAR_POLYGON': | ||
case 'WASHI_TAPE': | ||
case 'RECTANGLE': | ||
return VectorNodeDataModel.fromJson(json); | ||
case 'TEXT': | ||
return TextNodeDataModel.fromJson(json); | ||
case 'TABLE_CELL': | ||
return TableCellNodeDataModel.fromJson(json); | ||
case 'STICKY': | ||
return StickyNodeDataModel.fromJson(json); | ||
case 'SHAPE_WITH_TEXT': | ||
return ShapeWithTextNodeDataModel.fromJson(json); | ||
case 'CONNECTOR': | ||
return ConnectorNodeDataModel.fromJson(json); | ||
default: | ||
return NodeDataModel.fromJson(json); | ||
} | ||
} | ||
|
||
@override | ||
Map<String, dynamic> toJson(NodeDataModel object) { | ||
// TODO(Ivan Modlo): Implement it if necessary | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:onix_flutter_bricks/data/converter/figma/figma_node_type_converter.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/node/node_data_model.dart'; | ||
|
||
class FigmaNodesConverter | ||
extends JsonConverter<List<NodeDataModel>, Map<String, dynamic>> { | ||
const FigmaNodesConverter(); | ||
|
||
@override | ||
List<NodeDataModel> fromJson(Map<String, dynamic> json) { | ||
final list = json.values | ||
.map( | ||
(e) => const FigmaNodeTypeConverter().fromJson( | ||
(e as Map<String, dynamic>)['document'], | ||
), | ||
) | ||
.toList(); | ||
|
||
return list; | ||
} | ||
|
||
@override | ||
Map<String, dynamic> toJson(List<NodeDataModel> object) { | ||
// TODO(Ivan Modlo): Implement it if necessary | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
import 'package:onix_flutter_bricks/core/arch/domain/common/converter/mapper.dart'; | ||
import 'package:onix_flutter_bricks/data/mapper/figma/properties_mapper.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/connector/connector_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/document/document_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/frame/frame_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/node/node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/section/section_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/shape_with_text/shape_with_text_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/sticky/sticky_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/table_cell/table_cell_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/text/text_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/nodes/vector/vector_node_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/properties/paint/paint_property_data_model.dart'; | ||
import 'package:onix_flutter_bricks/data/model/figma/properties/type_style/figma_type_style.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/connector_node/connector_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/document_node/document_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/frame_node/frame_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/node/base_node.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/node/base_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/section_node/section_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/shape_with_text_node/shape_with_text_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/sticky_node/sticky_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/table_cell_node/table_cell_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/text_node/text_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/nodes/vector_node/vector_node_entity.dart'; | ||
import 'package:onix_flutter_bricks/domain/entity/figma/properties/paint_property/paint_property.dart'; | ||
|
||
class FigmaNodesMapper { | ||
List<BaseNode> mapNodesDataModelToEntity(List<NodeDataModel> from) => | ||
_MapNodeDataModelToEntity().mapIterable(from).toList(); | ||
} | ||
|
||
class _MapNodeDataModelToEntity | ||
extends MapperIterable<NodeDataModel, BaseNode> { | ||
@override | ||
BaseNode map(NodeDataModel from) { | ||
switch (from) { | ||
case (DocumentNodeDataModel _): | ||
return DocumentNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
// (Ivan Modlo): Maybe we should call the map method recursively | ||
children: from.children | ||
?.map( | ||
(e) => BaseNodeEntity( | ||
id: e?.id ?? '', | ||
key: e?.key ?? '', | ||
name: e?.name ?? '', | ||
type: e?.type ?? '', | ||
), | ||
) | ||
.toList() ?? | ||
[], | ||
); | ||
case TextNodeDataModel _: | ||
return TextNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
style: PropertyMapper().mapFigmaTypeStyleDataModelToEntity( | ||
from.style ?? | ||
const FigmaTypeStyle( | ||
fontFamily: '', | ||
fontWeight: 0, | ||
fontSize: 0, | ||
letterSpacing: 0, | ||
), | ||
), | ||
); | ||
case FrameNodeDataModel _: | ||
return FrameNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
case SectionNodeDataModel _: | ||
return SectionNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
case VectorNodeDataModel _: | ||
return VectorNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
case TableCellNodeDataModel _: | ||
return TableCellNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
|
||
case StickyNodeDataModel _: | ||
return StickyNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
|
||
case ShapeWithTextNodeDataModel _: | ||
return ShapeWithTextNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
case ConnectorNodeDataModel _: | ||
return ConnectorNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
fills: _mapPaintProperty(from.fills), | ||
); | ||
default: | ||
return BaseNodeEntity( | ||
id: from.id ?? '', | ||
key: from.key ?? '', | ||
name: from.name ?? '', | ||
type: from.type ?? '', | ||
); | ||
} | ||
} | ||
|
||
List<PaintProperty> _mapPaintProperty(List<PaintPropertyDataModel>? from) => | ||
PropertyMapper().mapPaintPropertyDataModelToEntity(from ?? []).toList(); | ||
} |
Oops, something went wrong.