wait for scroll controller attachment
This commit is contained in:
+17
-3
@@ -346,7 +346,14 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
final lastScroll = useRef<String?>(null);
|
||||
useEffect(() {
|
||||
final scrollControllerIsAttached = useListenableSelector(
|
||||
sheetScrollController,
|
||||
() => sheetScrollController.hasClients,
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
if (scrollControllerIsAttached) {
|
||||
if (lastScroll.value != activeTab) {
|
||||
final index = filteredTabEntities.value.indexWhere(
|
||||
(entity) => entity.tabId == activeTab,
|
||||
@@ -368,9 +375,16 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}, [filteredTabEntities, activeTab]);
|
||||
},
|
||||
[
|
||||
filteredTabEntities,
|
||||
activeTab,
|
||||
scrollControllerIsAttached,
|
||||
],
|
||||
);
|
||||
|
||||
final tabs = useMemoized(() {
|
||||
return filteredTabEntities.value
|
||||
@@ -391,7 +405,7 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: FadingScroll(
|
||||
fadingSize: 10,
|
||||
fadingSize: 5,
|
||||
controller: sheetScrollController,
|
||||
builder: (context, controller) {
|
||||
return ReorderableBuilder.builder(
|
||||
|
||||
Reference in New Issue
Block a user