Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

连续调用loading,可控频闪现象 #137

Closed
SeeYouWilsen opened this issue Jun 26, 2023 · 9 comments
Closed

连续调用loading,可控频闪现象 #137

SeeYouWilsen opened this issue Jun 26, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@SeeYouWilsen
Copy link

SeeYouWilsen commented Jun 26, 2023

版本信息

  • Flutter版本:[3.7.9]
  • flutter_smart_dialog版本:[4.9.2]

描述bug/需求

iOS上 mask Color不起作用

问题demo

FlutterSmartDialog.init(
          loadingBuilder: (String msg) => CustomSmartLoadingWidget(msg),
          toastBuilder: (msg) => CustomSmartToastWidget(msg),
        )

class _CustomSmartLoadingWidgetState extends State<CustomSmartLoadingWidget> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Lottie.asset(AppLottie.loading, width: 50, fit: BoxFit.fitWidth, animate: true, repeat: true),
          if (widget.msg.isNotEmpty == true)
            const SizedBox(
              height: 30,
            ),
          if (widget.msg.isNotEmpty == true)
            Text(
              widget.msg,
              style: TextStyles.tsPrimary14,
            ),
          if (widget.btnText?.isNotEmpty == true)
            Container(
                width: double.infinity,
                margin: const EdgeInsets.only(left: 90, right: 90, top: 30),
                child: MaterialButton(
                  elevation: 0,
                  height: 48,
                  shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
                  color: AppColor.primary,
                  onPressed: widget.btnOnTap,
                  child: Text(
                    widget.btnText ?? '',
                    style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                  ),
                ))
        ],
      ),
    );
  }
}
@xdd666t
Copy link
Member

xdd666t commented Jun 26, 2023

这demo写的是个啥?重新弄下吧,能直接运行的全部简化代码

@SeeYouWilsen
Copy link
Author

看错了 不是这个引起的 是因为在有loading的时候 又弹了一个新的loading 导致前面设置的不起效果了

@SeeYouWilsen
Copy link
Author

但是好像这种弹起多个loading情况也没有办法避免,有办法让他永远只弹同一个吗?比如单例?

@xdd666t
Copy link
Member

xdd666t commented Jun 26, 2023

loading本来就是单个overlayEntry,后一个会顶掉前一个,这个只是你对loading设置不一样导致的

@xdd666t xdd666t closed this as completed Jun 26, 2023
@xdd666t xdd666t self-assigned this Jun 26, 2023
@xdd666t xdd666t added the usage problem Some doubts about usage label Jun 26, 2023
@SeeYouWilsen
Copy link
Author

就是后面的顶掉前面的 会导致loading的效果看上去会有闪动 有办法让它始终保持这一个loading吗?

@xdd666t
Copy link
Member

xdd666t commented Jun 26, 2023

我周末想想怎么弄

@xdd666t xdd666t reopened this Jun 26, 2023
@SeeYouWilsen
Copy link
Author

感谢! 辛苦了!

@xdd666t xdd666t added enhancement New feature or request and removed usage problem Some doubts about usage labels Jun 26, 2023
@xdd666t xdd666t changed the title iOS上 mask Color不起作用 连续调用loading,可控频闪现象 Jun 26, 2023
xdd666t added a commit that referenced this issue Jul 2, 2023
@xdd666t
Copy link
Member

xdd666t commented Jul 2, 2023

  • 解决了,试下新版本吧
dependencies:
  flutter_smart_dialog: ^4.9.3+1
  • 测试代码
void _showLoading() async {
  SmartDialog.showLoading(msg: "test one");
  await Future.delayed(const Duration(seconds: 1));
  SmartDialog.showLoading(msg: "test two");
  await Future.delayed(const Duration(seconds: 1));
  SmartDialog.showLoading(msg: "test three");
  await Future.delayed(const Duration(seconds: 1));
  SmartDialog.dismiss();
}

xdd666t added a commit that referenced this issue Jul 2, 2023
@SeeYouWilsen
Copy link
Author

  • 解决了,试下新版本吧
dependencies:

  flutter_smart_dialog: ^4.9.3+1
  • 测试代码
void _showLoading() async {

  SmartDialog.showLoading(msg: "test one");

  await Future.delayed(const Duration(seconds: 1));

  SmartDialog.showLoading(msg: "test two");

  await Future.delayed(const Duration(seconds: 1));

  SmartDialog.showLoading(msg: "test three");

  await Future.delayed(const Duration(seconds: 1));

  SmartDialog.dismiss();

}

太棒了!非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants