flutter_easy_refresh icon indicating copy to clipboard operation
flutter_easy_refresh copied to clipboard

_AssertionError ('package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart': Failed assertion: line 1760 pos 9: 'result': is not true.)

Open RezaKhajvand opened this issue 2 years ago • 7 comments

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<TabBarViewPage> 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 <Widget>[ 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 <Widget>[ Tab( text: 'List', ), Tab( text: 'Grid', ), ], ), ), ), ]; }, body: TabBarView( controller: _tabController, children: <Widget>[ 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; } `

RezaKhajvand avatar Dec 07 '22 11:12 RezaKhajvand

This problem does exist, but I don't know how to fix it. It doesn't seem to have much impact on usage

xuelongqy avatar Dec 07 '22 12:12 xuelongqy

This problem does exist, but I don't know how to fix it. It doesn't seem to have much impact on usage

no it doesnt impact on usage...i tryed this package with nestedscroll view and tabbar in the bottom of sliverappbar...the output is just like the output of extendedscrollview with the same warning but i prefer to use nestedscrollview cause i can use sliver absorber and injector.and with just customscrollview in the tabbarview we dont get overlap issue when pulling down to refresh with sliverappbar that has bigger expanded height. by the way tnx alot for youre package...its exactly what i need. hope its get better and better.

RezaKhajvand avatar Dec 07 '22 21:12 RezaKhajvand

I have the same issues

SeeYouWilsen avatar Aug 04 '23 03:08 SeeYouWilsen

This problem does exist, but I don't know how to fix it. It doesn't seem to have much impact on usage

这个问题会导致页面在滑动的时候卡顿

SeeYouWilsen avatar Aug 04 '23 03:08 SeeYouWilsen

同样的问题,示例代码无修改。

chenfasheng avatar Dec 23 '23 12:12 chenfasheng

我提供复现demo,悬赏小100块,直到有人解决

fallenleavesguy avatar Jul 05 '24 16:07 fallenleavesguy

我提供复现demo,悬赏小100块,直到有人解决

解决办法就是把assert全干掉。

fallenleavesguy avatar Jul 06 '24 07:07 fallenleavesguy