flutter_blockly 1.0.3 copy "flutter_blockly: ^1.0.3" to clipboard
flutter_blockly: ^1.0.3 copied to clipboard

outdated

A Flutter Blockly visual programming editor. The Blockly library adds an editor to your app that represents coding concepts as interlocking blocks.

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_blockly/flutter_blockly.dart';

import 'content.dart';

void main() {
  runApp(
    const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: WebViewApp(),
    ),
  );
}

class WebViewApp extends StatefulWidget {
  const WebViewApp({super.key});

  @override
  State<WebViewApp> createState() => _WebViewAppState();
}

class _WebViewAppState extends State<WebViewApp> {
  final workspaceConfiguration = {
    'grid': {
      'spacing': 20,
      'length': 3,
      'colour': '#ccc',
      'snap': true,
    },
    'toolbox': initialToolboxJson,
  };

  void onInject(state) {
    debugPrint('onInject: ${state.xml}\n${jsonEncode(state.json)}');
  }

  void onChange(state) {
    debugPrint('onChange: ${state.xml}\n${jsonEncode(state.json)}');
  }

  void onDispose(state) {
    debugPrint('onDispose: ${state.xml}\n${jsonEncode(state.json)}');
  }

  void onError(dynamic err) {
    debugPrint('onError: $err');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: BlocklyEditorWidget(
          workspaceConfiguration: workspaceConfiguration,
          initial: initialJson,
          onInject: onInject,
          onChange: onChange,
          onDispose: onDispose,
          onError: onError,
        ),
      ),
    );
  }
}
8
likes
0
points
41
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Blockly visual programming editor. The Blockly library adds an editor to your app that represents coding concepts as interlocking blocks.

Repository (GitHub)
View/report issues

Topics

#blockly #flutter-blockly

License

unknown (license)

Dependencies

flutter, webview_flutter

More

Packages that depend on flutter_blockly

Packages that implement flutter_blockly