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

网络请求封装不显示toast #191

Closed
hstk1993 opened this issue May 27, 2024 · 11 comments
Closed

网络请求封装不显示toast #191

hstk1993 opened this issue May 27, 2024 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@hstk1993
Copy link

版本信息

  • flutter_smart_dialog版本:flutter_smart_dialog: ^4.9.4+5

描述bug/需求

网络请求封装loading和toast, 频繁出现loading关闭不了,toast显示不出来,如果在关闭loading之前显示toast就能显示出来

问题demo

Future<HttpResponseEntity?> request(
String url, {
String? method,
Map<String, dynamic>? params,
Object? data,
bool showLoading = true,
bool showToast = true,
CancelToken? cancelToken,
}) async {
try {
if (showLoading) YDToast.showLoading();
final response = await _dio.request(
url,
options: Options(method: method ?? 'GET'),
queryParameters: params,
data: data,
cancelToken: cancelToken,
);
if (showLoading) await YDToast.dismissLoading();

  final code = response.data?.code;
  if (code != 0 && !([401, 402].contains(code)) && showToast) {
    YDToast.showToast(response.data?.msg ?? 'msg:null');
  }

import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:zhaopin/base/base_build_value.dart';
import 'package:zhaopin/base/base_stateless_widget.dart';

class YDToast {
static Future<T?> showLoading() {
return SmartDialog.showLoading(
maskColor: Colors.transparent,
usePenetrate: false,
clickMaskDismiss: false,
animationTime: const Duration(milliseconds: 200),
);
}

static Future dismissLoading() async {
return await SmartDialog.dismiss(status: SmartStatus.loading);
}

static Future showToast(
String msg, {
bool clickMaskDismiss = false,
}) {
return SmartDialog.showToast(
msg,
usePenetrate: false,
maskColor: Colors.transparent,
clickMaskDismiss: clickMaskDismiss,
alignment: Alignment.center,
animationTime: const Duration(milliseconds: 200),
displayTime: msg.length > 10
? const Duration(milliseconds: 2000)
: const Duration(milliseconds: 1000),
);
}
}

class YDLoadingWidget extends BaseStatelessWidget {
const YDLoadingWidget({super.key});

@OverRide
Widget ydBuild(BuildContext context, BaseBuildValue value) {
return SpinKitRing(
color: value.theme.brand_color_6,
size: 40,
lineWidth: 5,
);
}
}

class YDToastWidget extends StatelessWidget {
final String msg;

const YDToastWidget(this.msg, {super.key});

@OverRide
Widget build(BuildContext context) {
return Align(
alignment: Alignment.center,
child: Container(
constraints:
BoxConstraints(maxWidth: MediaQuery.of(context).size.width - 100),
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
color: Colors.black87, borderRadius: BorderRadius.circular(5)),
child: Text(
msg,
style: const TextStyle(fontSize: 15, color: Colors.white),
),
),
);
}
}

@hstk1993 hstk1993 changed the title 网络请求封装不限时toast 网络请求封装不显示toast May 27, 2024
@xdd666t
Copy link
Member

xdd666t commented May 27, 2024

给下简化, 能直接运行, 且能复现问题的demo, 给上面的代码没什么意义

@xdd666t xdd666t self-assigned this May 27, 2024
@hstk1993
Copy link
Author

show() async {
await Future.delayed(const Duration(seconds: 3));
SmartDialog.showLoading();
await Future.delayed(const Duration(milliseconds: 3000));
await SmartDialog.dismiss(status: SmartStatus.loading);
SmartDialog.showToast('测试a');
}
这样toast是不显示的

xdd666t added a commit that referenced this issue May 27, 2024
@xdd666t
Copy link
Member

xdd666t commented May 27, 2024

  • 试试新版本
dependencies:
  flutter_smart_dialog: ^4.9.7+6

xdd666t added a commit that referenced this issue May 27, 2024
xdd666t added a commit that referenced this issue May 27, 2024
@xdd666t xdd666t added the bug Something isn't working label May 27, 2024
@hstk1993
Copy link
Author

牛,现在能弹出来了,但是有个新问题,原来没这个报错,现在有了,是用在网络请求里的,
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: setState() or markNeedsBuild() called during build.
This SmartOverlay widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
The widget on which setState() or markNeedsBuild() was called was:
SmartOverlay
The widget which was currently being built when the offending call was made was:
Builder
#0 Element.markNeedsBuild. (package:flutter/src/widgets/framework.dart:5042:9)
#1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:5054:6)
#2 State.setState (package:flutter/src/widgets/framework.dart:1223:15)
#3 _SmartOverlayState.initState. (package:flutter_smart_dialog/src/widget/helper/smart_overlay.dart:35:11)
#4 SmartOverlayController.show (package:flutter_smart_dialog/src/widget/helper/smart_overly_controller.dart:14:14)
#5 DialogProxy._beforeShow (package:flutter_smart_dialog/src/helper/dialog_proxy.dart:365:34)
#6 DialogProxy.showLoading (package:flutter_smart_dialog/src/helper/dialog_proxy.dart:295:11)
#7 SmartDialog.showLoading (package:flutter_smart_dialog/src/smart_dialog.dart:717:33)
#8 YDToast.showLoading (package:zhaopin/widget/yd_toast.dart:9:24)
#9 HttpUtils.request (package:zhaopin/net/http_utils.dart:67:32)
#10 HttpUtils.get (package:zhaopin/net/http_utils.dart:120:12)
#11 _JobEditBaseInfoPageState._fetchJobDetail (package:zhaopin/b/pages/job_management/job_edit/job_edit_base_info/page.dart:146:10)
#12 _JobEditBaseInfoPageState.initJobDetail (package:zhaopin/b/pages/job_management/job_edit/job_edit_base_info/page.dart:119:13)
#13 _JobEditBaseInfoPageState.initState (package:zhaopin/b/pages/job_management/job_edit/job_edit_base_info/page.dart:109:7)
#14 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5611:55)
#15 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#17 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#18 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#20 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#21 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#22 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#23 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#24 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#25 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#26 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#27 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#29 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#30 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#31 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#32 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#33 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#34 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#35 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#36 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#37 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#38 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#40 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6893:36)
#41 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6905:32)
#42 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#43 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#44 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#45 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#46 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#47 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#48 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#49 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#50 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#51 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#52 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#53 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#54 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#55 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#56 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#57 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#58 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#59 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#60 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#61 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#62 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#63 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#64 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#65 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#66 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#67 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#68 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#69 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#70 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#71 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#72 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#73 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#74 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#75 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#76 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#77 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#78 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#79 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#80 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#81 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#82 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#83 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#84 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#85 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#86 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#87 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#88 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#89 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#90 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#91 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#92 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#93 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#94 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#95 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#96 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#97 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#98 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#99 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#100 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#101 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#102 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#103 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#104 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#105 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#106 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#107 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#108 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#109 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#110 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#111 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#112 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#113 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#114 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#115 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#116 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#117 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#118 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#119 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#120 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#121 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#122 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#123 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#124 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#125 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#126 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#127 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#128 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#129 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#130 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#131 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#132 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#133 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#134 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#135 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#136 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#137 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#138 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#139 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#140 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#141 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#142 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#143 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#144 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#145 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#146 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#147 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#148 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#149 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#150 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#151 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#152 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#153 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#154 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#155 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#156 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#157 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#158 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#159 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#160 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#161 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#162 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#163 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#164 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#165 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#166 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#167 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#168 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#169 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#170 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#171 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#172 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#173 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#174 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#175 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#176 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#177 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#178 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#179 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#180 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#181 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#182 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#183 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#184 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#185 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#186 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#187 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#188 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#189 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#190 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6758:14)
#191 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#192 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#193 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#194 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#195 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#196 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#197 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#198 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#199 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#200 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#201 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#202 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#203 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#204 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#205 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#206 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#207 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#208 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#209 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#210 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#211 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#212 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#213 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#214 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#215 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#216 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#217 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#218 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
#219 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#220 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6893:36)
#221 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#222 Element.updateChildren (package:flutter/src/widgets/framework.dart:4033:32)
#223 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6918:17)
#224 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#225 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#226 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#227 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#228 StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#229 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#230 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#231 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#232 ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#233 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#234 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#235 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#236 ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#237 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:105:11)
#238 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#239 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#240 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#241 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#242 StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#243 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#244 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#245 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#246 ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#247 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:105:11)
#248 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#249 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#250 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#251 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#252 StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#253 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#254 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#255 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#256 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#257 StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#258 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#259 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6765:14)
#260 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#261 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6765:14)
#262 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#263 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#264 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#265 ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#266 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#267 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#268 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#269 ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#270 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#271 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#272 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#273 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#274 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2904:19)
#275 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:989:21)
#276 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#277 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#278 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#279 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#280 _invoke (dart:ui/hooks.dart:312:13)
#281 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#282 _drawFrame (dart:ui/hooks.dart:283:31)

@xdd666t
Copy link
Member

xdd666t commented May 28, 2024

给下复现这个异常的demo

@hstk1993
Copy link
Author

hstk1993 commented May 28, 2024

//b页面
@OverRide
void initState() {
super.initState();
SmartDialog.showLoading();
}

A 页面跳转B页面

@hstk1993
Copy link
Author

大佬还在吗

@xdd666t
Copy link
Member

xdd666t commented May 30, 2024

工作日没时间, 周末再看

@pangyu646182805
Copy link

我也会出现这个异常 也是网络请求封装弹loading弹窗 在WidgetsBinding.instance.addPostFrameCallback这个回调里面弹窗就正常

@xdd666t
Copy link
Member

xdd666t commented Jun 1, 2024

dependencies:
  flutter_smart_dialog: ^4.9.7+7

@hstk1993
Copy link
Author

hstk1993 commented Jun 3, 2024

管用 🐮

@xdd666t xdd666t closed this as completed Jun 3, 2024
xdd666t added a commit that referenced this issue Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants