TabBarView(
physics: NeverScrollableScrollPhysics(),
controller: tabcontroler,
children: <Widget>[
Container(color: Colors.red),
Container(color: Colors.green),
Container(color: Colors.blue),
],
),
- BouncingScrollPhysics () : 목록의 끝 / 시작시 bouncing 스크롤
- NeverScrollableScrollPhysics () : 탭 변경 중지 or 목록 스크롤 중지 or 페이지 뷰의 페이지 변경 중지
- ClampingScrollPhysics () : 정상 동작
class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage>
with SingleTickerProviderStateMixin {
final List<Widget> _pages = [];
void initState() {
super.initState();
_pages.add(Page1());
_pages.add(Page2());
_pages.add(Page3());
}
Widget build(BuildContext context) {
return DefaultTabController(
key: _tabKey,
length: 3,
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: _pages,
controller: _commonsService.tabController,
),
);
}
}
cf. https://stackoverflow.com/questions/51518393/disable-swiping-tabs-in-tabbar-flutter/51523272