A Flutter library for rendering Figma designs at runtime with high fidelity. This is the rendering engine that powers the Morphr synchronization service.
Morphr uses a three-layer architecture to convert Figma nodes into Flutter widgets:
Adapters abstract Figma node properties and convert them into Flutter-friendly formats. Each adapter handles a specific aspect:
FigmaShapeAdapter
: Handles shape properties (fills, strokes, corners)FigmaTextAdapter
: Manages text properties and stylesFigmaLayoutAdapter
: Converts Figma auto-layout to Flutter layoutFigmaBarAdapter
: Specializes in navigation bars adaptationFigmaVectorAdapter
: Handles vector nodes and pathsFigmaDecorationAdapter
: Manages visual properties and effects
Renderers use adapters to create actual Flutter widgets:
FigmaShapeRenderer
: Renders rectangles, ellipses, and framesFigmaTextRenderer
: Renders text nodes with proper stylingFigmaFlexRenderer
: Handles auto-layout containersFigmaVectorRenderer
: Renders vector graphicsFigmaAppbarRenderer
&FigmaBottomBarRenderer
: Specialized navigation bar renderers
High-level widgets that combine renderers and adapters into reusable pieces:
FigmaComponent
: Base class for all componentsFigmaContainerComponent
: Renders frames and shapesFigmaTextComponent
: Text renderingFigmaButtonComponent
: Interactive buttonsFigmaListComponent
: Scrollable lists- And more...
- Activate the Morphr CLI:
dart pub global activate --source git https://github.com/intales/morphr.git
# or
dart pub global activate --source path .
# Run
morphr download
- Download a Figma file:
morphr download --token YOUR_FIGMA_TOKEN --file YOUR_FILE_ID --output design.json
Or use the interactive mode:
morphr download
The CLI will guide you through:
- Entering your Figma access token
- Specifying the file ID
- Choosing the output location
- Add Morphr to your pubspec.yaml:
dependencies:
morphr:
git: https://github.com/intales/morphr
- Basic usage example:
// Create a text component
final text = FigmaComponent.text(
'my_text_component',
text: 'Hello World',
);
// Create a button
final button = FigmaComponent.button(
'my_button_component',
onPressed: () => print('Button pressed'),
);
// Create an auto-layout container
final container = FigmaComponent.column(
'my_container',
children: [text, button],
);
- Using navigation bars:
// AppBar with safe area handling
final appBar = FigmaComponent.appBar(
'app_bar_component',
context: context,
children: [/* your items */],
);
// Bottom bar
final bottomBar = FigmaComponent.bottomBar(
'bottom_bar_component',
children: [/* your items */],
);
- High-fidelity rendering: Preserves Figma design details including gradients, shadows, and effects
- Native Flutter layout: Uses Flutter's layout system for optimal performance
- Safe area handling: Proper handling of notches, status bars, and system UI
- Vector support: Renders Figma vectors as Flutter paths
- Responsive: Adapts to different screen sizes while maintaining design fidelity
-
Auto-layout:
- Complex nested auto-layouts might need manual adjustment
- Some Figma constraints behaviors might differ slightly
-
Text:
- Custom fonts must be included in your Flutter project
- Some advanced text decorations might not render exactly as in Figma
-
Effects:
- Complex blend modes might have slight visual differences
- Some advanced Figma effects might need simplification
- Layout behavior and constraints handling
- Navigation bars integration with system UI
- Vector rendering performance
- Component API ergonomics
MIT License - see LICENSE file for details
The synchronization service is a separate commercial product.