mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: mounted为false的情况
This commit is contained in:
@@ -110,24 +110,23 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
void didChangeMetrics() {
|
void didChangeMetrics() {
|
||||||
super.didChangeMetrics();
|
super.didChangeMetrics();
|
||||||
final String routePath = Get.currentRoute;
|
final String routePath = Get.currentRoute;
|
||||||
if (mounted){
|
if (!mounted) return;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (!mounted) return;
|
||||||
// 键盘高度
|
// 键盘高度
|
||||||
final viewInsets = EdgeInsets.fromViewPadding(
|
final viewInsets = EdgeInsets.fromViewPadding(
|
||||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||||
_debouncer.run(() {
|
_debouncer.run(() {
|
||||||
if (mounted) {
|
if (!mounted) return;
|
||||||
if (keyboardHeight == 0 && emoteHeight == 0) {
|
if (keyboardHeight == 0 && emoteHeight == 0) {
|
||||||
setState(() {
|
setState(() {
|
||||||
emoteHeight = keyboardHeight =
|
emoteHeight = keyboardHeight =
|
||||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
|||||||
@@ -54,18 +54,18 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
|
|||||||
final String routePath = Get.currentRoute;
|
final String routePath = Get.currentRoute;
|
||||||
if (mounted && routePath.startsWith('/whisper_detail')) {
|
if (mounted && routePath.startsWith('/whisper_detail')) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (!mounted) return;
|
||||||
// 键盘高度
|
// 键盘高度
|
||||||
final viewInsets = EdgeInsets.fromViewPadding(
|
final viewInsets = EdgeInsets.fromViewPadding(
|
||||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||||
_debouncer.run(() {
|
_debouncer.run(() {
|
||||||
if (mounted) {
|
if (!mounted) return;
|
||||||
if (keyboardHeight == 0) {
|
if (keyboardHeight == 0) {
|
||||||
setState(() {
|
setState(() {
|
||||||
emoteHeight = keyboardHeight =
|
emoteHeight = keyboardHeight =
|
||||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user