Closed a395726103 closed 9 months ago
提供一下代码
提供一下代码
上面发了代码
没用过 GetX,我也不知道这题怎么解,Controller 理应随页面结束而更换,没理由一直保持旧的 Controller 不变。
试试使用 binding 来管理 Controller
// routes: {
// '/map_demo': (context) => WXMapView(),
// },
getPages: [
GetPage(
name: "/map_demo",
page: () => WXMapView(),
binding: WXMapViewBinding(),
),
],
class WXMapViewBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<WXMapViewController>(() => WXMapViewController());
}
}
class WXMapView extends GetView<WXMapViewController> {
WXMapView({super.key}) {}
.......
没用过 GetX,我也不知道这题怎么解,Controller 理应随页面结束而更换,没理由一直保持旧的 Controller 不变。
页面中有Platform View才会导致不能释放,没有Platform View可以正常释放
试试使用 binding 来管理 Controller
// routes: { // '/map_demo': (context) => WXMapView(), // }, getPages: [ GetPage( name: "/map_demo", page: () => WXMapView(), binding: WXMapViewBinding(), ), ],
class WXMapViewBinding implements Bindings { @override void dependencies() { Get.lazyPut<WXMapViewController>(() => WXMapViewController()); } }
class WXMapView extends GetView<WXMapViewController> { WXMapView({super.key}) {} .......
你这个只适合跳转的新页面,不适合一个页面嵌套多个页面的情况
没用过 GetX,我也不知道这题怎么解,Controller 理应随页面结束而更换,没理由一直保持旧的 Controller 不变。
可不可以给Platform View提供一个手动释放的函数
没用过 GetX,我也不知道这题怎么解,Controller 理应随页面结束而更换,没理由一直保持旧的 Controller 不变。
可不可以给Platform View提供一个手动释放的函数
加个 dispose 应该可以
已修复,请使用 mpflutter_core: 2.1.2 mpflutter_build_tools: 2.1.2 mpflutter_wechat_api: 2.1.0 mpflutter_wechat_mapview: 0.0.3
awesome_project.zip demo中地图页面第一次进去会正常初始化,返回页面够再进去GetxController因为没释放,所以不会初始化了,