Skip to content

Commit baa05aa

Browse files
committed
process #229
1 parent cf4071c commit baa05aa

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

example/lib/main.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ class SmartDialogPage extends StatelessWidget {
112112
targetContext: context,
113113
alignment: Alignment.bottomCenter,
114114
animationType: SmartAnimationType.scale,
115-
highlightBuilder: (_, __) {
116-
return Positioned(child: Container());
117-
},
118-
scalePointBuilder: (selfSize) => Offset(selfSize.width, 0),
119115
builder: (_) {
120116
return Container(height: 50, width: 30, color: Colors.red);
121117
},

lib/src/widget/helper/attach_widget.dart

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class AttachWidget extends StatefulWidget {
5454
State<AttachWidget> createState() => _AttachWidgetState();
5555
}
5656

57-
class _AttachWidgetState extends State<AttachWidget> {
57+
class _AttachWidgetState extends State<AttachWidget>
58+
with WidgetsBindingObserver {
5859
late double _postFrameOpacity;
5960

6061
//offset size
@@ -71,17 +72,30 @@ class _AttachWidgetState extends State<AttachWidget> {
7172

7273
@override
7374
void initState() {
75+
WidgetsBinding.instance.addObserver(this);
7476
_alignment = widget.alignment;
7577
_resetState();
7678
super.initState();
7779
}
7880

81+
@override
82+
void dispose() {
83+
WidgetsBinding.instance.removeObserver(this);
84+
super.dispose();
85+
}
86+
7987
@override
8088
void didUpdateWidget(covariant AttachWidget oldWidget) {
89+
super.didUpdateWidget(oldWidget);
8190
if (oldWidget.originChild != widget.originChild ||
8291
oldWidget.targetContext != widget.targetContext ||
8392
oldWidget.targetBuilder != widget.targetBuilder) _resetState();
84-
super.didUpdateWidget(oldWidget);
93+
}
94+
95+
@override
96+
void didChangeMetrics() {
97+
super.didChangeMetrics();
98+
_resetState();
8599
}
86100

87101
@override

0 commit comments

Comments
 (0)