i used extended nested scrollview with easy refresh but i have some issues.one of them is (_AssertionError ('package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart': Failed assertion: line 1760 pos 9: 'result': is not true.))
when i pull down page to refresh and then scrolling down cause this issue but not every time...(1 time in 5 try).
the app is not crashing and i dont have any issu in performance but i want to know how can i handle this issue and it can cause proble in my project or not?
thanks
@xuelongqy
@fluttercandies
https://user-images.githubusercontent.com/120022216/206173224-d9df0ae8-2940-495c-8e59-ddbc97f26341.mp4
`import 'dart:async';
import 'package:example/widget/skeleton_item.dart';
import 'package:flutter/material.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:get/get.dart';
class TabBarViewPage extends StatefulWidget {
const TabBarViewPage({Key? key}) : super(key: key);
@override
TabBarViewPageState createState() {
return TabBarViewPageState();
}
}
class TabBarViewPageState extends State
with SingleTickerProviderStateMixin {
late TabController _tabController;
int _listCount = 20;
int _gridCount = 20;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
final themeData = Theme.of(context);
return Scaffold(
body: EasyRefresh.builder(
header: ClassicHeader(
clamping: true,
position: IndicatorPosition.locator,
mainAxisAlignment: MainAxisAlignment.end,
dragText: 'Pull to refresh'.tr,
armedText: 'Release ready'.tr,
readyText: 'Refreshing...'.tr,
processingText: 'Refreshing...'.tr,
processedText: 'Succeeded'.tr,
noMoreText: 'No more'.tr,
failedText: 'Failed'.tr,
messageText: 'Last updated at %T'.tr,
),
footer: ClassicFooter(
position: IndicatorPosition.locator,
dragText: 'Pull to load'.tr,
armedText: 'Release ready'.tr,
readyText: 'Loading...'.tr,
processingText: 'Loading...'.tr,
processedText: 'Succeeded'.tr,
noMoreText: 'No more'.tr,
failedText: 'Failed'.tr,
messageText: 'Last updated at %T'.tr,
),
onRefresh: () async {
await Future.delayed(const Duration(seconds: 2), () {
if (mounted) {
setState(() {
if (_tabController.index == 0) {
_listCount = 20;
} else {
_gridCount = 20;
}
});
}
});
},
onLoad: () async {
await Future.delayed(const Duration(seconds: 2), () {
if (mounted) {
setState(() {
if (_tabController.index == 0) {
_listCount += 10;
} else {
_gridCount += 10;
}
});
}
});
},
childBuilder: (context, physics) {
return ScrollConfiguration(
behavior: const ERScrollBehavior(),
child: ExtendedNestedScrollView(
physics: physics,
onlyOneScrollInBody: true,
pinnedHeaderSliverHeightBuilder: () {
return MediaQuery.of(context).padding.top + kToolbarHeight;
},
headerSliverBuilder: (context, innerBoxIsScrolled) {
return [
const HeaderLocator.sliver(clearExtent: false),
SliverAppBar(
expandedHeight: 300,
pinned: true,
bottom: PreferredSize(
preferredSize: Size.fromHeight(70),
child: TabBar(
controller: _tabController,
labelColor: themeData.colorScheme.primary,
indicatorColor: themeData.colorScheme.primary,
tabs: const [
Tab(
text: 'List',
),
Tab(
text: 'Grid',
),
],
),
),
),
];
},
body: TabBarView(
controller: _tabController,
children: [
ExtendedVisibilityDetector(
uniqueKey: const Key('Tab0'),
child: _AutomaticKeepAlive(
child: CustomScrollView(
physics: physics,
slivers: [
SliverList(
delegate:
SliverChildBuilderDelegate((context, index) {
return const SkeletonItem();
}, childCount: _listCount)),
const FooterLocator.sliver(),
],
),
),
),
ExtendedVisibilityDetector(
uniqueKey: const Key('Tab1'),
child: _AutomaticKeepAlive(
child: CustomScrollView(
physics: physics,
slivers: [
SliverGrid(
delegate:
SliverChildBuilderDelegate((context, index) {
return const SkeletonItem(
direction: Axis.horizontal,
);
}, childCount: _gridCount),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 6 / 7,
)),
const FooterLocator.sliver(),
],
),
),
),
],
),
),
);
},
),
);
}
}
class _AutomaticKeepAlive extends StatefulWidget {
final Widget child;
const _AutomaticKeepAlive({
Key? key,
required this.child,
}) : super(key: key);
@override
State<_AutomaticKeepAlive> createState() => _AutomaticKeepAliveState();
}
class _AutomaticKeepAliveState extends State<_AutomaticKeepAlive>
with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return widget.child;
}
@override
bool get wantKeepAlive => true;
}
`