flutter_blockly
所属分类:代码编辑器
开发工具:Dart
文件大小:0KB
下载次数:0
上传日期:2024-02-10 16:32:58
上 传 者:
sh-1993
说明: 一个Flutter Blockly可视化编程编辑器。
(A Flutter Blockly visual programming editor.)
文件列表:
example/
lib/
test/
.metadata
CHANGELOG.md
LICENSE
analysis_options.yaml
publish.md
pubspec.yaml
# flutter_blockly
[![Built on Blockly](https://tinyurl.com/built-on-blockly)](https://github.com/google/blockly)
[![pub version](https://img.shields.io/pub/v/flutter_blockly.svg)](https://pub.dev/packages/flutter_blockly)
Click to see the screenshot
![Flutter Blockly editor](https://github-production-user-asset-6210df.s3.amazonaws.com/26460350/283968394-fdf46ed0-276b-4171-86fb-94f5d69940e4.png)
## [Change Log](https://github.com/react-blockly/flutter_blockly/blob/main/CHANGELOG.md).
## Usage
[BlocklyOptions interface](https://developers.google.com/blockly/reference/js/blockly.blocklyoptions_interface)
Click to see the code
```dart
import 'package:flutter_blockly/flutter_blockly.dart';
// ...
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: BlocklyEditorWidget(
workspaceConfiguration: workspaceConfiguration,
initial: initial,
onInject: onInject,
onChange: onChange,
onDispose: onDispose,
onError: onError,
),
),
);
}
void onChange({xml, json, dart, js, lua, php, python}) {
}
```
for it to work for web browsers, you must add\
`blockly.min.js` in [web/index.html](https://github.com/react-blockly/flutter_blockly/blob/main/example/web/index.html)
```html
```
or if you want to use additional methods, see how it's implemented here
IOS and Android [BlocklyEditorWidget](https://github.com/react-blockly/flutter_blockly/blob/main/lib/src/blockly_editor_widget.dart)
Click to see the code
```dart
import 'package:flutter_blockly/flutter_blockly.dart';
import 'package:webview_flutter/webview_flutter.dart';
// ...
class _MyWidgetState extends State {
late final BlocklyEditor editor;
@override
void initState() {
super.initState();
editor = BlocklyEditor(
workspaceConfiguration: widget.workspaceConfiguration,
initial: widget.initial,
onError: widget.onError,
onInject: widget.onInject,
onChange: widget.onChange,
onDispose: widget.onDispose,
);
// then you will have methods and WebViewController:
// editor.init();
// editor.dispose();
// editor.onMessage();
// editor.htmlRender();
// editor.updateToolboxConfig();
// editor.updateState();
// editor.postData();
// editor.runJS();
// editor.state();
// editor.code();
// editor.blocklyController;
}
}
```
Web [BlocklyEditorWidget](https://github.com/react-blockly/flutter_blockly/blob/main/lib/src/blockly_editor_web_widget.dart)
Click to see the code
```dart
import 'package:flutter_blockly/flutter_blockly.dart';
// ...
class _MyWidgetState extends State {
late final BlocklyEditor editor;
@override
void initState() {
super.initState();
editor = BlocklyEditor(
workspaceConfiguration: widget.workspaceConfiguration,
initial: widget.initial,
onError: widget.onError,
onInject: widget.onInject,
onChange: widget.onChange,
onDispose: widget.onDispose,
);
// then you will have methods:
// editor.init();
// editor.dispose();
// editor.addJavaScriptChannel();
// editor.onMessage();
// editor.htmlRender();
// editor.updateToolboxConfig();
// editor.updateState();
// editor.postData();
// editor.runJS();
// editor.state();
// editor.code();
}
}
```
## Example
[flutter_blockly_example](https://github.com/react-blockly/flutter_blockly/blob/main/example)
## License
[MIT](LICENSE)
近期下载者:
相关文件:
收藏者: