和GetX一起使用的话会导致对话框无法关闭
- Dominant language
- Java
- Stars
- 20.4k
- Forks
- 3.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 2
Description
引入GetX后,使用GetX提供的对话框方法后,无法关闭显示的对话框
```
GetX: https://github.com/jonataslaw/getx
```
期望的表现: 对话框关闭
Flutter版本 `1.26.0-2.0.pre.275 • channel master •`
iOS模拟器上出现
iOS版本: iOS 13.4
模拟器型号: iPhone 8
Android实体机上出现
Android版本: Android 10
型号: Pixel XL
```
// 依赖
dependencies:
get:
dokit: 0.2.5
```
代码
```
// 初始化
DoKit.runApp(
app: DoKitApp(MyApp()),
// 是否在release包内使用,默认release包会禁用
useInRelease: true,
releaseAction: () => {
// release模式下执行该函数,一些用到runZone之类实现的可以放到这里,该值为空则会直接调用系统的runApp(MyApp()),
});
```
```
// MyApp
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) { return ScreenUtilInit(
designSize: Size(750, 1334),
allowFontScaling: false,
child: OKToast(
child: GetMaterialApp(
title: 'App',
translations: IntlTranslations(),
locale: ui.window.locale,
fallbackLocale: Locale('en'),
// 代理路由
getPages: GetRouter.getPages(),
theme: ThemeData(
primaryColor: AppColors.primary,
),
// 启动路由为home界面
initialRoute: '/splash',
),
),
);
}
}
```
```
// 对话框类
class LoadingUtils {
LoadingUtils._internal();
static void showLoadingDialog({String? content}) {
print('isDialog open before : ${Get.isDialogOpen}');
Get.dialog(LoadingDialog(content: content ?? 'Loading'),
barrierDismissible: false);
// 没添加Dokit之前,isDialogOpen是true,加了之后,isDialogOpen为false
print('isDialog open after: ${Get.isDialogOpen}');
}
static void hideLoadingDialog() {
print('isDialog open: ${Get.isDialogOpen} ${Get.routing.current}');
Get.back();
}
}
```
Contributor guide
Research direction
Start by reproducing the issue with DoKit.runApp, GetMaterialApp, Get.dialog, and Get.back using the dependency versions and Flutter environment listed. Inspect the DoKit initialization and dialog-related integration points, then verify on the reported iOS simulator and Android device setups that Get.isDialogOpen becomes true and the dialog closes as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- devtools, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100