在 Android 14 中不显示用 Obx 包装的小部件

问题描述 投票:0回答:1

当我在调试模式下使用 Obx 时,会显示 taskt 小部件,但在 Android 14 中的发布模式下,不会显示小部件,但删除 Obx 可以解决此问题,即使将其替换为 Get builder 仍然可以解决问题

class SMSPage extends GetView<GetLicenseController> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('SMS'),
      ),
      body: SizedBox(
        width: Get.width,
        height: Get.height,
        child: Center(
          child: Obx(() => Text(
                'sender:${controller.sender} \n message:${controller.body} \n time recive:${controller.timeRecived}',
                style: TextStyle(color: Colors.black),
              )),
        ),
      ),
    );
  }
}
flutter mobile release flutter-getx android-14
1个回答
0
投票

您是否尝试启用所有例外?没发现什么问题吗?

controller.sender和controller.body字段有.obs值吗?

Obx 小部件应该具有 Obs 值才能刷新。

尝试将.value添加到controller.sender和controller.body。

© www.soinside.com 2019 - 2024. All rights reserved.