当前位置:网站首页>Shutter project scrollcontroller attached to multiple scroll views, failed assertion: line 109 POS 12 error handling
Shutter project scrollcontroller attached to multiple scroll views, failed assertion: line 109 POS 12 error handling
2022-07-27 12:17:00 【Magic pen code beautiful】
One 、 explain
I've been writing about flutter When the project is , In case of an error :
The following assertion was thrown while handling a gesture:
ScrollController attached to multiple scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
Failed assertion: line 109 pos 12: '_positions.length == 1'
Reasons for error reporting :
1. Project added Drawer function , Need to pass through Drawer The menu item of Navigate to different pages .
2. Added BottomNavigationBar , adopt pagecontroller Navigate to different pages .
3. The project by Getx Do routing and state management .
Description of the problem : adopt Drawer Navigate to settings or other pages , And then through Drawer Re navigate to Home page , Click on BottomNavigationBar Of item term Will appear
Failed assertion: line 109 pos 12: '_positions.length == 1’
Error notification of .

Two 、 Solution :
- Drawer Navigation Use Get.offAndToNamed(‘12313’); Way to jump .
- Every time Jump to The homepage needs to be reinitialized pageController , adopt GetView Of build Method , Every time I redraw Home page interface , Reinitialize controller .
Specific operation :
Drawer Navigation part code :
class AppRouteProvide {
Future onRouteTo(String routeName) {
switch (routeName) {
case Routes.Auth:
Get.toNamed(Routes.Auth);
break;
case Routes.Home:
Get.offAndToNamed(Routes.Home);
break;
case Routes.Help:
Get.offAndToNamed(Routes.Help);
break;
case Routes.Splash:
Get.toNamed(Routes.Splash);
break;
case Routes.Connect:
Get.offAndToNamed(Routes.Connect);
break;
case Routes.Setting:
Get.offAndToNamed(Routes.Setting);
break;
}
return Future.value();
}
}
Home page view Part of the code :
class HomeScreen extends GetView<HomeController> {
@override
Widget build(BuildContext context) {
// print('HomeScreen build');
if (controller.pageController.hasClients) {
controller.onClose();
controller.onInit();
}
return AppbarWidgetScreen(
body: _buildBody(context),
bottomBar: _buildBottomNavigationBar(context),
);
}
Home page controller Part of the code
class HomeController extends GetxController {
final ApiRepository apiRepository;
RxInt selectedIndex = 0.obs;
late PageController pageController;
RxList<Widget> widgetPage = <Widget>[
HomeMainScreen(),
HomeBuyScreen(),
HomeCertScreen(),
HomeSellScreen(),
HomeMineScreen(),
].obs;
HomeController({
required this.apiRepository});
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
print('HomeController onInit()');
pageController = PageController(
initialPage: selectedIndex.value,
keepPage: true,
);
super.onInit();
}
@override
void onClose() {
super.onClose();
}
边栏推荐
- Multi activity disaster recovery construction after station B 713 accident | takintalks share
- USB network card drive data stream
- Simple blockchain day based on bolt database (2)
- Pytorch shows the summary like tensorflow
- 配置更改删除了路由过滤器,分布路由器不堪重负:加拿大网络大瘫痪
- Mysql8msi installation tutorial (database mysql installation tutorial)
- go入门篇 (5)
- Example of MATLAB dichotomy (example of finding zero point by dichotomy)
- Write and read system temporary files: createtempfile and tempfilecontent[easy to understand]
- Binary search decision tree (average search length of binary search tree)
猜你喜欢

Shell script text three swordsman awk
![[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis](/img/54/dc232f737da99c7097c395a326e74f.png)
[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis

Keil MDK compilation appears..\user\stm32f10x H (428): error: # 67: expected a "}" wrong solution
![[machine learning whiteboard derivation series] learning notes --- conditional random fields](/img/cc/87d8822b659b31360546adf057ef00.png)
[machine learning whiteboard derivation series] learning notes --- conditional random fields

Solution of digital tube flash back after proteus8 professional version cracking

Chapter 10 enumeration classes and annotations

In the first half of the year, the number of fires decreased by 27.7%. Guangdong will improve the fire safety quality of the whole people in this way

Makefile template
Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!

【产品】关于微信产品分析
随机推荐
JS string method summary
象棋机器人「弄折了」棋童的手指。。。
matlab二分法例题(用二分法求零点例题)
Newton Raphson iterative method
解决方案:idea project没有显示树状图
Solution: can not issue executeupdate() or executelargeupdate() for selections
Chapter 13 IO flow
go入门篇 (5)
Go Introduction (2)
[网摘][医学影像] 常用的DICOM缩略图解释以及Viewer converter 转换工具
Difference between verification and calibration
MySQL paging query instance_ MySQL paging query example explanation "suggestions collection"
The difference between microcomputer and single chip microcomputer
Regular expression of shell programming (grep of shell script text three swordsmen)
w.r.t. ; i.e.; etc.; e. G. what does it mean
Conversion between multiple bases
[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis
The chess robot "broke" the chess boy's finger...
系统临时文件的写和读:createTempFile和tempFileContent[通俗易懂]
Shake quickly to rescue the "frustrated person"