Skip to main content

fluttercanvas_core 0.3.1 copy "fluttercanvas_core: ^0.3.1" to clipboard
fluttercanvas_core: ^0.3.1 copied to clipboard

Design model, JSON format and responsive Flutter code generator behind FlutterCanvas, the open-source drag-and-drop Flutter UI builder.

fluttercanvas_core #

pub package CI License: MIT

The design model, JSON format and code generator behind FlutterCanvas, the open-source, Figma-like UI builder for Flutter.

This package is pure Dart: read, write and generate code from designs in a Flutter app, a command-line tool or a backend.

Features #

  • Design model. CanvasProject (screens), CanvasDocument (one screen) and WidgetNode (the widget tree), all immutable, with JSON support.
  • 17 widget types, including boxes with auto layout, free canvases, responsive grids and custom code for any pub.dev package.
  • Code generator. FlutterCodeGenerator writes a ready-to-copy lib folder that only depends on material.dart: named routes, one file per screen, app bars, bottom navigation, entrance animations, const where possible, and // TODO comments where your logic goes.
  • Templates. CanvasTemplates.ecommerce() and more.
  • AI prompts. DesignPrompt builds prompts so any AI model can create or change designs, and reads replies back safely.
  • CLI to export a design from the terminal.

Install #

dependencies:
  fluttercanvas_core: ^0.3.0

Generate Flutter code #

import 'package:fluttercanvas_core/fluttercanvas_core.dart';

void main() {
  final project = CanvasProject.fromJsonString(jsonFromYourServer);
  for (final file in const FlutterCodeGenerator().generateProject(project)) {
    print('${file.path}\n${file.content}');
  }
}

Or export one screen as a single self-contained file:

final code = const FlutterCodeGenerator().generate(project.initialScreen);

Build a design in code #

final screen = CanvasDocument.blank(name: 'Profile');
final title = WidgetCatalog.create(WidgetTypes.text)
    .withProp('text', 'Hello from FlutterCanvas')
    .withProp('fontSize', 24);
final design = screen.copyWith(
  root: screen.root.insert(screen.root.id, 0, title),
);
print(design.toJsonString(pretty: true));

Command line #

dart run fluttercanvas_core:fluttercanvas export design.json .

Design format #

A project is JSON with screens, and each screen has a tree of widgets with props. The format guide lists every widget and property.

License #

MIT

2
likes
160
points
682
downloads

Documentation

API reference

Publisher

verified publishersoftwaylab.com

Weekly Downloads

Design model, JSON format and responsive Flutter code generator behind FlutterCanvas, the open-source drag-and-drop Flutter UI builder.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ui #code-generation #drag-and-drop #responsive

License

MIT (license)

More

Packages that depend on fluttercanvas_core