try to address context issues after inactivity
This commit is contained in:
+12
-2
@@ -86,6 +86,8 @@ class ViewTabSheetWidget extends HookConsumerWidget {
|
|||||||
final scrolledTo = useRef(0.0);
|
final scrolledTo = useRef(0.0);
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
|
||||||
final header = headerKey.currentContext?.findRenderObject();
|
final header = headerKey.currentContext?.findRenderObject();
|
||||||
final text = textFieldKey.currentContext?.findRenderObject();
|
final text = textFieldKey.currentContext?.findRenderObject();
|
||||||
|
|
||||||
@@ -96,6 +98,7 @@ class ViewTabSheetWidget extends HookConsumerWidget {
|
|||||||
|
|
||||||
final relative = totalHeight / MediaQuery.of(context).size.height;
|
final relative = totalHeight / MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
if (relative >= 0 && relative <= 1) {
|
||||||
if (draggableScrollableController.size < relative &&
|
if (draggableScrollableController.size < relative &&
|
||||||
relative > scrolledTo.value) {
|
relative > scrolledTo.value) {
|
||||||
await draggableScrollableController.animateTo(
|
await draggableScrollableController.animateTo(
|
||||||
@@ -107,13 +110,15 @@ class ViewTabSheetWidget extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
final bottomInsets = useRef(0.0);
|
final bottomInsets = useRef(0.0);
|
||||||
useEffect(() {
|
useEffect(
|
||||||
|
() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final diff =
|
final diff =
|
||||||
((MediaQuery.of(context).viewInsets.bottom / 2) /
|
((MediaQuery.of(context).viewInsets.bottom / 2) /
|
||||||
@@ -128,7 +133,12 @@ class ViewTabSheetWidget extends HookConsumerWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, [MediaQuery.of(context).viewInsets.bottom]);
|
},
|
||||||
|
[
|
||||||
|
MediaQuery.of(context).viewInsets.bottom,
|
||||||
|
MediaQuery.of(context).size.height,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
return NestedScrollView(
|
return NestedScrollView(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
|||||||
Reference in New Issue
Block a user