fluttercanvas_renderer 0.3.0
fluttercanvas_renderer: ^0.3.0 copied to clipboard
Render FlutterCanvas JSON designs as real, responsive Flutter widgets at runtime. Server-driven UI for Android, iOS, web and desktop.
fluttercanvas_renderer #
Render FlutterCanvas designs as real Flutter widgets at runtime. Design a screen in the builder, save it as JSON, and show it in any app on Android, iOS, web, macOS, Windows or Linux.
Because designs are plain JSON, you can serve them from your backend and update screens without an app store release (server-driven UI).
Usage #
import 'package:fluttercanvas_renderer/fluttercanvas_renderer.dart';
CanvasView.fromJson(
jsonFromServer,
delegate: CanvasRenderDelegate(
onAction: (action, node) {
if (action == 'checkout') Navigator.pushNamed(context, '/checkout');
},
),
);
Give a button an Action id in the builder, and onAction receives it when
the button is pressed.
Set includeScaffold: false to embed a design inside one of your own screens.
Multiple screens #
CanvasProjectView runs a whole design. Buttons linked to a screen in the
builder open that screen, and "go back" buttons return:
MaterialApp(
home: CanvasProjectView(
project: CanvasProject.fromJsonString(jsonFromServer),
onAction: (action, node) => handle(action),
),
);
Responsive widgets #
AdaptiveRow, ResponsiveGrid and FreeCanvas are exported too, so you can use them in
hand-written code:
ResponsiveGrid(
mobileColumns: 1,
tabletColumns: 2,
desktopColumns: 4,
children: products.map(ProductCard.new).toList(),
);