扫一扫分享
MXFlutter是一套基于JS的高性能Flutter动态化框架,它用极类似Dart的开发方式,通过编写JavaScript代码,来开发Flutter应用。
第一步: Flutter侧,创建并启动MXJSFlutterApp
MXJSFlutter.getInstance().setup();
MXJSFlutter.getInstance().runJSApp(jsAppName: "app_test", pageName: null);
第二步: JS侧,编写MXJSWidget页面
class AppTest extends MXJSFlutterApp {
constructor() {
super("app_test", "initRouteName");
}
createJSWidgetWithName(pageName) {
let w = new JSWidgetHomePage;
return w;
}
}
function main(pageName) {
MXJSLog.log("main:pageName" + pageName);
let app = new AppTest;
runApp(app);
}
第三步:Flutter侧,进入MXJSWidget页面
Navigator.push(context, MaterialPageRoute(builder: (context) => MXJSFlutter.getInstance().navigatorPushWithPageName("JSWidgetHomePage")));
手机预览