├── weapp ├── app.wxss ├── main.dart.js ├── plugins.wxml ├── kbone │ └── miniprogram-element │ │ ├── index.wxss │ │ ├── index-vhost.wxss │ │ ├── custom-component │ │ ├── index.wxml │ │ ├── index.wxss │ │ ├── index.json │ │ └── index.js │ │ ├── index-vhost.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index-vhost.json │ │ ├── index.wxml │ │ ├── index-vhost.wxml │ │ ├── template │ │ ├── subtree-cover.wxml │ │ ├── subtree.wxml │ │ └── inner-component.wxml │ │ └── base.js ├── pages │ ├── loading-view │ │ ├── index.wxss │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.js │ └── index │ │ ├── share.json │ │ ├── index.js │ │ ├── share.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── share.wxml ├── mp-custom-components.js ├── sitemap.json ├── package.json ├── app.json ├── plugins.min.js ├── app.js └── project.config.json ├── mpflutter.bat ├── .vscode ├── settings.json ├── launch.json └── tasks.json ├── bin └── main.dart ├── mpflutter ├── scripts ├── help.dart ├── build_mpk.dart ├── build_web.dart ├── build_weapp.dart └── build_plugins.dart ├── .gitignore ├── web ├── plugins.min.js └── index.html ├── pubspec.yaml ├── lib ├── mpjs.config.dart ├── second_page.dart └── main.dart ├── README.md └── pubspec.lock /weapp/app.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/main.dart.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/plugins.wxml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.wxml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weapp/pages/loading-view/index.wxss: -------------------------------------------------------------------------------- 1 | /* pages/loading-view/index.wxss */ -------------------------------------------------------------------------------- /weapp/mp-custom-components.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "usingComponents": {} 3 | }; 4 | -------------------------------------------------------------------------------- /mpflutter.bat: -------------------------------------------------------------------------------- 1 | set PUB_HOSTED_URL=https://pub.mpflutter.com 2 | flutter %1 %2 %3 %4 %5 %6 %7 %8 %9 -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.json: -------------------------------------------------------------------------------- 1 | {"component":true,"usingComponents":{}} -------------------------------------------------------------------------------- /weapp/pages/loading-view/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /weapp/pages/loading-view/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.env": { 3 | "PUB_HOSTED_URL": "https://pub.mpflutter.com" 4 | } 5 | } -------------------------------------------------------------------------------- /bin/main.dart: -------------------------------------------------------------------------------- 1 | import '../lib/main.dart' as lib; 2 | 3 | void main(List args) { 4 | lib.main(); 5 | } 6 | -------------------------------------------------------------------------------- /mpflutter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export PUB_HOSTED_URL=https://pub.mpflutter.com 4 | flutter $1 $2 $3 $4 $5 $6 $7 $8 $9 -------------------------------------------------------------------------------- /scripts/help.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/help.dart' as help; 2 | 3 | main(List args) { 4 | help.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.js: -------------------------------------------------------------------------------- 1 | const base=require("./base");Component({behaviors:[base],options:{addGlobalClass:!0,virtualHost:!0}}); -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index.js: -------------------------------------------------------------------------------- 1 | const base=require("./base");Component({mixins:base.mixins,behaviors:[base],options:{addGlobalClass:!0}}); -------------------------------------------------------------------------------- /scripts/build_mpk.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_mpk.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/build_web.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_web.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/build_weapp.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_weapp.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .dart_tool/ 3 | .packages 4 | .DS_Store 5 | lib/generated_plugin_registrant.dart 6 | .flutter-plugins 7 | .flutter-plugins-dependencies 8 | -------------------------------------------------------------------------------- /scripts/build_plugins.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_plugins.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /weapp/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /weapp/pages/index/share.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "element": "../../kbone/miniprogram-element/index", 4 | "loading-view": "../loading-view/index" 5 | }, 6 | "enablePullDownRefresh": false 7 | } -------------------------------------------------------------------------------- /weapp/pages/index/index.js: -------------------------------------------------------------------------------- 1 | // index.js 2 | // 获取应用实例 3 | const WXPage = require('../../mpdom.min').WXPage; 4 | 5 | const thePage = new WXPage; 6 | thePage.kboneRender = require('../../kbone/miniprogram-render/index') 7 | Page(thePage); 8 | -------------------------------------------------------------------------------- /weapp/pages/index/share.js: -------------------------------------------------------------------------------- 1 | // share.js 2 | // 获取应用实例 3 | const WXPage = require('../../mpdom.min').WXPage; 4 | 5 | const thePage = new WXPage; 6 | thePage.kboneRender = require('../../kbone/miniprogram-render/index') 7 | Page(thePage); 8 | -------------------------------------------------------------------------------- /weapp/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "element": "../../kbone/miniprogram-element/index", 4 | "loading-view": "../loading-view/index" 5 | }, 6 | "enablePullDownRefresh": false, 7 | "backgroundTextStyle": "dark" 8 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | 5 | { 6 | "name": "MPFlutter", 7 | "request": "launch", 8 | "type": "dart", 9 | "program": "bin/main.dart", 10 | "preLaunchTask": "Pre-compile MPFlutter Plugins" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /weapp/pages/loading-view/index.js: -------------------------------------------------------------------------------- 1 | // pages/loading-view/index.js 2 | Component({ 3 | /** 4 | * 组件的属性列表 5 | */ 6 | properties: { 7 | 8 | }, 9 | 10 | /** 11 | * 组件的初始数据 12 | */ 13 | data: { 14 | 15 | }, 16 | 17 | /** 18 | * 组件的方法列表 19 | */ 20 | methods: { 21 | 22 | } 23 | }) 24 | -------------------------------------------------------------------------------- /weapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "miniprogram_dom": "@mpflutter/miniprogram_dom" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "element": "./index", 5 | "element-vhost": "./index-vhost", 6 | "custom-component": "./custom-component/index" 7 | }, 8 | "componentGenerics": { 9 | "custom-component": { 10 | "default": "./custom-component/index" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "element": "./index", 5 | "element-vhost": "./index-vhost", 6 | "custom-component": "./custom-component/index" 7 | }, 8 | "componentGenerics": { 9 | "custom-component": { 10 | "default": "./custom-component/index" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /weapp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": ["pages/index/index", "pages/index/share"], 3 | "window": { 4 | "backgroundTextStyle": "light", 5 | "navigationBarBackgroundColor": "#fff", 6 | "navigationBarTitleText": "", 7 | "navigationBarTextStyle": "black" 8 | }, 9 | "style": "v2", 10 | "sitemapLocation": "sitemap.json", 11 | "darkmode": true, 12 | "newFramework": { 13 | "enabled": true, 14 | "minimumSupportedVersion": "5.12" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /web/plugins.min.js: -------------------------------------------------------------------------------- 1 | var MPEnv = window.MPDOM.MPEnv;var MPMethodChannel = window.MPDOM.MPMethodChannel;var MPEventChannel = window.MPDOM.MPEventChannel;var MPPlatformView = window.MPDOM.MPPlatformView;var MPComponentFactory = window.MPDOM.ComponentFactory;var pluginRegisterer = window.MPDOM.PluginRegister;try { 2 | window.$mpjs_template_foo = function(arg0) { 3 | alert(new Date().toString()); 4 | return 'foo result: ' + arg0; 5 | }; 6 | } catch (e) { 7 | console.error(e); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mpflutter_template 2 | description: A new MPFlutter project. 3 | publish_to: "none" 4 | version: 1.0.0+1 5 | playbox: 6 | name: 模板工程 7 | description: 8 | icon: school 9 | background: blue 10 | environment: 11 | sdk: ">=2.18.0 <4.0.0" 12 | dependencies: 13 | flutter: "1.3.0" 14 | flutter_web_plugins: "1.3.0" 15 | mpcore: "1.3.0" 16 | mp_build_tools: "1.3.0" 17 | dependency_overrides: 18 | flutter: "1.3.0" 19 | mpcore: "1.3.0" 20 | flutter_web_plugins: "1.3.0" 21 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Pre-compile MPFlutter Plugins", 6 | "type": "shell", 7 | "command": "dart scripts/build_plugins.dart", 8 | "presentation": { 9 | "echo": false, 10 | "reveal": "silent", 11 | "focus": false, 12 | "panel": "shared", 13 | "showReuseMessage": false, 14 | "clear": true 15 | }, 16 | "problemMatcher": [] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /weapp/plugins.min.js: -------------------------------------------------------------------------------- 1 | var MPEnv = require("./mpdom.min").MPEnv;var MPMethodChannel = require("./mpdom.min").MPMethodChannel;var MPEventChannel = require("./mpdom.min").MPEventChannel;var MPPlatformView = require("./mpdom.min").MPPlatformView;var MPComponentFactory = require("./mpdom.min").ComponentFactory;var pluginRegisterer = require("./mpdom.min").PluginRegister;try { 2 | wx.$mpjs_template_foo = function(arg0) { 3 | wx.showModal({title: 'alert', content: (new Date()).toString()}); 4 | return 'foo result: ' + arg0; 5 | } 6 | ; 7 | } catch (e) { 8 | console.error(e); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index.wxml: -------------------------------------------------------------------------------- 1 |