Skip to content

Commit 7475ad2

Browse files
fengmloccfeng4
and
ccfeng4
authored
🚀 Replace debugDoingBuild flag with SchedulerPhase (#97)
Co-authored-by: ccfeng4 <ccfeng4@iflytek.com>
1 parent 4f4c822 commit 7475ad2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log
22

3+
## 3.3.1
4+
5+
- Replace `context.debugDoingBuild` flag with `SchedulerBinding.instance.schedulerPhase`. (#97)
6+
37
## 3.3.0
48

59
- Abstract `BuildContextPredicate`. (#95)

‎lib/src/core/toast.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'dart:collection';
55
import 'dart:ui' as ui;
66

77
import 'package:flutter/material.dart' hide Overlay, OverlayEntry, OverlayState;
8+
import 'package:flutter/scheduler.dart';
89

910
import '../widget/animation/animation_builder.dart';
1011
import '../widget/overlay.dart';
@@ -189,7 +190,7 @@ ToastFuture showToastWidget(
189190
}
190191
}
191192

192-
if (!context.debugDoingBuild && context.owner?.debugBuilding != true) {
193+
if (SchedulerBinding.instance.schedulerPhase != SchedulerPhase.persistentCallbacks) {
193194
insertOverlayEntry();
194195
} else {
195196
WidgetsBinding.instance.addPostFrameCallback((_) {

‎pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: oktoast
22
description: A pure flutter toast library, support custom style/widget, easy achieve the same effect with native toasts.
33
email: cjl_spy@163.com
44
homepage: https://github.com/OpenFlutter/flutter_oktoast
5-
version: 3.3.0
5+
version: 3.3.1
66

77
environment:
88
sdk: '>=2.17.0 <3.0.0'

0 commit comments

Comments
 (0)