fix tab sheet scroll logic
This commit is contained in:
+4
-6
@@ -456,13 +456,10 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final lastScroll = useRef<String?>(null);
|
final lastScroll = useRef<String?>(null);
|
||||||
final scrollControllerIsAttached = useListenableSelector(
|
|
||||||
sheetScrollController,
|
|
||||||
() => sheetScrollController.hasClients,
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (scrollControllerIsAttached) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (sheetScrollController.hasClients) {
|
||||||
if (lastScroll.value != activeTab) {
|
if (lastScroll.value != activeTab) {
|
||||||
final index = filteredTabEntities.value.indexWhere(
|
final index = filteredTabEntities.value.indexWhere(
|
||||||
(entity) => entity.tabId == activeTab,
|
(entity) => entity.tabId == activeTab,
|
||||||
@@ -485,9 +482,10 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, [filteredTabEntities, activeTab, scrollControllerIsAttached]);
|
}, [filteredTabEntities, activeTab]);
|
||||||
|
|
||||||
final tabs = useMemoized(() {
|
final tabs = useMemoized(() {
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user