Closed czeras closed 10 months ago
dart, iOS
在 ExtendedNestedScrollView 中设置 NeverScrollableScrollPhysics 属性无效,无法禁止滚动
Widget _buildScaffoldBody() { final double statusBarHeight = MediaQuery.of(context).padding.top; final double pinnedHeaderHeight = //statusBar height statusBarHeight + //pinned SliverAppBar height in header kToolbarHeight; return ExtendedNestedScrollView( physics: NeverScrollableScrollPhysics(), headerSliverBuilder: (BuildContext c, bool f) { return buildSliverHeader(); }, //1.pinned sliver header issue pinnedHeaderSliverHeightBuilder: () { return pinnedHeaderHeight; }, //2.inner scrollables in tabview sync issue onlyOneScrollInBody: true, body: Column( children: [ TabBar( controller: primaryTC, labelColor: Colors.blue, indicatorColor: Colors.blue, indicatorSize: TabBarIndicatorSize.label, indicatorWeight: 2.0, isScrollable: false, unselectedLabelColor: Colors.grey, tabs: const [Tab(text: 'Tab1')], ), Expanded( child: TabBarView( physics: NeverScrollableScrollPhysics(), controller: primaryTC, children: [ // SecondaryTabView('Tab0', secondaryTC), ListView.builder( key: const PageStorageKey('Tab1'), physics: const NeverScrollableScrollPhysics(), itemCount: 50, itemBuilder: (BuildContext c, int i) { return Container( alignment: Alignment.center, height: 60.0, child: Text( const Key('Tab1').toString() + ': ListView$i', ), ); }, ), ], ), ) ], ), ); }
先给官方开issue
好吧,那没问题了,给产品沟通修改交互方式
Platforms
dart, iOS
Description
在 ExtendedNestedScrollView 中设置 NeverScrollableScrollPhysics 属性无效,无法禁止滚动
My code
Widget _buildScaffoldBody() { final double statusBarHeight = MediaQuery.of(context).padding.top; final double pinnedHeaderHeight = //statusBar height statusBarHeight + //pinned SliverAppBar height in header kToolbarHeight; return ExtendedNestedScrollView( physics: NeverScrollableScrollPhysics(), headerSliverBuilder: (BuildContext c, bool f) { return buildSliverHeader(); }, //1.pinned sliver header issue pinnedHeaderSliverHeightBuilder: () { return pinnedHeaderHeight; }, //2.inner scrollables in tabview sync issue onlyOneScrollInBody: true, body: Column( children:[
TabBar(
controller: primaryTC,
labelColor: Colors.blue,
indicatorColor: Colors.blue,
indicatorSize: TabBarIndicatorSize.label,
indicatorWeight: 2.0,
isScrollable: false,
unselectedLabelColor: Colors.grey,
tabs: const [Tab(text: 'Tab1')],
),
Expanded(
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
controller: primaryTC,
children: [
// SecondaryTabView('Tab0', secondaryTC),
ListView.builder(
key: const PageStorageKey('Tab1'),
physics: const NeverScrollableScrollPhysics(),
itemCount: 50,
itemBuilder: (BuildContext c, int i) {
return Container(
alignment: Alignment.center,
height: 60.0,
child: Text(
const Key('Tab1').toString() + ': ListView$i',
),
);
},
),
],
),
)
],
),
);
}
Try do it