FigmaComponent.container
The FigmaComponent.container
renders Figma frames, rectangles, and other container elements as Flutter widgets. It preserves all visual properties like colors, borders, shadows, and shapes.
Basic Usage
FigmaComponent.container(
"my_container_name",
child: YourChildWidget(), // Optional child widget
)
Parameters
Parameter | Type | Description |
---|---|---|
componentName | String | The name of the container component in your Figma file |
child | Widget? | Optional child widget to render inside the container |
alignment | AlignmentGeometry? | Optional alignment for the child widget |
How It Works
- The component looks for a node with the specified name in your Figma file
- It renders all visual properties of that node (background, border, shadows, etc.)
- If a child widget is provided, it's rendered inside the container
- The result is a Flutter widget that faithfully represents your Figma container
Container with Child
FigmaComponent.container(
"profile_card",
child: Column(
children: [
Avatar(user: currentUser),
Text(currentUser.name),
Text(currentUser.email),
],
),
)
Container with Alignment
FigmaComponent.container(
"centered_container",
alignment: Alignment.center,
child: Icon(Icons.check_circle, size: 48),
)
Nested Containers
FigmaComponent.container(
"outer_card",
child: FigmaComponent.container(
"inner_content",
child: Text("Nested content"),
),
)
Best Practices
- Design with proper constraints: Ensure your Figma containers use appropriate constraints to handle different screen sizes
- Use descriptive names: Give your Figma containers clear, descriptive names
- Keep layer structure clean: Avoid deeply nested layers for better performance
- Consider responsiveness: Design your containers to adapt to different screen sizes
This component is ideal for creating backgrounds, cards, panels, and other container elements from your Figma designs.