更新於 2024/12/13閱讀時間約 1 分鐘

[Flutter]TabBar

class MyApp extends StatelessWidget {
final List<Tab> myTabs = <Tab>[
Tab(text: '第一頁'),
Tab(text: '第二頁'),
Tab(text: '第三頁'),
];

final pages = [One(), Two(), Three()];

@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: myTabs.length,
child: Scaffold(
appBar: AppBar(
title: Text("TabBarDemo"),
bottom: TabBar(
tabs: myTabs,
),
),
body: TabBarView(
children: <Widget>[One(), Two(), Three()],
),
),
),
);
}
}




分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.