Skip to content

【bug!!】ExtendSliverAppBar嵌套PageView时,会重建 #17

@onism0106

Description

@onism0106

Content

ExtendedSliverAppbar(
leading: Row(children: [
Visibility(
child: InkWell(
child: Container(
child: Image(
image: AssetImage(
'res/images/idee536ecd91c3436f94a19bbb2fb5f133.png'),
width: 30.0,
height: 30.0,
fit: BoxFit.fill,
),
margin: EdgeInsets.only(left: 16.0),
),
onTap: () {
ActionAssetImage_984c8ff982174315a305c926987f5335()
.onTap(
context,
);
},
),
visible: true,
),
SizedBox(width: 45.0),
]),
title: Obx(() {
return Text(
vm.headerTitle.value,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w700,
color: Color(0xff1f1f1f),
),
);
}),
background: AspectRatio(
aspectRatio: 375 / 281,
child: EasyRefresh(
controller: vm.refreshController,
child: Stack(
alignment: AlignmentDirectional.bottomEnd,
children: [
Obx(() {
return PageView(
children:
_build1d6dc7c0c2764a5090ebe6702a68d105PageViewChildren(
context,
),
controller: vm.bannerController,
onPageChanged: (pageIndex) {
ActionPageView_1d6dc7c0c2764a5090ebe6702a68d105()
.onPageChanged(context, pageIndex);
},
);
}),
Obx(() {
return Visibility(
child: Container(
child: Obx(() {
return ToggleSwitch(
initialLabelIndex: vm.pageViewPosition.value,
minWidth: 50.0,
minHeight: 18.0,
cornerRadius: 14.0,
radiusStyle: true,
inactiveBgColor: Color(0x80e0e0e0),
inactiveFgColor: Color(0xff1f1f1f),
activeFgColor: Color(0xffffffff),
fontSize: 12.0,
activeBgColor: [Color(0xffff6644)],
labels: [
'直播',
'图片',
],
onToggle: (toggleIndex) {
ActionToggleSwitch_9ea5049cd0d74da0b1046ee3e6fce0a0()
.onToggle(context, toggleIndex);
},
);
}),
margin: EdgeInsets.only(
right: 20.0,
bottom: 15.0,
),
),
visible: vm.showToggleSwitch.value,
);
}),
],
),
onLoad: () {
ActionRefresh_97927526f84646b1a8958b759320409a().onLoad(
context,
);
},
),
),
actions: Row(children: [
Container(
child: Image(
image: AssetImage(
'res/images/idb69528cd0292479ea5088ac9d3d77f60.png'),
width: 30.0,
height: 30.0,
fit: BoxFit.fill,
),
margin: EdgeInsets.only(right: 15.0),
),
Container(
child: Image(
image: AssetImage(
'res/images/id43e8a5b5ca234d6a8f4aeadbe026b301.png'),
width: 30.0,
height: 30.0,
fit: BoxFit.fill,
),
margin: EdgeInsets.only(right: 12.0),
),
]),
toolBarColor: Color(0xffffffff),
),

调用PageView的controller去改变页面时,会报异常:一个controller绑定到了多个PageView上,经检查是PageView重建了,用系统的SliverAppBar无此问题

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions